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("
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
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.use
Spark configuration property. For example:
spark.sql.sources.useV1SourceList feature-service,image-service,CRFThe 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 source | Format | Load | Save | API |
|---|---|---|---|---|
| Cloud Raster Format (CRF) | crf | Yes | Yes | V1 & V2 |
| CSV | csv | Yes | Yes | V1 |
| Feature service | feature-service | Yes | Yes | V1 & V2 |
| File geodatabase | filegdb | Yes | No | V2 |
| GeoJSON | geojson | Yes | Yes | V2 |
| GeoParquet | geoparquet | Yes | Yes | V1 |
| Image service | image-service | Yes | Yes | V1 & V2 |
| JDBC | jdbc | Yes | Yes | V1 |
| ORC | orc | Yes | Yes | V1 |
| Parquet | parquet | Yes | Yes | V1 |
| Parquet feature layer | parquet-feature-layer | Yes | Yes | V1 |
| Raster | raster | Yes | Yes | V2 |
| Esri shapefile | shapefile | Yes | Yes | V2 |
| Vector tiles | vector-tile | No | Yes | V1 |
What next?
For more examples on how to read and save data formats, see the following tutorials: