Skip to main content

 

Hi, I am retrieving data through an API using an HTTP caller. The data consists of points and lines. My plan is to pull this data, perform some attribute mapping, and then POST it to a website. However, I'm having trouble extracting geometry after flattening the JSON data. I used a Geometry Replacer, but it fails every time I run it. The error message says:

INVALID_PARAMETER_GEOMETRY_SOURCE

I would appreciate any assistance with this!

That error usually means it’s not valid GeoJSON. Are you able to share an example of what is in the geometry_type attribute that you were putting into the geometry replacer?


Often when you read the response as GeoJSON the geometry is automatically read.

Hopefully this will also work in your case.


@nison My mistake. The geometry replacer was connected to the incorrect data. After fixing this, I could run it without any errors, but it still does not display the geometry. I have attached a screenshot of the attribute used in the geometry replacer. The attribute I used is "geometry."


@geomancer It is reading the geometry but not displaying it. I am not sure if I am doing anything incorrectly, as this is the first time I am handling data in JSON format.


Can you share some of the relevant data?


It is flattened to far (you have recursively flattened) . So avoid that (depending on your data) or use something like a jsonextractor or jsonfragmentor to get the correct level.

Your “geometry” attribute is incorrect and is one of the nested values inside the geojson geometry (the coordinates line):

 

The whole geojson geometry object is like this

    "geometry": {
"type": "Point",
"coordinates": e-104.99404, 39.75621]
}

@todd_davis I have used the JSON Fragmenter and am attaching the current transformer settings. I have also attached the screenshot of the geometry attribute column I received as output from the transformer. I am unsure why the geometry column doesn't match the format specified in your response.

 


Sorry, can’t tell a huge amount from the screenshots.

You have the building blocks, they are just in individual parts. Though I don’t really like it, you can just put in a AttributeCreator before the geometryreplacer and create a new field with the value:

"geometry": {"type": "@Value(geometry_type)",@Value(geometry)}

 

Then, just put the new attribute as the source for the geometryreplacer

 


@todd_davis That worked!! Thank you so much for all your help!


Reply