[postgis-users] How to Fix "Operation on two geometries with different SRIDs"?
bthoen at gisnet.com
Mon Aug 10 09:25:53 PDT 2009
I've got a table in PostGIS that's in 4326 srs and I'm trying to overlay
it on a map in 2163 srs via MapServer and I'm getting the following error:
msPOSTGISLayerWhichShapes(): Query error. Erro-ERROR: Operation on two
geometries with different SRIDs
The DATA parameter I used is this:
DATA "geom FROM ( SELECT gid, geom, class, feature1 FROM federal_land)
AS fedlands USING UNIQUE gid USING srid=2163"
The federal_lands table is actually in srs 4326, and my hopes that by
telling MapServer to use srid 2163 that it would magically transform it
on the fly were dashed repeatedly.
I can see by the cursor it made what the problem is, but I don't know
how to fix it. Here's the cursor:
With query string: DECLARE mycursor BINARY CURSOR FOR SELECT
geom)),'NDR'),gid::text from (SELECT * FROM federal_lands) AS
qryFedLands WHERE SELECT geom && setSRID('BOX3D(-110.575644114681
find_srid('','federal_lands','SELECT geom') )
Since I can't get at the cursor directly, can anyone tell me how to
write the MapServer DATA statement so that either geom is transformed on
the fly to srs 4326 for this box intersect comparison, or the box used
to select federal_lands is transformed to 2163?
- Bill Thoen
More information about the postgis-users