TransWikia.com

Check whether a point is inside a polygon or not in MySQL

Geographic Information Systems Asked by Saroj on May 17, 2021

I am trying to get the points those are within the shapefile. I have tried the Spatial functions and it’s showing an error:

3033 – Binary geometry function st_contains given two geometries of different srids: 4326 and 0, which should have been identical.

My query is

SELECT 
lightning.lightning_id, lightning.latitude, lightning.longitude,
lightning.flash_type, 
DATE_FORMAT(lightning.lightning_time, '%D %b %Y %T %p') as lightning_time 
FROM lightning, districts_s 
WHERE 
ST_CONTAINS(districts_s.SHAPE, Point(lightning.longitude, lightning.latitude)) 
AND lightning.height > 50

To rectify the error I got a solution from here and this link but no result, as this also showing an error:

ST_Transform does not exist

update 1

ERROR ON ST_SetSRID
enter image description here

One Answer

Have you tried this, on both layer:

UPDATE districts_s SET SHAPE = ST_SetSRID(SHAPE, 4326)

But I guess the problem is with lightning, you should save lightning.latitude and lightning.latitude to a geometry (point) column.

Answered by pnz on May 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP