Question

How to properly construct GeoJSON from XML

  • 15 August 2021
  • 1 reply
  • 78 views

Hi there,

I'm struggling to build a proper GeoJSON file. Attached please find the source XML file which I'm trying to convert. These are all points and I would like to have the different fields as properties.

I tried to aggregate the separate "latitude" and "longitude" attributes into a single "Coordinates" attribute by means of the AttributeManager but that didn't do the job. My "Coordinates" are always read as a feature property and not as a feature geometry. GeoJSON has a specific format ( see https://geojson.org/ ) and I don't know how to construct it with FME.

 

Of course, I'm using the XML Reader (Parameter set to: modu/moduEntity) and GeoJSON Writer.

 

Any help would be much appreciated.

Thanks in advance already.


1 reply

Use the XML Reader and make sure to select every XML datafield under Parameters which are of interest for the final output. This will basically create a Reader for every data XML datafield. Then, use the VertexCreator to create a point out of the XML data. Feed x and y coodrinates with longitude and latitudes from the Reader inputs. Other inputs will become properties of the Point. The workbench should look this this then:

 

XMLtoGEOJSON

Reply