List of U.S. county codes?

I’ve been using the API to extract some additional information for some 6000 records of an invasive plant across North America. Our project, for various reasons, has focused on county-level records. The API does, technically, include county info, in the place_ids variable. But this information is coded (e.g., Alachua Cty., FL is 2511) and mixed in with an often impressive number of scaled place codes (e.g., "place_ids": [1, 19, 339, 9853, 51894, 57106, 59613, 59649, 61551, 64422, 64423, 66741, 81418, 81775, 82256, 82257, 90754, 96685, 97394, 127683, 127684, 145691, 157671, 201280],).

By any chance is there available somewhere accessible a list of U.S. counties with their corresponding iNaturalist code? Or at the least, are U.S. county codes bounded within a specific range? Any insights would be greatly appreciated!

1 Like

You can find all the place codes in

You should get all the US county-level places by filtering for admin_level 20 and ancestry starting with 97394/1/, but you might want to double check that.


Not sure if this helps, but you can get the county name for an observation using something like this (untested sloppy and probably outdated jQuery code):

var placeList = observation.place_ids.toString();
var iNatApi = '' + placeList;
var params = { 'admin_level': '20' };
$.getJSON( iNatApi, params )
	.done( function( data ) {
		if ( data.results[0] !== undefined && data.results[0].name !== undefined ) {
			return data.results[0].name;
		} else {
			return null;
	} );

1 Like

If my code above is confusing, you basically want to convert your example data into an API query like:,19,339,9853,51894,57106,59613,59649,61551,64422,64423,66741,81418,81775,82256,82257,90754,96685,97394,127683,127684,145691,157671,201280?admin_level=20
and then retrieve results[0].name from the JSON that is returned. The admin_level=20 filter will give you just the county, as jwidness mentions above.

1 Like

a thing that i mentioned in another recent thread by awharvey provides an example of how to do this in Python. see:

1 Like

Excellent, that’s just what I needed. Thanks!