Hi,
I'm trying to convert an AGOL layer to a spatially enabled data frame, following the steps in https://developers.arcgis.com/python/guide/part2-data-io-reading-data/#read-in-web-feature-layers
I can access the AGOL item and its layers:
But when I try to read one of them into a spatially enabled data frame, I get this:
The layer contains 3 features, it's not empty.
Does anyone know why this happens?
Thanks
Hanlie
Solved! Go to Solution.
I found this pattern at http://geospatialtraining.com/tutorial-using-pandas-dataframes-with-the-arcgis-api-for-python/ and it doesn't seem to mind empty fields.
I'm going to try to complete my script using this approach.
Regards
Hanlie
I see this now and then. It's not about the layer itself, it's that a null value is being encountered when it expects an integer, and it's throwing an error.
Take a look at the data table, see if there are any fields where this might be happening.
If you want to work around this, try instead using bldg.query(as_df=True, out_fields=['subset', 'of', 'fields']) to just pull what you need and potentially avoid the offending field.
Hi Josh,
Thanks for the reply. I can now confirm that fields that have no value cause this error. When I use the query you suggested and only include fields that are mandatory and therefore do have values, the code works.
How can I get around this? I want to place the attribute tables of all the layers in the feature service into one data frame that I then want to export to CSV. Obviously I can't predict which optional attributes will have values and which won't.
Can you suggest any options other than spatial data frames? I don't actually need the spatial abilities.
Thanks
Hanlie
I found this pattern at http://geospatialtraining.com/tutorial-using-pandas-dataframes-with-the-arcgis-api-for-python/ and it doesn't seem to mind empty fields.
I'm going to try to complete my script using this approach.
Regards
Hanlie