[mapserver-users] MapServer 4.8.3: MapScript setProjection

Daniel Morissette dmorissette at mapgears.com
Wed Apr 2 08:44:29 PDT 2008


Simon,

Are you also setting the "wms_srs" metadata in the map's web object? If 
not then perhaps try setting the "wms_srs" metadata in the web object to 
"EPSG:27700" and see if that helps.

Daniel


Simon Greig wrote:
> 
> Hi,
> 
> We have made the changes to remove the explicit layer setProjection and 
> allow each layer to inherit the projection from its map.  
> 
> However for some vector layers we consistently get:
> "Layer must have an EPSG or AUTO projection code (in its PROJECTION 
> object or wms_srs metadata)"
> 
> A layer either works or does not work, but 30% of our layers fail with 
> this error.  Also layers that work or fail differ between environments.
> 
> We don't use a map file for layer data (just for mapObj config) as all 
> of our layer configurations are stored in a database.  Our WMS_LAYERS 
> table stores all of the data that you would normally see within the 
> LAYERS section of a mapfile.
> 
> I have checked the PROJECTION setting and for all layers it is set to 
> "init='epsg:27700'".
> 
> Our code manually constructs mapObj and layerObj objects taking the 
> configuration from our config database.
> 
> When our code constructs the layerObj JNI objects it checks the 
> PROJECTION value from the database and if the DB value is the same as 
> the mapObj projection then the code skips the layerObj.setProjection 
> because it assumes that the layer will inherit the projection from the 
> mapObj used in the constructor of the layerObj.
> 
> None of the layers in the list are WMS layers and the layers that fail 
> are all going to our Oracle Spatial database.
> 
> I have asked the database team to investigate the differences between 
> layers that work and fail in the same environment and layers that work 
> in one environment and fail in another.  I have inspected the 
> development database and a I cannot see anything different between a 
> layer that works and one that does not.
> 
> e.g. If I simulate the mapfile syntax for our layers for the benefit of 
> the email, if we had defined our layers in the mapfile they would look 
> like this:
> 
> LAYER
>    NAME  "2001UrbanAreas(Census)"
>    CONNECTION "<usr>/<pwd>@SPR01"
>    STATUS ON
>    TYPE POLYGON
>    DATA "GEOMETRY FROM OTHERAGENCIES.DCLG00000001 USING SRID 81989"
>    MAXSCALE 99999999
>    MINSCALE 0
>    TRANSPARENCY 60
>    PROJECTION "init=epsg:27700"
> END
> 
> LAYER
>    NAME  "EnglishHeritageRegions"
>    CONNECTION "<usr>/<pwd>@SPR01"
>    STATUS ON
>    TYPE POLYGON
>    DATA "GEOMETRY FROM OTHERAGENCIES.ENGH00000001 USING SRID 81989"
>    MAXSCALE 99999999
>    MINSCALE 0
>    TRANSPARENCY 60
>    PROJECTION "init=epsg:27700"
> END
> 
> 
> 2001Urban layer fails with the projection error, the 
> EnglishHeritageRegions works for the exact same bounding box/scale.
>    
> 
> 
> We have not applied the METADATA change as the layers are not external 
> WMS layers and presumably setting the METADATA wms_srs would provide the 
> same effect as calling layerObj.setProjection?
> 
> If we restore the code to setProjection for every layer then the errors 
> go away - but our performance goes down.
> 
> 
> Does any of this description allow anyone to suggest areas that I should 
> get the database team to focus on?
> 
> Any advice appreciated :-)
> 
> Simon
> 
> 
> ------------------------------------------------------------------------
> 
> /
> /
> 
> /Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number 
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU/
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


-- 
Daniel Morissette
http://www.mapgears.com/



More information about the MapServer-users mailing list