[gdal-dev] WCS driver

Even Rouault even.rouault at spatialys.com
Sun Oct 29 02:52:34 PDT 2017


Hi Ari,

> 
> I'd like to have your comment on this.
> 
> Ari Jolma kirjoitti 28.10.2017 klo 17:39:
> > Reading MapServer code, it seems to be based on the idea that x,y is
> > always east,north and when it writes BoundingBox, it swaps x and y if
> > the projection is inverted (like 4326). It does not do that when it
> > writes GridCRS.
> > 
> > GDAL seems to be based on the idea that x,y is what the projection
> > says (what the projection says could be found out with
> > OGRSpatialReference::GetAxis - however, for 4326 it does not say
> > anything).

Depends on how your import the CRS. If you import with importFromEPSG(), it will strip axis 
definition when they are in the unusual order. If you do importFromEPSGA(), you'll always 
get the axis definition.
(try gdalsrsinfo EPSG:4326 vs gdalsrsinfo EPSGA:4326. Same for EPSG:2393 vs EPSGA:2393)

> > This is my impression from WCS driver - I see there's a lot
> > on this issue in the GML driver page.
> 
> I think the fix depends on what's GDAL's opinion to what X,Y is. Is it
> what the projection says or is it easting,northing?
> 

I guess it depends on the WCS version. According to
http://mapserver.org/development/rfc/ms-rfc-41.html , contrary to WCS 1.0,  WCS 1.1 is 
supposed to honour EPSG axis order, so lat,long for most/all geodetic CRS, and 
easting,northing or northing,easting depending on the actual projected CRS

The "tradition" in GDAL drivers such as GML, WFS is to strip AXIS from the CRS WKT exposed 
when they are in the "annoying" lat,long and northing,easting, 

>From the GML driver:
{{{
            if (poSRS != NULL && m_bInvertAxisOrderIfLatLong &&
                GML_IsSRSLatLongOrder(pszSRSName))
            {
                OGR_SRSNode *poGEOGCS = poSRS->GetAttrNode("GEOGCS");
                if( poGEOGCS != NULL )
                    poGEOGCS->StripNodes("AXIS");

                OGR_SRSNode *poPROJCS = poSRS->GetAttrNode("PROJCS");
                if (poPROJCS != NULL && poSRS->EPSGTreatsAsNorthingEasting())
                    poPROJCS->StripNodes("AXIS");

            }
}}}

and to switch the coordinates appropriately so that the user sees the "GIS friendly" lon,lat 
and x,y order. It would be propably appropriate for the WCS driver to do so as well, as 
nothing else in GDAL can deal with rasters referenced in lat,long order.

Now, you may also have to deal with implementation bugs (if what MapServer does is indeed 
a bug), which can sometimes be auto-corrected, or not...

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171029/a9731889/attachment-0001.html>


More information about the gdal-dev mailing list