0

I need to translate this PostGIS query:

SELECT boundary
        ST_Intersects(ST_SetSRID(ST_Buffer(ST_MakePoint(11.255492,43.779251),0.002), 4326), ST_GeomFromKML(boundary)) as intersect,
FROM 
    mytable 
WHERE 
        ST_Intersects(ST_SetSRID(ST_Buffer( ST_MakePoint(11.255492,43.779251),0.002), 4326), ST_GeomFromKML(boundary))
LIMIT 1

to MySQL with spatial data.

I tried this, but it is not working:

SELECT 
    boundary, 
    ST_Intersects(Buffer('POINT(11.7094335,44.2754631)', 2), GeomFromText(boundary)) as intersect
FROM 
    mytable 
WHERE 
    ST_Intersects(Buffer('POINT(11.7094335,44.2754631)', 2), GeomFromText(boundary))

The MySQL boundary column contains data in this format:

POLYGON((11.752094222227 44.322710250414,11.753712975677 44.322710250414,11.753712975677 44.321900873689,11.752094222227 44.321900873689,11.752094222227 44.322710250414))

What am I doing wrong?

2
  • What's the error message you're getting? Commented Jan 4, 2020 at 11:35
  • 1
    I was not getting any error message. I solved the problem and I'm going to post the answer right now. Commented Jan 6, 2020 at 14:38

1 Answer 1

1

I found the answer by trying and trying again... This solved the problem:

SELECT 
        boundary, 
        ST_Intersects(GEOMFROMTEXT(boundary), ST_Buffer(POINT(11.752094222227, 44.322710250414), 2)) as intersect
FROM 
        mytable 
WHERE  
        ST_Intersects(GEOMFROMTEXT(boundary), ST_Buffer(POINT(11.752094222227, 44.322710250414), 2))

I hope this could be useful for future users.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.