When I start a project with a new client, I request the locations of their facilities and, if applicable, their customers. Usually, the data I receive includes street address, ZIP code, and latitude and longitude. 

Unfortunately, the latitude & longitude are not always correct.  I take a “trust but verify” approach, mapping the locations using provided lat/long, and making a visual judgment.  (e.g., Antarctica is unlikely, as is Eastern Europe or central Asia for US-centric companies – all issues I’ve found with provided geocodes.  And don’t forget Null Island, at lat 0 / long 0.)

The trouble with the visual approach is that it is also quite error-prone; a location may be incorrectly geocoded but not immediately obvious.  For example, if your business has a lot of customers in Ohio, a pin that’s in northern Ohio but should be in southern Ohio, does not throw up red flags.  Even worse, if your business has a lot of customers throughout the Midwestern United States, a Minnesota address may have a Michigan pin – quite a distance away, yet also not immediately obvious.  These mistakes can be particularly troublesome if they involve higher-volume customers or facilities.

To help reduce some of this error, and speed up data validation, I have created a tool that takes as its input latitude and longitude, and returns the U.S. state or territory it is in, and what ZIP Code it is in (actually, ZIP Code Tabulation Area – ZCTA – similar to, but not exactly the same as, the ZIP code). If the lat/long is not in the U.S., or the tool cannot find the results in a short time, the tool returns “unknown”.

The tool is available as both a Shiny app and an API.  My hope is that the supply chain analyst community can use this tool to quickly validate geocoded latitude & longitude, comparing the lat/long’s state and ZCTA to the state and ZIP in a dataset, and flagging obvious problems for further investigation.

For a week or two, I’m opening the Shiny app and API for free, for initial use and feedback. After that, I will require a small usage fee, but for now my only request is your feedback!

How to use them:

Shiny app:  geovalidate.supplychainapps.io  (redirects to datadrivensupplychain.shinyapps.io/geovalidate)

Instructions are in the app.  You can either upload a CSV, or directly copy/paste your latitude & longitude into a table. You can download results to CSV.

—–
API endpoints (GET).  Replace (latitude 42, longitude -93) with your coordinates in the API call.

State (returns postal code abbreviation):   http://144.126.210.26/geovalidate/state?lat=42&lng=-93
ZCTA: http://144.126.210.26/geovalidate/zcta?lat=42&lng=-93

——
Thanks and hope this helps!  Please provide your feedback either in the comments or email ralph@datadrivensupplychain.com