The DOTS Address Geocode – International web service makes use of US Census data to help geocode US addresses. This is not uncommon for many geocoding solutions, but what often gets left by the wayside is the census data associated with the geocoded location. The US Census Bureau is tasked with collecting census data every 10 years, and the data they collect can be quite vast and varied. Piecing the various sets of data together can be quite the challenge, and not all datasets can necessarily be linked.
As a result of this, it is not uncommon for many geocoding solutions to forego bits of census data that do not have anything to do with geocoding addresses and places. On the other hand, the service – like its companion, the Address Geocode – US web service – is capable of returning US census data. In this article, we’ll discuss how.
The PlaceSearch web method in the web service is primarily designed to geocode international addresses or places, and its input parameters reflect that. International addresses have various formats that can be difficult to parse and handle, but the PlaceSearch operation has you covered. When it comes to obtaining census data from the web method there are two input parameter values to choose from.
- Census – Instructs the PlaceSearch operation in the service to return US census data for the given US address. Data will only be returned where available and when the location precision level is 14 (interpolated address) or higher.
- CensusLoose – Instructs the PlaceSearch operation in the service to return US census data for the given US address. Data will be returned for all location precision levels.
The optional input values above are accepted by the ‘Extras’ input parameter, which accepts a comma-delimited list of optional values that can be used to instruct the PlaceSearch operation to return additional values and/or behave a certain way.
The following template is an example of an HTTP GET request with all of the input parameters. Notice that the Extras parameter is in bold.
HTTP GET Url Example Template:
https://trial.serviceobjects.com/AGI/api.svc/json/PlaceSearch?SingleLine={SINGLELINE}&Address1={ADDRESS1}&Address2={ADDRESS2}&Address3={ADDRESS3}&Address4={ADDRESS4}&Address5={ADDRESS5}&Locality={LOCALITY}&AdministrativeArea={ADMINISTRATIVEAREA}&PostalCode={POSTALCODE}&Country={COUNTRY}&Boundaries={BOUNDARIES}&MaxResults={MAXRESULTS}&SearchType={SEARCHTYPE}&Extras={EXTRAS}&LicenseKey={LICENSEKEY}
Below is an example of an HTTP GET call to the web service using the ‘Census’ value for a US address.
Request:
https://trial.serviceobjects.com/agi/api.svc/json/PlaceSearch?Address1=136+West+Canon+Perdido+St&Locality=Santa+Barbara&AdministrativeArea=CA&PostalCode=93101&Country=USA&SearchType=&Extras=census&LicenseKey={LICENSEKEY}
Response:
{"SearchInfo":{"Status":"OK","NumberOfLocations":1},"Locations":[{"PrecisionLevel":14,"Type":"InterpolatedAddress","Latitude":"34.419061","Longitude":"-119.702139","AddressComponents":{"PremiseNumber":"136","Thoroughfare":"W Canon Perdido St","Locality":"Santa Barbara","AdministrativeArea1Abbreviation":"CA","PostalCode":"93101-3242","Country":"United States","CountryISO2":"US","CountryISO3":"USA","PlaceName":"Santa Barbara","StateFIPS":"06","CountyFIPS":"083","CensusTract":"0010.01","CensusBlock":"2007","CensusGeoID":"060830010012007","ClassFP":"C1","CongressCode":"24","SLDUST":"019","SLDLST":"037","TimeZone_UTC":"-08:00"}}] }
The address in the above example was able to be geocoded to a precision level of 14 (interpolated address), which is the minimum precision level allowed by the service to return census data using the ‘Census’ input value. In the below example we have an address that does not meet the minimum precision level requirement, where you will see that census data such as Census Tract and Block are not returned.
Request:
https://trial.serviceobjects.com/agi/api.svc/json/PlaceSearch? Locality=Santa+Barbara&AdministrativeArea=CA&PostalCode=93101&Country=USA&SearchType=&Extras=census&LicenseKey={LICENSEKEY}
Response:
{"SearchInfo":{"Status":"OK","NumberOfLocations":1,"Notes":"4","NotesDesc":"ThoroughfareMissing"},"Locations":[{"PrecisionLevel":8,"Type":"PostalCode","Latitude":"34.418979","Longitude":"-119.709166","AddressComponents":{"Locality":"Santa Barbara","AdministrativeArea2":"Santa Barbara County","AdministrativeArea1":"California","AdministrativeArea1Abbreviation":"CA","PostalCode":"93101","Country":"United States","CountryISO2":"US","CountryISO3":"USA","PlaceName":"Santa Barbara","StateFIPS":"06","CountyFIPS":"083","ClassFP":"C1","TimeZone_UTC":"-08.00"}}] }
Notice that the precision level for the example above is 8 (PostalCode), which is below the minimum required value of 14 for the service to return Census data such as the tract and block. The Census tract and block are among the smallest geographic divisions/units used by the US Census Bureau. This means that they are considered to be of relatively high precision level. A census block can contain one or more households.
When it comes to geocoding, the value corresponds best with an address level match, whether it be a precise rooftop level match or an interpolated address match. This is because the address range for the households on a block will all share the same census block code. If the precision level of the geocoded match is too low, such as a city or postal code, then the match is considered too large an area and too vague to accurately return a single census block and tract.
Using the ‘Census’ input value is the recommended value to use in most general cases, since it reduces the chance of confusion where a user may think that something like a Locality or PostalCode level match could return a single census block or tract. It is important to keep in mind that the coordinate points returned by the service are representative of an area at large, whether it be a building, neighborhood, postal code (ZIP), locality (city) or administrative area (state). A coordinate point is not a boundary. To return a single census block or tract for a coordinate representing a large area such as a locality would be inaccurate in most cases. Instead, it would be more accurate to return a list of census blocks for a locality, but even that isn’t without its downsides and complications.
Overall, it is our recommendation that a user stick with the ‘Census’ input value to meet most use cases. However, there are certain cases where a user may insist on having census data returned regardless of the geocoded match-level. This is not recommended for the reasons already explained above. If the user understands that the output values are representative of the exact GPS coordinates returned by service and not of the location match itself, then they could find a use case to have the census data returned for matches of precision level lower than 14.
Here is an example of the same query shown previously. Except that this time we will use ‘CensusLoose’ instead of ‘Census’ in order to instruct the service to return census data for lower precision levels.
Request:
https://trial.serviceobjects.com/agi/api.svc/json/PlaceSearch? Locality=Santa+Barbara&AdministrativeArea=CA&PostalCode=93101&Country=USA&SearchType=&Extras=census_loose&LicenseKey={LICENSEKEY}
Response:
{"SearchInfo":{"Status":"OK","NumberOfLocations":1,"Notes":"4","NotesDesc":"ThoroughfareMissing"},"Locations":[{"PrecisionLevel":8,"Type":"PostalCode","Latitude":"34.418979","Longitude":"-119.709166","AddressComponents":{"Locality":"Santa Barbara","AdministrativeArea2":"Santa Barbara County","AdministrativeArea1":"California","AdministrativeArea1Abbreviation":"CA","PostalCode":"93101","Country":"United States","CountryISO2":"US","CountryISO3":"USA","PlaceName":"Santa Barbara","StateFIPS":"06","CountyFIPS":"083","CensusTract":"0010.02","CensusBlock":"3003","CensusGeoID":"060830010023003","ClassFP":"C1","SLDUST":"019","SLDLST":"037","TimeZone_UTC":"-08.00"}}] }
Notice that this time the service did return values for the census tract and block. Again, this is acceptable if the user does not misinterpret the census tract and block values to be representative of location match as a whole – in this case, for example, the census block of 3003 is not entirely representative of the city of Santa Barbara. It is accurate to say that the city of Santa Barbara contains the census block 3003 somewhere within its city limits, but it is not accurate to say that 3003 is the census block of Santa Barbara. Instead, it would be more precise to say that 3003 is the census block associated with GPS coordinates { 34.419061, -119.702139 }.
Keep in mind that US Census data is not available for all locations. For example, if the value CensusLoose is used and a coordinate point is returned that represents a geographic centroid or approximation for a large area, and the precise coordinates returned lie within a body of water or some geographic area outside the scope of the Census data, then no values will be returned. So, don’t expect to get a census block value back if the coordinates point to a vacant area such as a forest, desert, or lake.
Also, remember that the service allows for multiple ways to search for a place. If you are using CensusLoose and are unable to get the results desired, then you can try specifying a SearchType value for a different precision level that could yield alternative results. If your search for an address yields a low precision Locality or PostalCode level match, then try editing your search string to exclude the address and concentrate on either the street, neighborhood, or ZIP+4. Again, when using CensusLoose, the census data values are representative of the exact coordinates.
In closing, if you desire US Census data, please choose the census option that best fits your needs and please geocode responsibly. Cheers!