0

I am extremely new to mysql, but I cannot find the error in this query

SELECT latitude, longitude from mytable where ST_CONTAINS(ST_GEOMFROMTEXT('POLYGON((47 -67, 47 -123, 21 -78, 47 -67)'), point(longitude, latitude))

The polygon is a triangle that covers most of the US. All of the lat/lng of the points should be inside the above polygon wkt, yet I get no rows. I have reversed the wkt coords in case I had it backwards, but still no luck. I am hoping I have an obvious mistake.

1

You are missing a closing parentheses at the end:

SELECT latitude, longitude from mytable where ST_CONTAINS(ST_GEOMFROMTEXT('POLYGON((47 -67, 47 -123, 21 -78, 47 -67)'), point(longitude, latitude)))

  • 1
    Thank you. It was a closing parens, just a different one ('POLYGON((47 -67, 47 -123, 21 -78, 47 -67)**)**') – Mike Morris - MBXSW Jul 18 '16 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.