What is the best way to store Google Maps points in the database? [closed]

0

I'm developing a system that will store some Google Maps paths of the registered users and structured my table as below:

----------------------
| trajetos           |
----------------------
| id                 |
| id_usuario         |
| partida_longitude  |
| partida_latitude   |
| chegada_longitude  |
| chegada_latitude   |
----------------------

This route will be simple and will include a starting point and an arrival point. I know this table will have many records (hundreds of thousands) and at this point I need to think about performance when I go searching for a route.

My question is:

  

This is a common (and perhaps best) framework for storing   Google Maps points in a database?

     

Another option would be to store the address (instead of latitude and   longitude), but this would compromise performance by   information?

     

I also thought of using only the zip code with the place number (for   precision), would it be better than latitude and longitude? Are there any other   way to store these "points" that is efficient?

    
asked by anonymous 22.11.2017 / 19:26

1 answer

1

Dude there are several ways to structure this but everything depends on the need. I would structure it this way:

id id_usuario origem destino

Being implicit the data in the two source and destination columns are in the latitude and < strong> longitude .

I do not recommend using the address or zip code, because there are places that may not be in the Post database, let alone on Google Maps. Already with latitude and longitude you can find anywhere on the planet on the map.

    
22.11.2017 / 20:01