Public Lab Research note

Adventures in Geocoding: Getting lat/lng data for EWG's PFA pollution map

by ephemeralwaves | March 09, 2019 02:13 09 Mar 02:13 | #18499 | #18499

To add a layer to the leaflet-environmental-layers I figured I needed the latitude and longitude of the sites of contamination.

The first issue I had was that the data was write protected, meaning I could not modify it and hence use their google sheet to put in the latitude and longitude, so I made a copy of their data on my own account.

To get this I looked up 'geocode' and came across a whole slew of proprietary and pay for services to accomplish this goal. Since the data was in a google excel like sheet I did find a script to convert the location into lat/lng. The problem was that the location column had county or city and state data which isn't the most precise piece of data I had for figuring out lat/lng. The first column in the data is the common name for the contamination site. I decided this alongside the location column was probably what I should use to figure out the lat/lng.

I found the csvgeocode npm module helpful in extracting the data. One note though is you do need an google API key and have to enable geocoding on it for the tool to work. It can be used as a simple command line tool to take in the csv file and output it to another csv file.


I also looked through the EWG source code and found a couple geojson files which can be used. One is the same PFAS data that needs to be geocoded, so I 've already done that above (PFAS geojson file)


Login to comment.