Postgis Error on st_within
SRID
is a spatial reference identifier. The SRID
of WGS84 is 4326. In Postgis, the spatial query is based on the geometries have the same SRIDs
. When using the PostGIS Shapefile Import/Export Manager, the SRID
is shown.
To check the SRID
of a shapefile:1
SELECT Find_SRID('schema_name', 'table_name', 'geom');
To change the wrong SRID
to WGS84:1
2
3
4
5
6
7-- update SRID in the polygon
UPDATE table_name SET geom=ST_SetSRID(geom,4326);
-- or
ALTER TABLE table_name
ALTER COLUMN geom TYPE geometry(MultiPolygon,4326)
USING ST_SetSRID(geom,4326);
Reference
[1] ST_Transform and ST_SetSRID: To project or not to project?