Skip to main content
Solved

How to extract Coordinate System description details into attributes


fmelizard
Contributor
Forum|alt.badge.img+17

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.

Best answer by takashi

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"6378137298.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.

View original
Did this help you find an answer to your question?

3 replies

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • Best Answer
  • January 13, 2018

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"6378137298.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.


danilo_fme
Evangelist
Forum|alt.badge.img+41
  • Evangelist
  • January 13, 2018

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


daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • January 15, 2018
takashi wrote:

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"6378137298.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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings