Solved

How to extract Coordinate System description details into attributes

  • 13 January 2018
  • 3 replies
  • 6 views

Userlevel 4
Badge +13

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.
icon

Best answer by takashi 13 January 2018, 07:43

View original

3 replies

Userlevel 2
Badge +17

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", [Updated]

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

returns this JSON document.

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

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

Userlevel 4
Badge +30

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

Userlevel 2
Badge +17

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", [Updated]

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

returns this JSON document.

{
   "GEOGCS" : [ "WGS84 Lat/Longs",
      {
         "DATUM" : [ "WGS_1984",
            {
               "SPHEROID" : [ "World Geodetic System of 1984, GEM 10C", 6378137, 298.257223563,
                  {
                     "AUTHORITY" : [ "EPSG", "7030" ]
                  }
               ]
            },
            {
               "AUTHORITY" : [ "EPSG", "6326" ]
            }
         ]
      },
      {
         "PRIMEM" : [ "Greenwich", 0 ]
      },
      {
         "UNIT" : [ "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