Search for an address

Learn how to find an address or place using the ArcGIS World Geocoding Service.

The ArcGIS World Geocoding Service can find addresses and places, convert addresses to coordinates, and perform batch geocoding. The geocoding module contains the geocode() function for forward geocoding that can be used to search for single field addresses, multi-field addresses, points of interest etc. The reverse_geocode() function can be used to find addresses of coordinates.

Prerequisites

The ArcGIS API for Python tutorials use Jupyter Notebooks to execute Python code. If you are new to this environment, please see the guide to install the API and use notebooks locally.

Steps

Geocode place names and addresses

  1. Add the following code in a cell to import the ArcGIS API for Python.

    Use dark colors for code blocks
                                  
    Add line.Add line.Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    
  2. Log into ArcGIS Online as an anonymous user. Simple geocoding and reverse geocoding do not require credits, hence you need not log in using your credentials.

    Use dark colors for code blocks
                                  
    Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    gis = GIS()
    
    
  3. Geocode by query to locate the Hollywood sign. The geocode() function is versatile and accepts a number of relevant parameters. Refer to Finding points of interest to learn more.

    Use dark colors for code blocks
                                  
    Add line.Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    gis = GIS()
    
    geocode_result = geocode(address="Hollywood sign", as_featureset=True)
    geocode_result.features
    
    
  4. Display a map of Los Angeles to display the geocode result.

    Use dark colors for code blocks
                                  
    Add line.Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    gis = GIS()
    
    geocode_result = geocode(address="Hollywood sign", as_featureset=True)
    geocode_result.features
    
    m = gis.map("Los Angeles, CA", zoomlevel=11)
    m
    
    
  5. Draw the geocode result on the map. Since you specified the as_featureset=True optional parameter while geocoding, you received the result as a FeatureSet object instead of a dictionary. FeatureSet objects can be easily drawn on the map widget by passing them to the draw() method.

    Use dark colors for code blocks
                                  
    Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    gis = GIS()
    
    geocode_result = geocode(address="Hollywood sign", as_featureset=True)
    geocode_result.features
    
    m = gis.map("Los Angeles, CA", zoomlevel=11)
    m
    
    m.draw(geocode_result)
    
    
  6. Clear the map.

    Use dark colors for code blocks
                                  
    Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    gis = GIS()
    
    geocode_result = geocode(address="Hollywood sign", as_featureset=True)
    geocode_result.features
    
    m = gis.map("Los Angeles, CA", zoomlevel=11)
    m
    
    m.draw(geocode_result)
    
    m.clear_graphics()
    
    

    Try geocoding using the following addresses.

    • Single line address: 380 New York St, Redlands, CA
    • Administrative place name: New York City
    • Zipcode: 9254

Reverse geocode a coordinate

  1. Construct a Point geometry object for the following latitude and longitude: 34.13419,-118.29636. The coordinates specified here are in latitude, longitude which correspond to the spatial reference GCS_WGS_1984. For a complete list of supported IDs and their corresponding definition strings, see: spatial references.

    Use dark colors for code blocks
                                  
    Add line.Add line.Add line.Add line.Add line.Add line.Add line.Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    gis = GIS()
    
    geocode_result = geocode(address="Hollywood sign", as_featureset=True)
    geocode_result.features
    
    m = gis.map("Los Angeles, CA", zoomlevel=11)
    m
    
    m.draw(geocode_result)
    
    m.clear_graphics()
    
    location = {
      'Y': 34.13419,
      'X': -118.29636,
      'spatialReference':{
        'wkid': 4326
      }
    }
    unknown_pt = Point(location)
    
    
  2. Reverse geocode the Point to get the address.

    Use dark colors for code blocks
                                  
    Add line.Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    gis = GIS()
    
    geocode_result = geocode(address="Hollywood sign", as_featureset=True)
    geocode_result.features
    
    m = gis.map("Los Angeles, CA", zoomlevel=11)
    m
    
    m.draw(geocode_result)
    
    m.clear_graphics()
    
    location = {
      'Y': 34.13419,
      'X': -118.29636,
      'spatialReference':{
        'wkid': 4326
      }
    }
    unknown_pt = Point(location)
    
    address = reverse_geocode(location=unknown_pt)
    address
    
    
  3. Draw the address on the map.

    Use dark colors for code blocks
                                  
    Add line.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    
    from arcgis.gis import GIS
    from arcgis.geocoding import geocode, reverse_geocode
    from arcgis.geometry import Point
    
    gis = GIS()
    
    geocode_result = geocode(address="Hollywood sign", as_featureset=True)
    geocode_result.features
    
    m = gis.map("Los Angeles, CA", zoomlevel=11)
    m
    
    m.draw(geocode_result)
    
    m.clear_graphics()
    
    location = {
      'Y': 34.13419,
      'X': -118.29636,
      'spatialReference':{
        'wkid': 4326
      }
    }
    unknown_pt = Point(location)
    
    address = reverse_geocode(location=unknown_pt)
    address
    
    m.draw(address)

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.