MapServer – Resolving SRID Error

coordinate systemmapserver

I've created a network topology using QGIS, saved it as a shp, imported it into PostGIS using shp2pgsql and I'm now trying to output some of the geometry using mapserver.

Unfortunately mapserver is kicking up the following error:

msDrawMap(): Image handling error. Failed to draw layer named 'ROUTE'.
msPostGISLayerWhichShapes(): Query error. Error (ERROR: Operation on
two geometries with different SRIDs
) executing query: select
encode(AsBinary(force_collection(force_2d("the_geom")),'NDR'),'hex')
as geom,"gid" from (SELECT buildingroute.the_geom,buildingroute.gid
FROM routetest INNER JOIN buildingroute ON
routetest.toid=buildingroute.gid ORDER BY routetest.id ASC) AS foo
where the_geom && GeomFromText('POLYGON((-22000000 -11000000,-22000000
11000000,22000000 11000000,22000000 -11000000,-22000000
-11000000))',32709)

Now I don't know a lot about spatial referencing, but I've copied the settings from QGIS and I still get those errors. Here's those settings in QGIS:
enter image description here

The mapserver file I created can be found at http://pastie.org/2202322

If anyone can give me advice on what I need to change in the mapserver file I'd appreciate it.. I expect I've just got the projection settings wrong..

Thanks!

Best Answer

In your map file try changing the map's projection to read from the epsg file. Your current map projection isn't a full projection description.

So rather than:

MAP
    NAME TEST
    STATUS ON
    IMAGECOLOR 255 255 255
    IMAGETYPE PNG
    PROJECTION
      "proj=utm"
      "ellps=WGS84"
      "datum=WGS84"
    END

Use:

MAP
    NAME TEST
    STATUS ON
    IMAGECOLOR 255 255 255
    IMAGETYPE PNG
    PROJECTION
      "init=epsg:32709"
    END

Or put in the full projection description of:

PROJECTION
  "proj=utm"
  "ellps=WGS84"
  "datum=WGS84"
  "zone=9"
  "units=m"
  "south"
  "no_defs"
END

As your layer is in the same projection as the map you can remove the projection from the layer definition - it is assumed to be in the map projeciton unless specified otherwise.

   PROJECTION
      "init=epsg:32709"
   END
Related Question