mysql ST_WITHIN with POLYGON -


i not able return following test.

mysql version: 5.6.16 (win32)

select  (st_within(geomfromtext('point(110.341903 1.558064)'), st_geomfromtext(          "polygon((1.558467 110.341781 1.558081 110.342317 1.557764 110.34175 1.558467 110.341781 ))"          ))) 

i want see point within polygon. map point within, did wrong?

i did try on, doesn't work

mysql> set @g1 = st_geomfromtext('point(110.341903 1.558064)'); query ok, 0 rows affected (0.00 sec)  mysql> set @g2 = st_geomfromtext('polygon((1.558467 110.341781 1.558081 110.3423 17 1.557764 110.34175 1.558467 110.341781 ))'); query ok, 0 rows affected (0.00 sec)  mysql> select st_within(@g1,@g2); +--------------------+ | st_within(@g1,@g2) | +--------------------+ |               null | +--------------------+ 1 row in set (0.00 sec) 

you didn't add commas after each pair of values in definition of polygon.

you have:

polygon((1.558467 110.341781 1.558081 110.342317 1.557764 110.34175 1.558467 110.341781 )) 

it should be:

polygon((1.558467 110.341781, 1.558081 110.342317, 1.557764 110.34175, 1.558467 110.341781 )) 

additionaly, suspect have swapped coordinate values because point(110.341903 1.558064) cannot located inside polygon, while point(1.558064 110.341903) can.

this works without problems:

select (   st_within(     geomfromtext(       'point(1.558064 110.341903)'     ),      st_geomfromtext(       'polygon((1.558467 110.341781, 1.558081 110.342317, 1.557764 110.34175, 1.558467 110.341781 ))'     )   ) ) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -