0

I'm new to ArcGIS API for Python. Is it possible to do do geocoding of an area, specifically New York City and get all the boroughs' names?

i.e.: Geocode request for all boroughs in New York city.

in[x]: geocoding.geocode('New York, NY')
out[x]:{'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}}

and get in the 'District' element: 'Bronx, Brooklyn, Manhattan, Queens, Staten Island'

7
  • 2
    Maybe? Do you already have a reference to a layer of New York city with this information inside? The Python API is designed to work against Enterprise or Online and the services inside. You'd typically need to find this data before you can conduct a query.
    – KHibma
    Dec 17, 2018 at 20:37
  • KHibma, I do not have a layer with this data. I've been trying to do this query using ArcGIs.geocoding libary. I just want to query the information that ArcGis already have in their database. i.e.: [in]: geocoding.geocode('New York',max_locations=1) [out]: [{'address': 'New York', 'location': {'x': -74.00713999999994, 'y': 40.71455000000003}, 'attributes': {'Loc_name': 'World', 'Sector': '', 'Nbrhd': '', 'District': '', ...}} And get in the 'District' element the name of all the districs in NY city. Dec 18, 2018 at 12:14
  • I'll update your question/tags to reflect that.
    – KHibma
    Dec 18, 2018 at 13:04
  • Simply as a starter, my guess is you need to set a category. However, in a few quick attempts I don't get any responses limited to just the boroughs. Reference: developers.arcgis.com/rest/geocode/api-reference/…
    – KHibma
    Dec 18, 2018 at 13:34
  • Welcome to GIS SE! Please edit your question to include your code attempts (rather than putting code snippets in comments) to show what you have tried and where you are having trouble. And as a new user, please be sure to take the site tour!
    – Andy
    Dec 18, 2018 at 15:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.