Mysql Database Design - Saving Single and Hours Long

I have a mysql database table that will store places for buildings and events and several other things. All locations are stored in one table and are associated with buildings, events, etc. Through their many, many tables. That way, I can just display the points on the map, and also allow filtering, etc.

However, the problem is related to some things that have the same location, so 1 lat, long, but some, like a track, have several long positions in lats, and something like a large stadium may have a polygon above it. They are also stored as a list of lat, longs with the first and last of them.

I am wondering how should I store this in mysql db. Initially, I just had a column for lat, long, and id for the lookup table. Should I have ANOTHER lookup table for coordinates or serialize the data before placing them in the database in any way or just save the whole row in one field LAT1, long1 LAT1, long1; LAT2, long2; LAT1, long1

Any suggestions?

+3
source share
2 answers

I wouldn’t warp the data from the very beginning by pushing a whole “serialized” polygon into one field.

, Polygons ( , , , , ), , , ) PointsInPolygon ( , ID, , ).

( ) ( " X", ..). , , , - ( , ..). , .

+3

​​ ( ) API Google, , , lat/lon JSON varchar.

JSON API Google . JSON, : ["point",1.23456,2.34567] ["line",1.23456,2.34567,3.45678,4.56789] ..

+1

Source: https://habr.com/ru/post/1711033/


All Articles