ArcGIS Developers
Dashboard

ArcGIS API for Python

Part 3 - Finding Point of Interests

In addition to geocoding addresses, the geocoding service can also be used to find points of interest (POI) of several different kinds. In Part 3, we will explain briefly about category parameter of geocode() function and its applications.

Getting started

First, Let's look at some Quickstart examples, which show how the category attributes change based on the search string.

Search for administrative place names

The geocode() method supports single field and multi-field searches for administrative place names. This includes searches for neighborhoods, cities, counties, states, provinces, or countries. If a search for a city name results in multiple matches with the same name, the World Geocoding Service will sort the candidates in order of their relative importance to each other (as indicated by the value of the Rank output field), with priority generally based on population and capital status.

For example, there are many cities in the world named Liverpool, so a search for "Liverpool" results in several equivalent matches; Liverpool, UK will always be the top candidate since it has the greatest population.

In [1]:
from arcgis.geocoding import geocode
from arcgis.gis import GIS
In [2]:
gis = GIS("portal url", "username", "password")
In [7]:
address = "Liverpool"
In [11]:
map1 = gis.map("United Kingdom", 6)
map1
In [9]:
liverpool = geocode(address)[0]
In [10]:
map1.draw(liverpool['location'])

However, rank alone is not always enough to distinguish between administrative places. Also, you may not necessarily want to find the highest-ranked feature for a particular search. It may be necessary to remove ambiguity by refining searches with additional information. For example, a search for Liverpool returns Liverpool, UK as the top candidate based on rank. If you instead want to find the town of Liverpool, New York, it is necessary to add the state information to the search.

In [15]:
address = {
    "Address" : "Liverpool",
    "Region" : "NY"
}
In [22]:
map2 = gis.map("Onondaga County, New York, United States")
map2