Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Converting What3Words address to Polygon

drewed206
7 - Meteor

Decided to do some nerding out with spatial today.

 

For those of you that have not heard of What3Words (https://what3words.com/) it is a company that has plotted the entire earth using a basic 3 word coordinate system (for instance New York City Hall is at address "clip.apples.leap"). Its really cool because it allows you to make really simple addresses for really obscure places (also helpful for search and rescue operations - its alot easier for a lost child to give 3 words instead of GPS coordinates).

 

Anyway, today I wanted to test out my new found skills in Alteryx (thanks Inspire 2023!) by first using the python tool and the what3words python wrapper (https://github.com/what3words/w3w-python-wrapper) to convert each of the 3 word coordinates I had in my excel file to coordinates. After some trial and error here is the code I came up with and put into the python tool:

 

 

from ayx import Package

from ayx import Alteryx
Alteryx.installPackage(package="what3words")

df = Alteryx.read("#1")

import what3words
from os import environ
api_key = 'YOURAPIKEY'
w3w = what3words.Geocoder(api_key)
df['Output'] = df['Coordinates'].map(w3w.convert_to_coordinates)
print(df)
Alteryx.write(df,1)

 

 

 

The output column had alot of data (just because of how the python wrapper works... its not pandas friendly) so I did a text to columns with 12 columns and the delimiters:

 

{:,}

 

 

then select tool to get columns 9 and 11 (renamed to long and lat) and from there it was easy to build point and create a polygon!

 

It was a cool little project for a Saturday morning, and I ended up with a neat polygon of Kentucky's Red River Gorge! Any ideas for taking this further or a new project?

 

What3Word_Plot.JPG

1 REPLY 1
Qiu
20 - Arcturus
20 - Arcturus

@drewed206 
Really to good to know that there is "What3Words". It is amazing.

It will be more amazing if there will no python involved. 😁

Labels