Skip to main content

list_layers

List vector layers and nonspatial tables in a GeoPackage. Added in version 2.0.0.

Parameters

Union[str, os.PathLike]
required
Path to one GeoPackage (.gpkg) file, including Hadoop-supported paths such as s3a://bucket/data.gpkg. Bytes and file-like objects are not supported. A glob must resolve to exactly one file.

Returns

pandas.DataFrame
Columns name and geometry_type, sorted by name. Registered nonspatial tables, including legacy aspatial tables, have None as their geometry type. Raster tile tables are excluded.
Unlike GeoPandas, this currently supports GeoPackage only. It uses Sedona’s Spark reader, not Pyogrio. Only layer metadata is collected to the driver; no feature geometries are read. The reader copies remote GeoPackages in full to executor-local temporary storage, so remote I/O and temporary disk space scale with the file size.Types describe declared metadata, including empty layers. Concrete types permitting Z use a Z suffix; M is not represented, matching GeoPandas with Pyogrio. Generic geometry layers report Unknown. Only core GeoPackage geometry types are supported.

Examples

points_from_xy

Construct a distributed GeoSeries of Point geometries from coordinates. Unlike geopandas.points_from_xy, which returns an in-memory GeometryArray, this scalable counterpart returns a distributed GeoSeries so that its index and CRS metadata can be retained.

Parameters

iterable or pandas-on-Spark Series
required
Coordinate values. Distributed Series must come from the same frame; numeric scalar coordinates are broadcast over that frame.
iterable or pandas-on-Spark Series
required
Coordinate values. Distributed Series must come from the same frame; numeric scalar coordinates are broadcast over that frame.
iterable or pandas-on-Spark Series
default:"None"
Coordinate values. Distributed Series must come from the same frame; numeric scalar coordinates are broadcast over that frame.
value
default:"None"
Coordinate Reference System accepted by pyproj.CRS.from_user_input.

Returns

GeoSeries
Distributed Point geometries. Shared distributed indexes, including MultiIndexes and duplicate labels, are preserved.
Construction uses native ST_Point or ST_PointZ expressions. It does not collect pandas-on-Spark inputs or execute a Python row UDF.Local coordinates use NumPy broadcasting and are paired positionally, as in GeoPandas. Local iterables, NumPy arrays, and pandas objects are materialized on the driver and are intended for bounded inputs. Use pandas-on-Spark Series for large coordinate columns.Distributed Series are paired within their shared Spark plan and retain that plan’s index. Series from unrelated plans are rejected because they have no safe distributed positional relationship.

Examples

read_file

Alternate constructor to create a GeoDataFrame from a file.

Parameters

str
required
File path or file handle to read from. If the path is a directory, Sedona will read all files in the directory into a dataframe.
Union[str, None]
default:"None"
The format of the file to read. If None, Sedona will infer the format from the file extension. Note, inferring the format from the file extension is not supported for directories. Options:
  • “shapefile”
  • “geojson”
  • “geopackage”
  • “geoparquet”
See also
  • GeoDataFrame.to_file: write GeoDataFrame to file

read_parquet

Load a Parquet object from the file path, returning a GeoDataFrame.
  • if no geometry columns are read, this will raise a ValueError - you should use the pandas read_parquet method instead.
If ‘crs’ key is not present in the GeoParquet metadata associated with the Parquet object, it will default to “OGC:CRS84” according to the specification.

Parameters

str, path object
required
list-like of strings
default:"None"
Not currently supported in Sedona
dict
default:"None"
Not currently supported in Sedona
tuple
default:"None"
Not currently supported in Sedona
dict
default:"None"
Not currently supported in Sedona

Returns

GeoDataFrame

Examples

from sedona.spark.geopandas import read_parquet
Specifying columns to read: