Home > Software engineering >  POSTGIS | ST_Intersects: Operation on mixed SRID geometries (Point, 0) != (MultiPolygon, 24379) SQL
POSTGIS | ST_Intersects: Operation on mixed SRID geometries (Point, 0) != (MultiPolygon, 24379) SQL

Time:04-26

I have Polygon Geometry geom in the PostGIS, which I want to check with a point "POINT(77.2135569,28.6248447)", to check whether it intersect or not.

SELECT ST_Intersects('POINT(28.6248447 77.2135569)'::geometry, geom) FROM public.tablename

Here geom is the column name with data type as Geometry.

Getting the following error:

Error: ST_Intersects: Operation on mixed SRID geometries (Point, 0) != (MultiPolygon, 24379) SQL state: XX000

POSTGIS Version: POSTGIS="3.1.5 v2.4.3-95-gc6a5796" [EXTENSION] PGSQL="140" GEOS="3.9.2-CAPI-1.14.3" PROJ="8.1.1" GDAL="GDAL 3.3.3, released 2021/10/25" LIBXML="2.9.11" LIBJSON="0.15" LIBPROTOBUF="1.4.0" WAGYU="0.5.0 (Internal)" RASTER

CodePudding user response:

You must declare the projection of the point.

You can add it to the text: select 'SRID=4326;POINT(1 1)'::geometry;

or you can use a function select st_SetSRID('POINT(1 1)'::geometry,4326);

or you can create the point with parameters and SRID: select st_point(1,1,4326);


That being said, your point seems to be in lat-longs (likely 4326) which is different from the polygon projection (24379), so you would still have to transform it:

SELECT 
  ST_Intersects(
    ST_Transform(
      ST_SetSRID('POINT(28.6248447 77.2135569)'::geometry,
      4326),
    24379),
  geom) FROM public.tablename
  • Related