> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GeoPandas API functions

> Read spatial files, build points, and join, clip, and overlay with the GeoPandas API on WherobotsDB.

```python theme={"system"}
from sedona.spark.geopandas import read_file, read_parquet, sjoin
```

## list\_layers

```python theme={"system"}
list_layers(filename: Union[str, os.PathLike]) -> pd.DataFrame
```

List vector layers and nonspatial tables in a GeoPackage.

*Added in version 2.0.0.*

#### Parameters

<ParamField path="filename" type="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.
</ParamField>

#### Returns

<ResponseField name="return" type="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.
</ResponseField>

<Note>
  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.
</Note>

#### Examples

```python theme={"system"}
>>> layers = list_layers("city.gpkg")
>>> layers.columns.tolist()
['name', 'geometry_type']
```

## points\_from\_xy

```python theme={"system"}
points_from_xy(x, y, z=None, crs=None)
```

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

<ParamField path="x" type="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.
</ParamField>

<ParamField path="y" type="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.
</ParamField>

<ParamField path="z" type="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.
</ParamField>

<ParamField path="crs" type="value" default="None">
  Coordinate Reference System accepted by
  `pyproj.CRS.from_user_input`.
</ParamField>

#### Returns

<ResponseField name="return" type="GeoSeries">
  Distributed Point geometries. Shared distributed indexes, including
  MultiIndexes and duplicate labels, are preserved.
</ResponseField>

<Note>
  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.
</Note>

#### Examples

```python theme={"system"}
>>> import sedona.spark.geopandas as sgpd
>>> points = sgpd.points_from_xy([1, 2], [3, 4], crs="EPSG:4326")
>>> points
0    POINT (1 3)
1    POINT (2 4)
dtype: geometry
```

## read\_file

```python theme={"system"}
read_file(filename: str, format: Union[str, None] = None, **kwargs)
```

Alternate constructor to create a `GeoDataFrame` from a file.

#### Parameters

<ParamField path="filename" type="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.
</ParamField>

<ParamField path="format" type="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"
</ParamField>

<ParamField path="kwargs" />

**See also**

* `GeoDataFrame.to_file`: write GeoDataFrame to file

## read\_parquet

```python theme={"system"}
read_parquet(
    path,
    columns=None,
    storage_options=None,
    bbox=None,
    to_pandas_kwargs=None,
    **kwargs,
)
```

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

<ParamField path="path" type="str, path object" required />

<ParamField path="columns" type="list-like of strings" default="None">
  Not currently supported in Sedona
</ParamField>

<ParamField path="storage_options" type="dict" default="None">
  Not currently supported in Sedona
</ParamField>

<ParamField path="bbox" type="tuple" default="None">
  Not currently supported in Sedona
</ParamField>

<ParamField path="to_pandas_kwargs" type="dict" default="None">
  Not currently supported in Sedona
</ParamField>

<ParamField path="kwargs" />

#### Returns

<ResponseField name="return" type="GeoDataFrame" />

#### Examples

from sedona.spark.geopandas import read\_parquet

```python theme={"system"}
>>> df = read_parquet("data.parquet")
```

Specifying columns to read:

```python theme={"system"}
>>> df = read_parquet(
...     "data.parquet",
... )
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.