Skip to main content
1 of 6
Taras
  • 34k
  • 4
  • 73
  • 148

I would doubt that you can use a package if you do not have ArcGIS licence.

from arcgis.geocoding import reverse_geocode
from arcgis.geometry import Geometry

houses = []
houses.append((143.5689855, -38.328956999999996))
houses.append((143.5692555, -38.328993000000000))

lat_diff = houses[1][0] - houses[0][0]
lon_diff = houses[1][1] - houses[0][1]

i = 1
while i < 10:
    houses.append((houses[i][0] + lat_diff, houses[i][1] + lon_diff))
    i = i + 1

for x, y in houses:
    pt = Geometry({
        "x": float(x),
        "y": float(y),
        "spatialReference": {
            "wkid": 3857
        }
    })
    results = reverse_geocode(pt)

This code ends up with an error most likely because of the credentials that have to be specified gis = GIS("http://www.arcgis.com", "username", "password").

Traceback (most recent call last):
  File "D:/test.py", line 24, in <module>
    results = reverse_geocode(pt)
  File "C:\...\_functions.py", line 1054, in reverse_geocode
    geocoder = arcgis.env.active_gis._tools.geocoders[0]
AttributeError: 'NoneType' object has no attribute '_tools'
Taras
  • 34k
  • 4
  • 73
  • 148