Logo preload
close Logo

Learn How to Geocode CSV Files Using Node.js Packages

October 28, 2015

In order to view your data on the map on the Fulcrum mobile apps or on the web, you’ll need to have some spatial component to it. To do this you can import a shapefile or a CSV file with latitude and longitude columns.

Many of Fulcrum’s customers start with quality GIS data files they’ve collected and curated for years. But others start with little more than some addresses entered in a spreadsheet. If your CSV file doesn’t contain latitude and longitude columns you can create these by geocoding an address column.

360 Central Ave, St. Petersburg, FL -> 27.7707997 N, 82.6402813 W

Geocoding can be a complex process, especially to those unfamiliar with GIS software. Fortunately there are some helpful applications and packages that can help you learn this process. One that we’ll focus on here is a node module, csvgeocode.

Data Sources

csvgeocode is flexible enough to be used with a number of common geocoding services like Google Maps and Mapbox. You’ll want to pay close attention to the terms of use for these geocoding services. Most of them prohibit displaying geocoded data on any other mapping platform than their own.

Here we’ll focus on using csvgeocode’s newest provider, Mapzen Search. Mapzen’s geocoding service has a much more relaxed set of terms that allows you to more easily display geocoded data in your own mapping application. This is due to their usage of OpenAddresses, a global set of free and open address data.


csvgeocode is a node command-line tool installed with npm. If you don’t have node installed you can find that on the Node.js website. Installing node will add the node command you’ll use to run this tool, as well as the npm command used to install it.

Once you’ve installed node use the following command to install csvgeocode:

npm install -g csvgeocode

Now you’ll have access to the csvgeocode executable. Use the following command to ensure you’ve got in installed properly:

csvgeocode –help

Geocoding Your CSV

Below is an example of a CSV with various attributes, including an address column.

To geocode the address column in this example, we’ll use a command like the one below. The > geocoded.csv indicates that we’ll save the output of the geocode, with “lat” and “lng” columns, to a new file.

csvgeocode sites.csv –url ‘https://search.mapzen.com/v1/search?api_key=your_api_key&text={{address}}’ –handler mapzen > geocoded.csv

Note: Be sure to replace “your_api_key” with an actual API key you received from Mapzen.

If all goes well you’ll have a new file, geocoded.csv, with “lat” and “lng” columns.

This CSV can now be easily imported into Fulcrum for your use in the field.