GeoAnalytics Engine supports loading and saving data from some common spatial data sources in addition to the data sources supported by Spark. After importing the geoanalytics module, these spatial data sources can be accessed by setting the format when loading or saving a Spark DataFrame.

Most data sources support loading from a single file or from a folder containing multiple files. When loading from a folder, all files within the folder must be the same format and have the same schema. For example, the line below shows a DataFrame, df, being created from multiple shapefiles that are stored in a folder called hurricanes.

df = spark.read.format("shapefile").load("S3://my-data/hurricanes")

The same format() string can also be used to save. For example, the line below shows a DataFrame, df, being saved as a collection of shapefiles stored in HDFS.

df.write.format("shapefile").save("hdfs://nn1home:8020/hurricanes")

Because Spark is a distributed engine, multiple writers are used to save a single DataFrame which results in a collection of files unless the data is explicitly coalesced to one partition before saving.

Some data sources are implemented using the Spark V1 data source API, while others are implemented using the Spark V2 API. Some data sources support both implementations, in which case the V2 implementation is used by default. To use the V1 implementation, set the spark.sql.sources.useV1SourceList Spark configuration property. For example:

Use dark colors for code blocksCopy
1
spark.sql.sources.useV1SourceList feature-service,image-service,CRF

The table below summarizes the spatial data sources available for loading and saving in ArcGIS GeoAnalytics Engine, as well as the data source API they are implemented with.

Data sourceFormatLoadSaveAPI
Cloud Raster Format (CRF)crfYesYesV1 & V2
CSVcsvYesYesV1
Feature servicefeature-serviceYesYesV1 & V2
File geodatabasefilegdbYesNoV2
GeoJSONgeojsonYesYesV2
GeoParquetgeoparquetYesYesV1
Image serviceimage-serviceYesYesV1 & V2
JDBCjdbcYesYesV1
ORCorcYesYesV1
ParquetparquetYesYesV1
Parquet feature layerparquet-feature-layerYesYesV1
RasterrasterYesYesV2
Esri shapefileshapefileYesYesV2
Vector tilesvector-tileNoYesV1

What next?

For more examples on how to read and save data formats, see the following tutorials:

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.