[postgis-users] How to Fix "Operation on two geometries with different SRIDs"?

Paul Ramsey pramsey at cleverelephant.ca
Mon Aug 10 09:49:54 PDT 2009


Your data statement is a description of the *data*, not a set of
directions on what to do with the data. You get Mapserver to do the
reprojection for you, like this:

MAP
  PROJECTION
    "init=epsg:2163"
  END

  ... your stuff ...

  LAYER
    PROJECTION
      "init=epsg:4326"
    END
    ... your stuff ...
    DATA "geom FROM federal_land USING UNIQUE gid USING SRID=4326"
    ... more ofyour stuff ...
  END

END

By saying what projection the LAYER is in, and then telling Mapserver
to output a different projection via the MAP (or, if you are using
WMS, via the SRS parameter), everything works magically inside
Mapserver.

P.


On Mon, Aug 10, 2009 at 9:25 AM, Bill Thoen<bthoen at gisnet.com> wrote:
> 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
> "CLASS"::text,"feature1"::text,asbinary(force_collection(force_2d(SELECT
> geom)),'NDR'),gid::text from (SELECT * FROM federal_lands) AS qryFedLands
> WHERE SELECT geom && setSRID('BOX3D(-110.575644114681
> 23.5760812552219,-97.204100994059 35.152897732775)'::BOX3D,
> 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?
>
> Thanks,
> - Bill Thoen
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list