For background reading: 
http://docs.geotools.org/latest/userguide/library/referencing/order.html  

I am having a long drawn out battle with GeoTools WebMapServer code, trying to 
teach it to report back the correct CoordinateReferenceSystem to match WMS 
1.3.0.

The WMS standard went from the wild west of WMS 1.1.1 when us programmers 
controlled things. In this happy state of affairs all servers reported back 
bounds in XY order.
For WMS 1.3.0 ISO became involved, the party ended, and severs now return 
bounds in the order defined by the EPSG database. For EPSG:4326 this results in 
YX order.

Now that is not too tragic, as long as the CRS is consistent with the data we 
can ask GeoTools to figure things out for us.

Trouble is:

1) GeoTools WMS code is happy parsing out the data correctly, and the srsName 
as "EPSG:4326"
2) With the global org.geotools.referencing.forceXY hint turned on that srsName 
is turned into a CoordinateReferenceSystem that does not match the data!

Two options:

TURN OFF HINT

We can finally turn off the global hint, this change has been coming since 
GeoTools 2.3 :-)

The downside is that our users may have things like shape files that assume XY 
order, we can hunt down any EPSG lookups of this nature and use CRS.decode( 
code, true ) - or better yet give the user some way to control what the data 
means. We *do* often lookup an EPSG definition for a shapefile in order to have 
access to a richer definition then provided by shapefile.prj file.

FIX GEOTOOLS WMS 1.3.0

I was going to ask Andrea if there was a way to have our cake (global hint) and 
eat it too (have WebMapServer return the correct value).  

And then reading that page I found it:

                        if( forceXY == null ){
                            crs = CRS.decode(srsName);
                        }
                        else if( forceXY == Boolean.TRUE ){
                            crs = CRS.decode(srsName,true);
                        }
                        else if( srsName.startsWith("EPSG:") && 
Boolean.getBoolean(GeoTools.FORCE_LONGITUDE_FIRST_AXIS_ORDER)){
                            // how do we look up the unmodified axis order?
                            String explicit = srsName.replace("EPSG:", 
"urn:x-ogc:def:crs:EPSG:");
                            crs = CRS.decode(explicit,false);
                        }
                        else {
                            crs = CRS.decode(srsName,false);
                        }


Still this is a very mean change to play on GeoTools. Innocent apps that have 
forceXY on may be shocked (shocked!) when WMS 1.3.0 tells them different. Still 
they were unlikely to be able to talk to a WMS 1.3.0 anyways since the data was 
inconsistent…

So I can pull the trigger on this WMS fix, and should anyways.

But we should consider when to remove this forceXY hack … anyone else run into 
trouble of this nature?
----
Jody Garnett  

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to