python api

1615
7
03-21-2017 11:40 AM
CharlieWare
New Contributor II

What is the syntax for accessing data in a file geodatabase when using the new python api in a jupyter notebook?

0 Kudos
7 Replies
RebeccaStrauch__GISP
MVP Emeritus

I can't say that I really know, since I am new with the API and Jupyter notebooks too.  Most of what I have seen in the samples are referring more to Online and Portal as the resources, or FeatureClass. I haven't seen anything specifically mentioning fgdb.

With that said, look thru API Reference for the ArcGIS API for Python — arcgis 1.0.1 documentation    for the various syntax.  And maybe the arcgis.geoprocessing module — arcgis 1.0.1 documentation will give some hints on how to access.

You may need to login with your developer account to access.

tagging a couple other groups for more exposure.  https://community.esri.com/groups/arcgis-python-api?sr=search&searchId=5397394b-3dae-4747-b1a3-19e56...https://community.esri.com/community/developers/gis-developers/python?sr=search&searchId=c38d90ea-1a...

0 Kudos
RohitSingh2
Esri Contributor

The ArcGIS Python API doesn't yet let you work with File Geodatabase directly. It lets you add and publish fgdb to your Web GIS as hosted feature layers and has APIs for working with feature layers and visualizing them. We're working on adding support for reading File Geodatabases as pandas (spatial) dataframes but that's not there in the API yet.

Thanks,

Rohit

JoshuaBixby
MVP Esteemed Contributor

rsingh-esristaff‌, good news, what about updating file geodatabase data using the ArcGIS Python API?  Are any type of cursors, either for file system data or web GIS data, in our future too?

0 Kudos
Haider_Ali
Occasional Contributor

Is  reading file geodatabase support added in python api? My requirement  is to insert subset of records from fgdb to hosted feature layer is there any way to do this if fgdb is not supported yet?

0 Kudos
RohitSingh2
Esri Contributor

The plan to update file geodatabase data is to update the spatial dataframe and write it back to the fgdb. Will that work for your needs?

Thanks,

Rohit

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Historically my use of data frames is for reading or analyzing data, not updating it, which is why I mentioned cursors.  That said, I am always up for learning something new if it works and performs just as well as my old way.

When it comes to using data frames to update data, I guess my first question is how does that work with very large data sets (feature classes) and memory management.  Whereas ArcPy cursors are generators of sorts, i.e., they yield data instead of returning all of the data at once, they still allow data to be updated.

Looking at the pandas documentation for something like iterrows(), is clearly states:

You should never modify something you are iterating over. This is not guaranteed to work in all cases. Depending on the data types, the iterator returns a copy and not a view, and writing to it will have no effect.

As I mentioned, I am not overly familiar with updating data using data frames, so I will just state that one of my requirements for managing file geodatabase data, or really any data, using the ArcGIS Python API would be to update the data as it is being iterated over and not require an entire data set to be dumped to a data frame and rewritten back to update any values.

0 Kudos
DanPatterson_Retired
MVP Emeritus

stick with numpy to handle mixed dtypes, pandas adds a whole new level of baggage to numpy which is panda's core

0 Kudos