Write to feature services
The ArcGIS API for Python allows you to write data in a Spatially Enabled DataFrame
to a feature layer in ArcGIS Online or ArcGIS Enterprise
using the t
method.
This tutorial will show you how to convert a Spark DataFrame to a Spatially Enabled DataFrame and use
t
to create a feature service via the ArcGIS API for Python (arcgis
).
Prerequisites
The following are required for this tutorial:
- A running Spark session configured with ArcGIS GeoAnalytics Engine.
- A Jupyter or JupyterLab notebook connected to your Spark session.
- The
arcgis
module. - An internet connection (for accessing sample data).
Steps
Import and authorize
In your notebook, import
geoanalytics
and authorize the module using a username and password, license file, or token.PythonUse dark colors for code blocks Copy
Write a Spark DataFrame to a feature service using the ArcGIS API for Python
Import
arcgis
and log into ArcGIS Online or ArcGIS Enterprise. For more information check out Working with different authentication schemes.PythonUse dark colors for code blocks Copy Load a polygon feature service of US state boundaries into a Spark DataFrame.
PythonUse dark colors for code blocks Copy Convert the Spark DataFrame to a Spatially Enabled DataFrame. This requires that you have the arcgis module installed.
arcgis
will be imported automatically when calling st.to_pandas_sdf.PythonUse dark colors for code blocks Copy Export the Spatially Enabled Dataframe to a feature layer hosted in ArcGIS Online or ArcGIS Enterprise via the account that you have signed in during step 1.
What's next?
For more information, see the Writing GIS Data documentation and the following ArcGIS API for Python guide topics: