[mapserver-users] MapServer 4.8.3: MapScript setProjection

Frank Warmerdam warmerdam at pobox.com
Thu Mar 27 16:12:37 EDT 2008


Simon Greig wrote:
> Hi,
> 
> This is a follow up to a question a colleague asked a few weeks ago:
> http://lists.osgeo.org/pipermail/mapserver-users/2008-March/054772.html
> 
> To summarise:
> 
> In order to improve performance in our java application that uses the 
> mapscript API we have replaced:
> 
> mapobj.setProjection("init=epsg:27700");
> 
> with
> 
> private static final String PROJECTION_WK_EPSG_27700 = "PROJCS[\"OSGB 1936 
> / British National Grid\",GEOGCS[\"OSGB 
> 1936\",DATUM[\"OSGB_1936\",SPHEROID[\"Airy 
> 1830\",6377563.396,299.3249646,AUTHORITY[\"EPSG\",\"7001\"]],AUTHORITY[\"EPSG\",\"6277\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4277\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",49],PARAMETER[\"central_meridian\",-2],PARAMETER[\"scale_factor\",0.9996012717],PARAMETER[\"false_easting\",400000],PARAMETER[\"false_northing\",-100000],AUTHORITY[\"EPSG\",\"27700\"]]";
> 
> ...
> 
> mapobj.setWKTProjection(PROJECTION_WK_EPSG_27700);
> 
> 
> We have also changed the code to use the WKT projection method for each 
> layer.
> 
> As Rob says the performance improvement is way better and we thought we 
> had a winner. 
> Unfortunately we have a problem based on the size of the image and 
> bounding box. 
> 
> If we ask for a small bounding box (roughly 1 mile by 1 mile) with a 
> 1000x800 PNG image then it works
> If we ask for a large bounding box (roughly 500 miles by 500 miles) with a 
> 200x200 PNG image then it works
> If we ask for a large bounding box with a 300x300 PNG image then we get 
> this error:
> 
> "Layer must have an EPSG or AUTO projection code (in its PROJECTION object 
> or wms_srs metadata)"
> 
> 
> Unfortunately Rob is on leave and I am looking after things in his 
> absence.  Any help is much appreciated :-)

Simon,

I'm not sure what is going on here exactly.  I *suspect* that your bigger
window is the first time some of this data is getting pulled in but I'm not
sure.  Do you still set the corresponding epsg code in the wms_srs metadata?

It may be that you could skip the WKT operations and just re-order the
epsg init file so that 27700 is at the top to get equally good speed up
with lets side effects.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list