Python Geocoder using State of Delaware FirstMap Locator

Updated for FirstMap 2.0, as of February 2022

I created a Python script which uses the State of Delaware FirstMap/ArcGIS Composite Locator tool. This Python script can be used outside of ArcGIS, using a CSV file and an installation of Python. Because of the nature of this geocoder, it can only be used on Delaware addresses, and possibly some addresses near the border in Maryland, New Jersey, and Pennsylvania.

This project was done in an attempt to reduce my dependence on ESRI's ArcGIS software. In my job at the Office of Highway Safety, I used to use the state's geocoder sometimes, but it only worked directly in ArcGIS, which bothered me since I have a strong preference for QGIS. After writing a few Python scripts for QGIS in that job, I decided to write this program to try to remove any dependence on ArcGIS.

This geocoder requires Python and will require the installation of the pandas library, if you don't have it installed already.

You can download the geocoder here.

Documentation for the Geocoder

Note: If you are attempting to use this geocoder through a proxy (e.g. on a work/school network), you will need to tell the geocoder where the proxy is so it can run the requests through that. Another thing to know with proxies is that installing pandas through a proxy can be a bit cumbersome, but it is doable.

Using your favorite Python script runner, execute the geocoding script, which will open a console for the geocoder to run. Type in the filename of the CSV file (following the format of this sample file), with quotes on both sides. When you're ready, press Enter.

Note: You need to have the columns "StreetAddress", "City", "State", "Zip", "GeocodeLat", "GeocodeLon", and "GeocodeScore" in your CSV file before you place it into the geocoder.

Assuming the geocoder works correctly and there isn't anything peculiar going on with your data, you will be asked to provide a filename for your geocoded coordinates. You need to provide this perfectly, or else you will have to run the geocoder again. Also, be sure to wrap it in quotes, just like you did with the input file.

Now you can open your new CSV file in a spreadsheet program or GIS package and see your results.

Some Anamolies and Technical Details

As mentioned, this geocoder does not work with out of state addresses, unless they are very, very close to Delaware (possibly within 2-5 miles). This may cause the geocoder to spit out a bunch of errors. Do not be worried about these, as it should skip them and move on to the next address.

The geocoder is designed specifically to use the first address suggested by the ArcGIS locator tool. This was done to reduce user input, as the user could have thousands of addresses that they are trying to geocode. I included the "score" field, generated by ArcGIS, to show how confident the locator tool is in determining an address's coordinates.

I originally developed this script using the Google Maps API geocoding tool, but realized a few months later that I could probably tap into the State of Delaware locator tool using Python and JSON. As a result, there's still a quirk where it requires a complete address. If the address is missing either the street address, city, state, or zip, it will be skipped. This is noted in the console output of the script.

For compatibility and diagnostic purposes, I chose to use the NAD 1983 coordinate reference system with this geocoder. I believe that, by default, the state geocoder uses the WGS84 Pseudo-Mercator CRS.

If you encounter further issues when using this geocoder, please email me.