Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
LindaT
Alteryx
Alteryx

One of the latest additions to Alteryx, available in an upcoming beta release, is the ability to express spatial objects as variable length strings. This is done using GeoJSON, a geospatial data format based on JavaScript Object Notation (JSON). Alteryx will support the following GeoJSON geometry types: Point, LineString, Polygon, MultiLineString and MultiPolygons. The GeoJSON format specification can be found at http://geojson.org/geojson-spec.html.

 

A couple of examples of GeoJSON:

 

A point:

{ "type": "Point", "coordinates": [100.0, 0.0] }

A Line:

{ "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }

 

A polygon with no holes:

{ "type": "Polygon", "coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]
] }

 

A polygon with holes:

{ "type": "Polygon", "coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ],
[ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ]
] }

 

There are several ways to access the GeoJSON functionality. You can type in the GeoJSON directly, from a file, from a data file, or a relational database with previously stored GeoJSON

 

From an Input tool:

gjsn:{ "type": "Point", "coordinates": [ -105.358162, 40.092715 ] }

gjsn:"c:\temp\jsonpoint.txt"

 

To output GeoJSON use a select tool and change the datatype from SpatialObj to V_String. Make sure your output type supports the very long strings that GeoJSON can create.

 

The AutoFieldStrings will detect that a GeoJSON string is a Spatial Object. You should also be able to use the cut and paste into a TextInput tool. You can use the

 

Browse tool to see the GeoJSON in the table view or use the Map tab to see the actual spatial object.

 

This will give you a way to transport your spatial objects as text should the need arise.

 

Look for the next Beta release of Alteryx to use this new feature!

Comments