Now that PROJ data includes "AREA" descriptions with degree symbols,
what to people think about the attached patch which makes CPLDecToDMS
report angles with the degree symbol too ?

Sadly, the reverse function CPLDMSToDec will need more work as we
cannot fudge the fact that the degree symbol is a wchar there.

----- Sample output from
-----     gdalinfo ./swig/java/test_data/byte.tif
Driver: GTiff/GeoTIFF
Files: ./swig/java/test_data/byte.tif
Size is 20, 20
Coordinate System is:
PROJCRS["NAD27 / UTM zone 11N",
    BASEGEOGCRS["NAD27",
        ...     ...
    USAGE[
        SCOPE["Engineering survey, topographic mapping."],
        AREA["North America - between 120°W and 114°W - onshore. Canada - Alberta; 
British Columbia; Northwest Territories; Nunavut. Mexico. United States (USA) - 
California; Idaho; Nevada; Oregon; Washington."],
        BBOX[26.93,-120,78.13,-114]],
    ID["EPSG",26711]]
Data axis to CRS axis mapping: 1,2
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) (117°38'28.21"W, 33°54' 8.47"N)
Lower Left  (  440720.000, 3750120.000) (117°38'27.92"W, 33°53'29.51"N)
Upper Right (  441920.000, 3751320.000) (117°37'41.48"W, 33°54' 8.71"N)
Lower Right (  441920.000, 3750120.000) (117°37'41.20"W, 33°53'29.75"N)
Center      (  441320.000, 3750720.000) (117°38' 4.70"W, 33°53'49.11"N)
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray

--
Andrew C. Aitchison                                     Kendal, UK
                        [email protected]
--- port/cpl_conv.cpp.orig	2021-04-26 13:32:57.000000000 +0100
+++ port/cpl_conv.cpp	2021-04-29 14:32:22.290722419 +0100
@@ -2227,6 +2227,7 @@
         {
           case 'D':
           case 'd':
+          // case '°': // not a char :-(
             n = 0; break;
           case '\'':
             n = 1; break;
@@ -2307,7 +2308,7 @@
 
     char szFormat[30] = {};
     CPLsnprintf(szFormat, sizeof(szFormat),
-                "%%3dd%%2d\'%%%d.%df\"%s",
+                "%%3d°%%2d\'%%%d.%df\"%s",
                 nPrecision+3, nPrecision, pszHemisphere);
 
     static CPL_THREADLOCAL char szBuffer[50] = {};
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to