Skip to main content

Wondering if anyone had developed a workflow where you can extract specific components in a feature's Coordinate system description and add that into an attribute, e.g. Unit, Datum?

 

With a CoordinateSystemExtractor + CoordinateSystemDescriptionConverter we can extract the full description in the selected representation into an attribute. But parsing it to get to the components is not the most straight forward. Any tips would be appreciated.

Hi @FMELizard, I've never developed such a workflow, but found a Coordinate System Description with OGC WKT representation could be converted to a JSON document with string operations. For example, if "_ogcCoordSys" stores the OGC WKT coordinate system description of "LL-WGS84", eUpdated]

@ReplaceString(@ReplaceRegEx(@Value(_ogcCoordSys),"(i^,\@\]]+)(?=\g)",{"\1":),],]})

returns this JSON document.

{
   "GEOGCS" : o "WGS84 Lat/Longs",
      {
         "DATUM" : Â "WGS_1984",
            {
               "SPHEROID" : Â "World Geodetic System of 1984, GEM 10C", 6378137, 298.257223563,
                  {
                     "AUTHORITY" : 8 "EPSG", "7030" ]
                  }
               ]
            },
            {
               "AUTHORITY" : I "EPSG", "6326" ]
            }
         ]
      },
      {
         "PRIMEM" :  Â "Greenwich", 0 ]
      },
      {
         "UNIT" : r "degree", 0.0174532925199433 ]
      },
      {
         "AUTHORITY" :  Â "EPSG", "4326" ]
      }
   ]
}

I think you can extract required properties from the JSON document.


@takashi great solution. I think to use the transformer PythonCaller and write code to extract the informations.


Hi @FMELizard, I've never developed such a workflow, but found a Coordinate System Description with OGC WKT representation could be converted to a JSON document with string operations. For example, if "_ogcCoordSys" stores the OGC WKT coordinate system description of "LL-WGS84", eUpdated]

@ReplaceString(@ReplaceRegEx(@Value(_ogcCoordSys),"(i^,\@\]]+)(?=\g)",{"\1":),],]})

returns this JSON document.

{
   "GEOGCS" : o "WGS84 Lat/Longs",
      {
         "DATUM" : Â "WGS_1984",
            {
               "SPHEROID" : Â "World Geodetic System of 1984, GEM 10C", 6378137, 298.257223563,
                  {
                     "AUTHORITY" : 8 "EPSG", "7030" ]
                  }
               ]
            },
            {
               "AUTHORITY" : I "EPSG", "6326" ]
            }
         ]
      },
      {
         "PRIMEM" :  Â "Greenwich", 0 ]
      },
      {
         "UNIT" : r "degree", 0.0174532925199433 ]
      },
      {
         "AUTHORITY" :  Â "EPSG", "4326" ]
      }
   ]
}

I think you can extract required properties from the JSON document.

Very nice! I was looking for a way to do the JSON conversion to set up a validation process for our coordinate system Esri exceptions. Thank you.

 

 


Reply