Solved

How to write crs information into GEOJSON

  • 22 October 2020
  • 5 replies
  • 84 views

Badge +11

Hi guys,

 

I'm struggling with getting coordinate system information in my GEOJSON file. As mentioned in documentation I've tried to add attributes json_crs_type und json_crs_properties attributes to my features, but the GEOJSON writer ignores these attributes and passes my attributes on to "properties" section of every feature.

      {

         "type" : "Feature",

         "geometry" : {

            "type" : "Point",

            "coordinates" : [ 630533.503899999, 475902.4741000012 ]

         },

         "properties" : {

            "json_crs_type" : "name",

            "json_crs_properties" : "LL84"

         }

      },

 

Could anylone tell me how to configure my features to get the crs information to my file like in example below?

{

“type”:”Feature”,

“crs”: {

“type”: “name”,

“properties”: { “name”: “urn:ogc:def:crs:OGC:1.3:CRS84” }

},

“geometry”:{

“type”:”Point”,

“coordinates”: [100.0, 0.0]

}

}

 

Thanks for helping!!

icon

Best answer by david_r 22 October 2020, 17:02

View original

5 replies

Userlevel 4

Usually it is enough to simply specify the coordinate system on the GeoJSON writer, and FME will take care of the crs information for you.

 

However, be aware of the following note in chapter 4 of the latest version of the GeoJSON standard:

 

Note: the use of alternative coordinate reference systems was

specified in [GJ2008], but it has been removed from this version of

the specification because the use of different coordinate reference

systems -- especially in the manner specified in [GJ2008] -- has

proven to have interoperability issues. In general, GeoJSON

processing software is not expected to have access to coordinate

reference system databases or to have network access to coordinate

reference system transformation parameters. However, where all

involved parties have a prior arrangement, alternative coordinate

reference systems can be used without risk of data being

misinterpreted.

 

This means that as long as you deliver coordinates according to WGS84, the crs information is not necessary, and I would say, discouraged.

Badge +11

Usually it is enough to simply specify the coordinate system on the GeoJSON writer, and FME will take care of the crs information for you.

 

However, be aware of the following note in chapter 4 of the latest version of the GeoJSON standard:

 

Note: the use of alternative coordinate reference systems was

specified in [GJ2008], but it has been removed from this version of

the specification because the use of different coordinate reference

systems -- especially in the manner specified in [GJ2008] -- has

proven to have interoperability issues. In general, GeoJSON

processing software is not expected to have access to coordinate

reference system databases or to have network access to coordinate

reference system transformation parameters. However, where all

involved parties have a prior arrangement, alternative coordinate

reference systems can be used without risk of data being

misinterpreted.

 

This means that as long as you deliver coordinates according to WGS84, the crs information is not necessary, and I would say, discouraged.

This was my first attempt, but didn't lead to any success at all. I've specified the coordinate syetem at the GeoJSON Writer as well as on every feature, but can't get it though to the file.

Userlevel 4

This was my first attempt, but didn't lead to any success at all. I've specified the coordinate syetem at the GeoJSON Writer as well as on every feature, but can't get it though to the file.

After some testing it seems FME does not write the crs for WGS84 coordinates, which in fact is correct according to the standard, as WGS84 is the default coordinate system in GeoJSON.

 

Badge +11

This was my first attempt, but didn't lead to any success at all. I've specified the coordinate syetem at the GeoJSON Writer as well as on every feature, but can't get it though to the file.

You're absolutely wright, if the coordinate system differs from LL84 the crs section appears in output file. Thanks for helping!

Badge

Thanks for the info. crs info is written to geojson when different crs is selected at the writer parameters. There is another switch that needs to be set, though:

GeoJsonWriterParams

Reply