Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Handling polygon GeoJSON files in Alteryx

Highlighted
Alteryx Certified Partner

Hi,

 

I've just started working with GeoJSON files, and I've been finding it very inconvenient to handle on Alteryx. I've gone through the following articles, but the general advice seems to be "just import it as a JSON and parse it", which isn't helpful if you're dealing with polygons rather than points.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Downloading-and-working-with-GeoJSON/m...

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Using-geojson-with-Input-Tool/m-p/4389...

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Alteryx-and-geojson/td-p/39265

https://community.alteryx.com/t5/Engine-Works-Blog/Alteryx-Spatial-Data-Output-GeoJSON/ba-p/2221

 

Can I know if there's anything currently in Alteryx or in the development pipeline to make this process easier? For example, the sf package in R reads in the GeoJSON file into a dataframe format with the spatial attributes in a geometry column (basically parsing it automatically for you). Something similar could be implemented in Alteryx. Until then, I will have to stick to R for any spatial analytics work involving polygons.

 

Thanks!

Alteryx
Alteryx

Hello @shaunkhoo  

 

One thing that will probably help is that the format for Alteryx Spatial Objects is a GeoJSON. So, if you have a properly formatted GeoJSON string, you can use the Select tool to convert it to Spatial Object, and it should convert it for you without any significant parsing.

Regards,
Stephen Ruhl
Customer Support Engineer

Highlighted
Alteryx Certified Partner

Hi @StephenR, thanks for your reply! How should I import the GeoJSON file into Alteryx? I've used the JSON format in the Input Tool and used the Select tool to convert the JSON values to a SpatialObj but it still doesn't work.

Highlighted
Alteryx
Alteryx

@shaunkhoo, would you be able to share a sample JSON?

Regards,
Stephen Ruhl
Customer Support Engineer

Highlighted
Alteryx Certified Partner

Thanks for your help @StephenR! I've attached a GeoJSON file which I downloaded from https://github.com/OpenDataDE/State-zip-code-GeoJSON. I've verified that it works by importing it into R.

Highlighted
Alteryx Certified Partner

Hi @StephenR, did you manage to find a solution to importing the GeoJSON file into Alteryx?

Highlighted
Alteryx Certified Partner

Hi @StephenR, any luck in figuring out a workaround to handle polygon GeoJSON files in Alteryx? It would be a huge benefit for me if it's possible, so I appreciate your help on this!

Highlighted
Alteryx
Alteryx

Hello @shaunkhoo,

 

Those files killed Notepad and Notepad++ so, I feel like there is something there that is causing problems for Alteryx too. I did notice that they are from 2016 which makes them pretty old files. If you need Zip code boundaries, I'd suggest getting the latest from the US Census in shapefile or geodatabase.

 

Shapefile

 

Geodatabase

Regards,
Stephen Ruhl
Customer Support Engineer

Highlighted
Meteoroid

Shaunkhoo,

 

I've been searching for a solution to parsing GeoJson files extensively didn't come up with a native Alterix solution. I agree with you, it seems a tool would be appropriate to parse such files to spatial polygon clusters.  As an alternative I created this workflow that parses the Geo.Json file of US Counties (courtesy Eric Celeste), and uses Regex tool to extract and reassemble feature elements to a table.  It's not a native tool, but at least its not bootstrapping R.  Pretty simple actually.

Highlighted
Alteryx
Alteryx

@shaunkhoo @StephenR @johnfischbeck 

 

I took a shot at this and was able to get it working.

 

Not my most elegant solution, but basically I read the file in as a '}' delimited csv file, transposed the whole thing (as this created a huge amount of records), did some basic data prep and used a select tool to set the field type as a SpatialObject.

Labels