geolocation - How to insert the polygon and checking if a passed polygon is inside it in mysql database? -
can check if polygon inside polygon in mysql query? query polygons contains passed polygon in string?
after googling, found query:-
select *, astext(poly) geos contains( geomfromtext('polygon((42.000497 -109.050149, 41.002380 -102.051881, 39.993237 -102.041959, 38.999037 -109.045220, 42.000497 -109.050149))'), poly );
i not sure doing basically? query insert polygon , checking if passed polygon inside it?
thanks in advance!
you can insert polygon this:
set @g1 = 'polygon (( //your points of polygon here ))'; insert geos set poly=st_geomfromtext(@g1);
and if want check g2 if contains g1:
select * geos st_contains(st_geomfromtext(@g2), poly);
Comments
Post a Comment