Skip to main content
Solved

How to extract Coordinate System description details into attributes

  • January 13, 2018
  • 3 replies
  • 64 views

fmelizard
Safer
Forum|alt.badge.img+21

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

takashi
Celebrity
  • 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", 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.


danilo_fme
Celebrity
Forum|alt.badge.img+52
  • Celebrity
  • 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+20
  • Safer
  • January 15, 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", 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.