[gdal-dev] How to compare the horizontal coordinate systems of two WKTs

John Hayes jhayes at lizardtech.com
Fri Mar 4 16:16:50 PST 2016


Hi,

I need to find out if two WKTs have the same horizontal coordinate systems.  I found OSRIsSameVertCS() but I need some like it for horizontal CS.

I'm thinking something like this should do the trick:

   ref1 = OSRNewSpatialReference(wkt1);
   if (OSRIsCompound(ref1))
      ref1 = <get horizontal cs>(ref1);

   ref2 = OSRNewSpatialReference(wkt2);
   if (OSRIsCompound(ref2))
      ref2 = <get horizontal cs>(ref2);

   hasSameHorizontalCS = OSRIsSame(ref1, ref2);

However, I don’t see a way to extract the horizontal cs out of a compound cs.

Questions:
1) Is there a way to extract the horizontal coordinate system?  I’m using GDAL 1.9.
2) Is there a better way to solve my problems?

-john


More information about the gdal-dev mailing list