Extract Data from External Feature Service

241
2
04-28-2021 01:32 PM
DavidBates-Jefferys
New Contributor

I am trying to create a tool to measure distances from a subset of the Microsoft Building Footprint service (https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/MSBFP2/FeatureServer/0/).

I am able to extract data within a given Polygon in a Webmap, however I cannot get arcgis.features.analysis.extract_data() to work for the buildings within the same Polygon.

I receive the errors: 
GetHostedLayers for parameter 0 failed. Error: {"code" : 0, "messageCode":"GPEXT_018","message": "Number of features in service https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/MSBFP2/FeatureServer/0 exceeds the limit of 100,000 features. Use a hosted feature service as input to analyze large dataset.","params":{"url" : "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/MSBFP2/FeatureServer/0"}} {"messageCode": "AO_100026", "message": "ExtractData failed."} Failed to execute (ExtractData). Failed.

 

My Erroring Code:
BLDG =  "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/MSBFP2/FeatureServer/0"
bld = BLDG.layers[0]
Test  = gis.content.get(hosted feature Polygon)
arcgis.features.analysis.extract_data(input_layers=[bld], extent=Test, clip=True, data_format='FileGeodatabase', output_name='Buildings')

 

Working Webmap URL Query:
https://<portal>/hosted/rest/services/System/SpatialAnalysisTools/GPServer/ExtractData/submitJob?f=json
&InputLayers=[<MSBFP>] &Clip=false&DataFormat=FILEGEODATABASE&Extent={<hosted Polygon>,"serviceToken":<token>,"name":"Polygon"}&context={<PolygonExtent>}&OutputName={<OutputName>}&token<token>

 

Is there something wrong with my python code? Is there a way to query such large datasets? Or do I need to run my script by writing the full URL Query call as it seems to work even if it is more complex and round about process?

By defining extents , do we still need to download the entire service?

0 Kudos
2 Replies
DavidPike
MVP Frequent Contributor

What's the purpose of extracting the data? 

'exceeds the limit of 100,000 features'

If you elaborated a bit more it might lead to a better solution than trying to download >100,000 polygons to then analyse.

0 Kudos
DavidBates-Jefferys
New Contributor

The goal of my script is to generate buffers off the Building footprints, using a User Provided polygon and distance that will then be used for further analysis.

I generally have gotten the same 'exceeds limit error' when using arcgis.features.analysis.create_buffers, so I am trying to create a subset of the original dataset, and am open to other ways to do this

0 Kudos