Hello,
I'm trying to see if there is a way in Alteryx to convert a ArcGIS ESRI JSON REST API response to an Alteryx SpatialObj data type so we can see the shape like points or polygons. I'm able to download the response however not sure how to parse this and convert the geometries into polygons. Attached a workflow with sample JSON response that I'm trying to convert to a spatial object within Alteryx. Or is the only way to use GDAL/org2ogr tools with Run Command tool to pass the response to a GeoJSON and then parse it? Any insights are appreciated.
Thank you in advance!
-VS
Solved! Go to Solution.
As you're probably aware, under the hood an Alteryx 'SpatialObject' is just GeoJson.
Esri supports GeoJson format for their API - https://doc.arcgis.com/en/arcgis-online/reference/geojson.htm
I would just change your API call to receive the data in geojson and then go from there. You may need to do a small amount of pruning/parsing the GeoJson response from their API but after that it's just a matter of using a select tool to change the data type from a string to SpatialObject.
Thank you Travis. Yes, that was my first thought to change the output format to geojson, however, in the current implementation of this REST API call that output method is not supported unfortunately and I'm only able to get Esri JSON response. My apologies, I should have mentioned this before.
Thank you very much Travis, this is very helpful. I should've added more objectId's in the query originally. I think you workflow is working but when I add another objectId to the API query call it's not able to parse the lat/lons individually since the grouping needs to be done by objectId's since now there are multiple polygons in response. I really appreciate your help. I've attached the workflow with another two objectId's in it for reference.
Awesome, thank you so much Travis for your help and time on this. I will look into this workflow to see if I can group by Object ID instead of the feature Id since if this could be grouped by object ID then I can join other attributes from GIS based on object ID.
Hi Travis,
I got this working for some of my arcgis services but I came across an issue when I'm getting values from a date field. It seems that it gets converted to text. I don't understand what the format is or if I can convert it back or not. For example, i have a create_date field on a point feature that should be 2/15/2019 7:09:46 PM but it is coming in to my workflow as this value: 1550257992631. It actually should be 3:09 pm but must be converting it to Greenwich time on the server...no biggie I can convert time zones, but I'm not sure what the long numeric value is indicating.
Have you experienced this conversion?
Thanks,
Jon
@jdross That looks like your api is returning epoch time to me. I suggest you check out this community thread.
This worked
DateTimeAdd('1970-01-01',[date_field]/1000, 'Seconds')
Thank you!
User | Count |
---|---|
19 | |
14 | |
13 | |
9 | |
8 |