A standard installation of KNIME does not come with a built in Geocoder node but it’s very easy to either install one or make your own.
KNIME has a page dedicated to Geo Nodes (https://www.knime.com/book/geo-nodes) using the Palladian Community Nodes that supports both MapQuest and Google.
But if you want to roll your own using another geocoding service it’s very easy.
OpenCage Geocoding API
OpenCage is a well known Geocoding API that has very reasonable pricing allowing you to test the service for free and paid plans starting at €45 per month for 10,000 requests per day. First you should sign up to the service and get an API key for the free trial plan.
Using my OpenCage component you can create a simple workflow as shown below. This example shown how easy it is to feed addresses, geocode and then present the results on a map colour coded by location.
Opening the OpenCage component shows the details. Essentially it’s three configuration nodes used for the input, a GET Request to connect to the OpenCage API and parsing and cleaning of the return data.
Node Configuration
The node has a few configuration options:
- API Key provided by OpenCage
- Field that contains the address information to Geocode
- Rate limit option in requests per second (dependant on your plan)
Node Output
The node will output all input data plus:
- Latitude
- Longitude
- Confidence Score
- HTTP Status Code
- OpenStreetMap link
- Address returned by OpenCage
An example out put looks like the table below.
Address | Status | confidence | lat | lng | url | name |
---|---|---|---|---|---|---|
735 S Figueroa Street, Suite 150 Los Angeles, CA 90017 | 200 | 9 | 33.866183 | -118.2816171 | https://www.openstreetmap.org/?mlat=33.86618&mlon=-118.28162#map=17/33.86618/-118.28162 | South Figueroa Street, Los Angeles, CA 90248-4007, United States of America |
865 Avenue of the Americas New York, NY 10001 | 200 | 9 | 40.7478596 | -73.9894889 | https://www.openstreetmap.org/?mlat=40.74786&mlon=-73.98949#map=17/40.74786/-73.98949 | Nordstrom Rack, 865 6th Avenue, New York, NY 10001, United States of America |
224B Colonie Center Albany, NY 12205 | 200 | 9 | 42.7065888 | -73.8202512 | https://www.openstreetmap.org/?mlat=42.70659&mlon=-73.82025#map=16/42.70659/-73.82025 | Colonie Center, 224 Colonie Center, Colonie, NY 12205, United States of America |
555 12th Street Northwest, Front 1 Washington D.C. 20004 | 200 | 7 | 38.8969674 | -77.0272414 | https://www.openstreetmap.org/?mlat=38.89697&mlon=-77.02724#map=17/38.89697/-77.02724 | Crunch Fitness, 555 12th Street Northwest, Washington, DC 20004, United States of America |
Using the Latitude/Longitude to Coordinate (from Palladian), Colour Manager and Map Renderer (from Palladian) it’s easy to plot the co-ordinates on a map by colour and add labels.
Creating components like this is a great way to wrap a complex process into a simple to use and re-usable node.
Hi,
thank you for this helpful node.
I am new to knime and was happy to see that there is this connection to opencagedata existing.
But somehow I wont get any results. The node itself is executing properly, but I get back only a status 403 and nothing else.
Am I missing a general setting?
Hi,
This was my mistake as I accidentally hard coded the API key. I’ve updated the version on KNIME Hub so if you download and try again it should work.
/Bob