Select to view content in your preferred language

REST API: Geoenrichment of Polygons

664
2
Jump to solution
01-24-2023 07:27 AM
BostonFusionCorp
New Contributor

Hi everyone! 

 

We're trying to use the REST API to perform geoenrichment of custom polygons, but we're running into a block. We can find resources that provide examples for points, lists of points, and ArcGIS provided polygons (e.g., census tracts / zip codes) but we cannot find anything that tells us how to specify custom polygons using the REST API. I would love even just one example of the format the API request must be in! We've tried, for example: 

 

studyAreas = {"rings": [[[-97.06138, 32.837], [-97.06133, 32.836], [-97.06124, 32.834], [-97.06127, 32.832], [-97.06138, 32.837]]], "spatialReference": {"wkid": 4326}
 
and we receive the error 
 

response_json: {'results': [{'paramName': 'GeoEnrichmentResult', 'dataType': 'GeoEnrichmentResult', 'value': {'version': '2.0', 'FeatureSet': []}}], 'error': {'code': 10020007, 'message': "Parameter 'studyAreas' is invalid.", 'details': [" Reason:\r\n  Invalid attribute 'StudyAreas'."], 'causes': [{'code': 10020049, 'message': "Invalid attribute 'StudyAreas'.", 'details': []}]}, 'messages': []}

 

Thanks everyone! I appreciate any the advice you can provide.

Julia

 

0 Kudos
1 Solution

Accepted Solutions
AnitaKemp
Esri Contributor

Hello, 

It seems to me that you're missing the geometry parameter as in: 

[{"geometry":{"rings": [[[-97.06138, 32.837], [-97.06133, 32.836], [-97.06124, 32.834], [-97.06127, 32.832], [-97.06138, 32.837]]], "spatialReference": {"wkid": 4326}}}]
 
Here are some resources that provide example REST requests for different location services: 
 

* ArcGIS location services Postman collection

* Data enrichment chapter in the Mapping APIs and location services guide

Best,

Anita

View solution in original post

0 Kudos
2 Replies
AnitaKemp
Esri Contributor

Hello, 

It seems to me that you're missing the geometry parameter as in: 

[{"geometry":{"rings": [[[-97.06138, 32.837], [-97.06133, 32.836], [-97.06124, 32.834], [-97.06127, 32.832], [-97.06138, 32.837]]], "spatialReference": {"wkid": 4326}}}]
 
Here are some resources that provide example REST requests for different location services: 
 

* ArcGIS location services Postman collection

* Data enrichment chapter in the Mapping APIs and location services guide

Best,

Anita

0 Kudos
BostonFusionCorp
New Contributor

Hi Anita, 

 

Thanks for the help!! I added in that "geometry" part and poked around some more, and it works!!! 

 

Thanks so much! 

Julia

0 Kudos