in: geocoding.geocode('New York, NY')
out:{'address': 'New York', 'location': {'x': -74.00713999999994, 'y': 40.71455000000003},
'score': 100,
'attributes': {'Loc_name': 'World',
'Status': 'T',
'Score': 100,
'Match_addr': 'New York',
'LongLabel': 'New York, NY, USA',
'ShortLabel': 'New York',
'Addr_type': 'Locality',
'Type': 'City',
'PlaceName': 'New York',
'Place_addr': 'New York',
'Rank': 2.5,
'AddBldg': '',
'Nbrhd': '',
'District': '',
'City': 'New York',
'MetroArea': 'New York City Metro',
'Subregion': 'New York County',
'Region': 'New York',
'RegionAbbr': 'NY',
'Territory': '',
'Country': 'USA',
'LangCode': 'ENG',
'Distance': 0,'},
'extent': {'xmin': -74.25713999999994,
'ymin': 40.46455000000003,
'xmax': -73.75713999999994,
'ymax': 40.96455000000003}}
Hi André Schuck
You could make a list of the boroughs and loop through it to get the first result for each geocode:
from arcgis.geocoding import geocode
boroughs = ['Manhattan', 'Bronx', 'Staten Island', 'Queens', 'Brooklyn']
for borough in boroughs:
print(f"{borough.upper()}\n{'=' * 50}")
b_geocode = geocode(borough)
print(f"{':2}{b_geocode[0]['location']}")
QUEENS
==================================================
{'x': -73.82998999999995, 'y': 40.714000000000055}
MANHATTAN
==================================================
{'x': -74.00600999999995, 'y': 40.714500000000044}
STATEN ISLAND
==================================================
{'x': -74.07526999999999, 'y': 40.64242000000007}
BRONX
==================================================
{'x': -73.92308999999995, 'y': 40.82600000000008}
BROOKLYN
==================================================
{'x': -73.99035999999995, 'y': 40.692450000000065}
Hi John, thank for your help. Assuming I do not know the names of the neighborhoods, is it possible to use geocode to extract all the names of neighborhoods that are inserted in a city? That is my main doubt.