Skip to main content
Solved

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


Forum|alt.badge.img

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}

 

 

Best answer by redgeographics

charu wrote:

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.

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

4 replies

redgeographics
Celebrity
Forum|alt.badge.img+49

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.


Forum|alt.badge.img
  • Author
  • March 10, 2022
redgeographics wrote:

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?


redgeographics
Celebrity
Forum|alt.badge.img+49
  • Celebrity
  • Best Answer
  • March 10, 2022
charu wrote:

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.


Forum|alt.badge.img
  • Author
  • March 11, 2022

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


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