Google Maps Save Polygon and points in MySQL using PHP -
right have application allows users draw polygon on google maps. need save polygon using php , mysql i'm unsure of best practices.
should enable spatial extensions , save geometry? should save each vertical (lat/lng pair) in array? approach i'm unaware of?
i'm wondering best practices are. using mysql spatial extensions seem daunting. returns things in wkt , have parse text make else. seems convoluted.
it's best think of usage scenarios when planning out storage layer.
this figure out queries you'll want persistence layer optimize for.
if you're going handle lot's of queries like, "find me objects within space". may want @ using spatial extensions.
however, if of time you're drawing object given id, saving polygons json blob in db may do.
create table polygons ( polygon_id int not null, vertices_json varchar(4096) )
Comments
Post a Comment