Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is the better way to store a polyline (google maps) in a data base?

First sorry my English... I have to store a lot of polyline in a data base. It ocurred to me create a table call "points" and store all points from each polyline. Another thing that occurred to me is serialize (with php) the polilynes and store in a single row each polilyne

Which option thinks are better?

Very Thanks

like image 404
Gustavo Avatar asked Dec 16 '25 16:12

Gustavo


1 Answers

If you're not married to MySQL, PostgreSQL has a PostGIS extension that natively handles geographic data, including queries against it.

If you're set on MySQL, I'd do it as points, so you can query against individual points. Serialization might be a little more efficient to fetch the line, but it ruins querying.

like image 171
ceejayoz Avatar answered Dec 19 '25 06:12

ceejayoz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!