Solved

Is there a way to pass geojson simply as string parameter in the Rest API and not as file or URL?

  • 9 March 2022
  • 4 replies
  • 19 views

Badge

I am developing a leaflet-based web app. I would like to pass the geojson drawn by a user in leaflet through the FME rest API to my workspace in FME server. The workspace contains a geojson reader, topologycalculator and geojson writer. But so far, the geojson reader accepts only a file or URL. Is it possible to send it along with URL as a parameter without the need to create a file. Something like

URL Example :http://desktop-f25rpfv:8080/fmerest/v3/transformations/submit/GeneralizationPredict/networkcalculator.fmw?data = {geojson object}

 

 

icon

Best answer by redgeographics 10 March 2022, 14:08

View original

4 replies

Userlevel 5
Badge +25

You can create a user parameter for your workspace, fill that with the GeoJSON string and then use a GeometryReplacer to build geometry, using that parameter as source.

Badge

You can create a user parameter for your workspace, fill that with the GeoJSON string and then use a GeometryReplacer to build geometry, using that parameter as source.

Thank you. I am totally new to FME and after struggling for a day, I still could not figure out how to use the geometry placer in FME Workbench. Attached is a very simple workspace where I am creating user parameter called data. I give it as a source to GeometryReplacer and try to write the output. But I am not getting any result out of the geometry replacer. Could you please let me know what I am doing wrong?

Userlevel 5
Badge +25

Thank you. I am totally new to FME and after struggling for a day, I still could not figure out how to use the geometry placer in FME Workbench. Attached is a very simple workspace where I am creating user parameter called data. I give it as a source to GeometryReplacer and try to write the output. But I am not getting any result out of the geometry replacer. Could you please let me know what I am doing wrong?

This turned out to be a little bit more complex than I thought, as the json contains more than just geometry.

 

Screenshot 2022-03-10 at 14.03.43You'll need to use a Creator to kick things off, then an AttributeCreator to store the parameter value in an attribute. Then a JSONFragmenter and JSONFlattener to tear the JSON apart and a GeometryReplacer to build geometry.

Badge

Worked like a charm!! Thank you very much for the help and effort.

Reply