geocoding - find location of a point on a polygon or cycle in mysql -
how can determine if point given (latitude, longitude) inside polygon defined list of (latitude, longitude)? if save shapes circle defined (latitude, longitude, radius) how can handle it? please explain both of scenario.... thanx
a polygon shape straight sides , final connection not-open. circles need not apply. posers.
brilliant edit follow when time permits.
edit:
create table polything ( id int auto_increment primary key, boundary polygon not null ); insert polything (boundary) values( polygonfromtext( 'polygon(( 9.190586853 45.464518970, 9.190602686 45.463993916, 9.191572471 45.464001929, 9.191613325 45.463884676, 9.192136130 45.463880767, 9.192111509 45.464095594, 9.192427961 45.464117804, 9.192417811 45.464112862, 9.192509035 45.464225851, 9.192493139 45.464371079, 9.192448471 45.464439002, 9.192387444 45.464477861, 9.192051402 45.464483037, 9.192012814 45.464643592, 9.191640825 45.464647090, 9.191622331 45.464506215, 9.190586853 45.464518970))' ) ); insert polything (boundary) select polygonfromtext( "polygon (( 121.44842136764532 121.44842136764532, 121.45076025390631 31.221990825071376, 121.45402182006842 31.218366658611853, 121.45091045761114 31.217054584347302, 121.44842136764532 31.22119260287111 )) ") -- mysql 5.6.1 , later believe: select p.id, st_contains(p.boundary,geomfromtext('point(23.9999 38.224)')) polything p -- older version select p.id, contains(p.boundary,geomfromtext('point(23.9999 38.224)')) polything p select p.id, contains(p.boundary,geomfromtext('point(121.44842136764532 121.44842136764532)')) polything p gis spatial
contains may or not work. aim 5.6.1 , above , use st_contains
Comments
Post a Comment