Select to view content in your preferred language

How to get administrative boundaries from geocoded result

429
6
05-31-2024 09:32 AM
DanielDormont
Occasional Contributor

Hi,

In my application I have a use case where I'd like users to be able to search for an address that's really a whole city. What I'm hoping for is not a point in the middle of the city, but rather a polygon representing that city's administrative boundaries or at least its approximate geographical area. I did some searching around and I see that OpenStreetMap / nominatim has something like this:

https://nominatim.openstreetmap.org/search.php?q=new+haven+ct+usa&polygon_geojson=1&format=json&feat...

 

But I don't see any equivalent in the Esri Geocoding Service or any of the other APIs. I guess arguably another way you could do it would be to just make an ordinary findAddressCandidates call, and then use the coordinates from that result to make a geometry query against a polygon layer representing _all_ such boundaries,  but it doesn't seem like there's any layer like that, as far as I know.

 

Is there a way to do what I'm trying to do in ArcGIS APIs?

Thanks,
Dan

0 Kudos
6 Replies
ShanaBritt
Esri Regular Contributor

The ArcGIS Geocoding service is always going to return a point location. Depending on your application, you could use a polygon feature service for searching and it would return a polygon. For example, in ArcGIS Pro you could take an admin boundary layer and configure it for search in a map, then share the map as a web map to your organization and set the search feature to the polygon service for that web map

0 Kudos
DanielDormont
Occasional Contributor

@ShanaBritt thanks for replying, but I don't think that's quite what I'm trying to do. I don't already have a feature layer representing the administrative boundaries - what I was trying to say was if theoretically there was one available in Living Atlas or some other hosted service, I could use it. And my users are not ArcGIS Pro users. I'm trying to do this search using the ArcGIS REST APIs, similar to the nominatim example I listed in the OP. Is something like that possible?

 

Thanks,
Dan

0 Kudos
ShanaBritt
Esri Regular Contributor
0 Kudos
DanielDormont
Occasional Contributor

Again, thanks for replying but that's not what I'm asking. Sorry I'm not sure how to make it more clear. I am not asking how to query a feature service in general. I'm saying given a search term which is a single city / state / country (or administrative district or whatever other name is applicable in different jusrisdictions) I'd like to obtain a polygon representing its boundary. If that's not something doable through Esri APIs / hosted services I guess we can repurpose this as a feature suggestion and I'll look into using nominatim for now.

0 Kudos
ShanaBritt
Esri Regular Contributor

There is data for administrative areas on Living Atlas that can be used for your query or if you found other opensource data it can be published to ArcGIS Online or Enterprise portal as a feature service. 

Here is an example of querying a feature service:

services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Boundaries_2022/FeatureServer/2/query?...

This is the query example from the dataset United States County Boundaries - Overview (arcgis.com) in Living Atlas.

 

DanielDormont
Occasional Contributor

Thanks @ShanaBritt that's a great link. Is there a way to identify or find other similar layers in Living Atlas? For example for other geographies?

0 Kudos