I would doubt that you can use ArcGIS libraries without a licence.
from arcgis.geocoding import reverse_geocode
from arcgis.geometry import Geometry
from arcgis.gis import GIS
gis = GIS("http://www.arcgis.com", "***", "***")
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": 4326
}
})
try:
results = reverse_geocode(pt)
print(results)
except:
pass
So, I ended up with such result
{'address': {'Match_addr': '45 Stodart St, Colac, Victoria, 3250', 'LongLabel': '45 Stodart St, Colac, Victoria, 3250, AUS', 'ShortLabel': '45 Stodart St', 'Addr_type': 'PointAddress', 'Type': '', 'PlaceName': '', 'AddNum': '45', 'Address': '45 Stodart St', 'Block': '', 'Sector': '', 'Neighborhood': 'Colac', 'District': '', 'City': 'Colac', 'MetroArea': '', 'Subregion': '', 'Region': 'Victoria', 'Territory': '', 'Postal': '3250', 'PostalExt': '', 'CountryCode': 'AUS'}, 'location': {'x': 143.5689855, 'y': -38.328956999999996, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}}
{'address': {'Match_addr': '43 Stodart St, Colac, Victoria, 3250', 'LongLabel': '43 Stodart St, Colac, Victoria, 3250, AUS', 'ShortLabel': '43 Stodart St', 'Addr_type': 'PointAddress', 'Type': '', 'PlaceName': '', 'AddNum': '43', 'Address': '43 Stodart St', 'Block': '', 'Sector': '', 'Neighborhood': 'Colac', 'District': '', 'City': 'Colac', 'MetroArea': '', 'Subregion': '', 'Region': 'Victoria', 'Territory': '', 'Postal': '3250', 'PostalExt': '', 'CountryCode': 'AUS'}, 'location': {'x': 143.5692555, 'y': -38.328993, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}}
{'address': {'Match_addr': '41 Stodart St, Colac, Victoria, 3250', 'LongLabel': '41 Stodart St, Colac, Victoria, 3250, AUS', 'ShortLabel': '41 Stodart St', 'Addr_type': 'PointAddress', 'Type': '', 'PlaceName': '', 'AddNum': '41', 'Address': '41 Stodart St', 'Block': '', 'Sector': '', 'Neighborhood': 'Colac', 'District': '', 'City': 'Colac', 'MetroArea': '', 'Subregion': '', 'Region': 'Victoria', 'Territory': '', 'Postal': '3250', 'PostalExt': '', 'CountryCode': 'AUS'}, 'location': {'x': 143.56951650000002, 'y': -38.32902, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}}
{'address': {'Match_addr': '39 Stodart St, Colac, Victoria, 3250', 'LongLabel': '39 Stodart St, Colac, Victoria, 3250, AUS', 'ShortLabel': '39 Stodart St', 'Addr_type': 'PointAddress', 'Type': '', 'PlaceName': '', 'AddNum': '39', 'Address': '39 Stodart St', 'Block': '', 'Sector': '', 'Neighborhood': 'Colac', 'District': '', 'City': 'Colac', 'MetroArea': '', 'Subregion': '', 'Region': 'Victoria', 'Territory': '', 'Postal': '3250', 'PostalExt': '', 'CountryCode': 'AUS'}, 'location': {'x': 143.56978650000002, 'y': -38.329046999999996, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}}
{'address': {'Match_addr': '37 Stodart St, Colac, Victoria, 3250', 'LongLabel': '37 Stodart St, Colac, Victoria, 3250, AUS', 'ShortLabel': '37 Stodart St', 'Addr_type': 'PointAddress', 'Type': '', 'PlaceName': '', 'AddNum': '37', 'Address': '37 Stodart St', 'Block': '', 'Sector': '', 'Neighborhood': 'Colac', 'District': '', 'City': 'Colac', 'MetroArea': '', 'Subregion': '', 'Region': 'Victoria', 'Territory': '', 'Postal': '3250', 'PostalExt': '', 'CountryCode': 'AUS'}, 'location': {'x': 143.5700205, 'y': -38.329074, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}}
{'address': {'Match_addr': '35 Stodart St, Colac, Victoria, 3250', 'LongLabel': '35 Stodart St, Colac, Victoria, 3250, AUS', 'ShortLabel': '35 Stodart St', 'Addr_type': 'PointAddress', 'Type': '', 'PlaceName': '', 'AddNum': '35', 'Address': '35 Stodart St', 'Block': '', 'Sector': '', 'Neighborhood': 'Colac', 'District': '', 'City': 'Colac', 'MetroArea': '', 'Subregion': '', 'Region': 'Victoria', 'Territory': '', 'Postal': '3250', 'PostalExt': '', 'CountryCode': 'AUS'}, 'location': {'x': 143.5702635, 'y': -38.329101, 'spatialReference': {'wkid': 4326, 'latestWkid': 4326}}}
when 1.000
of houses have to be geocoded then adjust this part while i < 999
.
Your code ended up with an error most likely because of the credentials that have to be specified gis = GIS("http://www.arcgis.com", "username", "password")
.
Your probable error was similar to this one
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'