Skip to main content
Solved

How to write crs information into GEOJSON

  • October 22, 2020
  • 5 replies
  • 412 views

whkarto
Contributor
Forum|alt.badge.img+14

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!!

Best answer by david_r

whkarto wrote:

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.

 

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

5 replies

david_r
Evangelist
  • October 22, 2020

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.


whkarto
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • October 22, 2020
david_r wrote:

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.


david_r
Evangelist
  • Best Answer
  • October 22, 2020
whkarto wrote:

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.

 


whkarto
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • October 23, 2020
whkarto wrote:

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!


r_huesken
Contributor
Forum|alt.badge.img+5
  • Contributor
  • June 2, 2021

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


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