# Python geospatial libraries

Python geospatial libraries read, analyze, and transform data tied to locations on Earth, such as points, boundaries, and satellite images. Vector data stores each shape as coordinates rather than as the grid of cell values that raster data uses. These libraries let mapping apps, logistics tools, and AI agents answer questions about places and distances.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [Shapely](#shapely) | 78.4M | 4.5K | Oct 2026 | BSD-3-Clause |
| [pyproj](#pyproj) | 26.3M | 1.2K | Sep 2026 | MIT |
| [h3-py](#hthree) | 14.8M | Not on GitHub | Nov 2026 | Apache-2.0 |
| [GeoPandas](#geopandas) | 14.8M | 5.3K | Sep 2026 | BSD-3-Clause |
| [Pyogrio](#pyogrio) | 14.2M | Not on GitHub | Jun 2026 | MIT |
| [Rtree](#rtree) | 12.2M | Not on GitHub | Aug 2025 | MIT |
| [geopy](#geopy) | 12.1M | Not on GitHub | Jul 2026 | MIT |
| [Rasterio](#rasterio) | 7.4M | 2.6K | Sep 2026 | BSD-3-Clause |

Downloads: pypi, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[Shapely](#shapely) has the most monthly downloads in this comparison, at 78.4M.

## Capabilities

| Library | Vector dataset I/O | Raster dataset I/O | Native CRS transformations | Geometry predicates or buffers | Spatial indexing | Ellipsoidal geodesic distances |
| --- | --- | --- | --- | --- | --- | --- |
| [Shapely](#shapely) | No | No | No | Yes | Yes | No |
| [pyproj](#pyproj) | No | No | Yes | No | No | Yes |
| [h3-py](#hthree) | No | No | No | No | Yes | No |
| [GeoPandas](#geopandas) | Yes | No | Yes | Yes | Yes | No |
| [Pyogrio](#pyogrio) | Yes | No | No | No | No | No |
| [Rtree](#rtree) | No | No | No | No | Yes | No |
| [geopy](#geopy) | No | No | No | No | No | Yes |
| [Rasterio](#rasterio) | No | Yes | Yes | No | No | No |

## Libraries

### Shapely

[GitHub](https://github.com/shapely/shapely) · [pypi](https://pypi.org/project/shapely) · [Docs](https://shapely.readthedocs.io/en/stable/manual.html#coordinate-systems)

Manipulates and analyzes geometric objects in a Cartesian plane.

- Downloads / mo: 78.4M
- Stars: 4.5K
- Last release: 2.2.0
- License: BSD-3-Clause
- Capabilities: [From the Shapely docs](https://shapely.readthedocs.io/en/stable/manual.html#coordinate-systems)

**Strengths**

- **Combines and intersects shapes.** Use union and intersection for operations on individual geometries.
- **Processes arrays of geometries.** Apply vectorized functions to geometry arrays.

**Watch out for**

- **Geometric analysis ignores height.** Use another approach when height must affect geometric measurements.
- **CRS conversion needs another engine.** Use PyProj when converting between coordinate reference systems.

```sh
python -m pip install shapely==2.2.0
```

**mahdin75/gis-mcp** (207 stars)

[mahdin75/gis-mcp](https://github.com/mahdin75/gis-mcp) 

```python
@gis_mcp.tool()
def project_geometry(geometry: str, source_crs: str, 
                    target_crs: str) -> Dict[str, Any]:
    """Project a geometry between CRS."""
    try:
        from shapely import wkt
        from shapely.ops import transform
        from pyproj import Transformer
        geom = wkt.loads(geometry)
        transformer = Transformer.from_crs(source_crs, target_crs, always_xy=True)
        projected = transform(transformer.transform, geom)
        return {
            "status": "success",
            "geometry": projected.wkt,
            "source_crs": source_crs,
            "target_crs": target_crs,
            "message": "Geometry projected successfully"
        }
    except Exception as e:
        logger.error(f"Error projecting geometry: {str(e)}")
        raise ValueError(f"Failed to project geometry: {str(e)}")

```

[src/gis_mcp/pyproj_functions.py](https://github.com/mahdin75/gis-mcp/blob/be8a33d25aefccf256136f3de0f18124f6efa16f/src/gis_mcp/pyproj_functions.py#L64-L84) · [More projects using Shapely →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20shapely%20for%20geospatial%20transformations%20and%20spatial%20analysis&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from shapely import Point

point = Point(0, 0)
buffer = point.buffer(1)

```

From [README.rst](https://shapely.readthedocs.io/en/stable/manual.html#coordinate-systems)

### pyproj

[GitHub](https://github.com/pyproj4/pyproj) · [pypi](https://pypi.org/project/pyproj) · [Docs](https://pyproj4.github.io/pyproj/stable/examples.html)

Provides Python access to PROJ for coordinate transformations and projection definitions.

- Downloads / mo: 26.3M
- Stars: 1.2K
- Last release: 3.8.0
- License: MIT
- Capabilities: [From the pyproj docs](https://pyproj4.github.io/pyproj/stable/examples.html)

**Strengths**

- **Transforms between coordinate systems.** Use Transformer for coordinate and datum conversions.
- **Accepts coordinate arrays.** Transform batches of coordinate values through the same API.

**Watch out for**

- **Axis order can change.** Use always_xy when the caller supplies longitude before latitude.
- **Transformation grids are installed separately.** Install required grids when a chosen datum conversion needs them.

```sh
python -m pip install pyproj==3.8.0
```

**mahdin75/gis-mcp** (207 stars)

[mahdin75/gis-mcp](https://github.com/mahdin75/gis-mcp) 

```python
@gis_mcp.tool()
def transform_coordinates(coordinates: List[float], source_crs: str, 
                        target_crs: str) -> Dict[str, Any]:
    """Transform coordinates between CRS."""
    try:
        from pyproj import Transformer
        transformer = Transformer.from_crs(source_crs, target_crs, always_xy=True)
        x, y = coordinates
        x_transformed, y_transformed = transformer.transform(x, y)
        return {
            "status": "success",
            "coordinates": [x_transformed, y_transformed],
            "source_crs": source_crs,
            "target_crs": target_crs,
            "message": "Coordinates transformed successfully"
        }
    except Exception as e:
        logger.error(f"Error transforming coordinates: {str(e)}")
        raise ValueError(f"Failed to transform coordinates: {str(e)}")

```

[src/gis_mcp/pyproj_functions.py](https://github.com/mahdin75/gis-mcp/blob/be8a33d25aefccf256136f3de0f18124f6efa16f/src/gis_mcp/pyproj_functions.py#L44-L62) · [More projects using pyproj →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pyproj%20for%20geospatial%20transformations%20and%20spatial%20analysis&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**geopandas/geopandas** (5.3K stars)

[geopandas/geopandas](https://github.com/geopandas/geopandas) 

```python
def _to_file_fiona(df, filename, driver, schema, crs, mode, metadata, **kwargs):
    if not HAS_PYPROJ and crs:
        raise ImportError(
            "The 'pyproj' package is required to write a file with a CRS, but it is not"
            " installed or does not import correctly."
        )

    if schema is None:
        schema = infer_schema(df)

    if crs:
        from pyproj import CRS

        crs = CRS.from_user_input(crs)
    else:
        crs = df.crs

    with fiona_env():
        crs_wkt = None
        try:
            gdal_version = Version(
                fiona.env.get_gdal_release_name().strip("e")
            )  # GH3147
        except (AttributeError, ValueError):
            gdal_version = Version("2.0.0")  # just assume it is not the latest
        if gdal_version >= Version("3.0.0") and crs:
            crs_wkt = crs.to_wkt()
        elif crs:
            crs_wkt = crs.to_wkt("WKT1_GDAL")
        with fiona.open(
            filename, mode=mode, driver=driver, crs_wkt=crs_wkt, schema=schema, **kwargs
        ) as colxn:
            if metadata is not None:
                colxn.update_tags(metadata)
            colxn.writerecords(df.iterfeatures())
```

[geopandas/io/file.py](https://github.com/geopandas/geopandas/blob/f596bc16071809a3e86c550fb3a9158c9bae5292/geopandas/io/file.py#L744-L778) · [More projects using pyproj →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pyproj%20for%20geospatial%20transformations%20and%20spatial%20analysis&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from pyproj import Transformer

transformer = Transformer.from_crs(4326, 3857, always_xy=True)
x, y = transformer.transform(-75, 40)

```

From [examples.html](https://pyproj4.github.io/pyproj/stable/examples.html)

### h3-py

[GitHub](https://github.com/uber/h3-py) · [pypi](https://pypi.org/project/h3) · [Docs](https://uber.github.io/h3-py/api_quick.html)

Indexes locations with the Uber hierarchical hexagonal geospatial indexing system.

- Downloads / mo: 14.8M
- Last release: 4.5.1
- License: Apache-2.0
- Capabilities: [From the h3-py docs](https://uber.github.io/h3-py/api_quick.html)

```sh
python -m pip install h3==4.5.1
```

**DahnJ/H3-Pandas** (223 stars)

[DahnJ/H3-Pandas](https://github.com/DahnJ/H3-Pandas) 

```python
@sequential_deduplication
def linetrace(geometry: MultiLineOrLine, resolution: int) -> Iterator[str]:
    """h3.polyfill equivalent for shapely (Multi)LineString
    Does not represent lines with duplicate sequential cells,
    but cells may repeat non-sequentially to represent
    self-intersections

    Parameters
    ----------
    geometry : LineString or MultiLineString
        Line to trace with H3 cells
    resolution : int
        H3 resolution of the tracing cells

    Returns
    -------
    Set of H3 addresses

    Raises
    ------
    TypeError if geometry is not a LineString or a MultiLineString
    """
    if isinstance(geometry, MultiLineString):
        # Recurse after getting component linestrings from the multiline
        for line in map(lambda geom: linetrace(geom, resolution), geometry.geoms):
            yield from line
    elif isinstance(geometry, LineString):
        coords = zip(geometry.coords, geometry.coords[1:])
        while (vertex_pair := next(coords, None)) is not None:
            i, j = vertex_pair
            a = h3.latlng_to_cell(*i[::-1], resolution)
            b = h3.latlng_to_cell(*j[::-1], resolution)
            yield from h3.grid_path_cells(a, b)  # inclusive of a and b
    else:
        raise TypeError(f"Unknown type {type(geometry)}")
```

[h3pandas/util/shapely.py](https://github.com/DahnJ/H3-Pandas/blob/4c112ca143203e2e93be1042283ede6c9fe6de0c/h3pandas/util/shapely.py#L67-L101) · [More projects using h3-py →](https://dashboard.exa.ai/playground/search?q=h3%20GitHub%20projects)

**Quickstart**

```python
import h3

cell = h3.latlng_to_cell(37.77, -122.42, 9)

```

From [api_quick.html](https://uber.github.io/h3-py/api_quick.html)

### GeoPandas

[GitHub](https://github.com/geopandas/geopandas) · [pypi](https://pypi.org/project/geopandas) · [Docs](https://geopandas.org/en/stable/docs/user_guide/projections.html)

Extends pandas with geometry columns, spatial operations, and geospatial file handling.

- Downloads / mo: 14.8M
- Stars: 5.3K
- Last release: 1.2.0
- License: BSD-3-Clause
- Capabilities: [From the GeoPandas docs](https://geopandas.org/en/stable/docs/user_guide/projections.html)

**Strengths**

- **Combines geometry with table columns.** Retain attributes from both tables when overlaying spatial datasets.
- **Reprojects geometry columns.** Use to_crs to transform the active geometry column.

**Watch out for**

- **Dateline crossings distort reprojection.** Check geometries that cross the dateline or other projection boundaries.

```sh
python -m pip install geopandas==1.2.0
```

**gboeing/osmnx** (5.9K stars)

[gboeing/osmnx](https://github.com/gboeing/osmnx) 

```python
def project_gdf(
    gdf: gpd.GeoDataFrame,
    *,
    to_crs: Any | None = None,  # noqa: ANN401
    to_latlong: bool = False,
) -> gpd.GeoDataFrame:
    """
    Project a GeoDataFrame from its current CRS to another.

    If `to_latlong` is True, this projects the GeoDataFrame to the coordinate
    reference system defined by `settings.default_crs`. Otherwise it projects
    it to the CRS defined by `to_crs`. If `to_crs` is `None`, it projects it
    to the CRS of an appropriate UTM (or UPS) zone given `gdf`'s bounds.

    Parameters
    ----------
    gdf
        The GeoDataFrame to be projected.
    to_crs
        If None, project to an appropriate UTM zone. Otherwise project to
        this CRS.
    to_latlong
        If True, project to `settings.default_crs` and ignore `to_crs`.

    Returns
    -------
    gdf_proj
        The projected GeoDataFrame.
    """
    if gdf.crs is None or len(gdf) == 0:  # pragma: no cover
        msg = "`gdf` must have a valid CRS and cannot be empty."
        raise ValueError(msg)

    # if to_latlong is True, project the gdf to the default_crs
    if to_latlong:
        to_crs = settings.default_crs

    # else if to_crs is None, choose an appropriate UTM zone
    elif to_crs is None:
        UTM_NORTH_LIMIT = 84
        UTM_SOUTH_LIMIT = -80
        centroid = gdf.union_all().centroid

        # if gdf is already projected, temporarily re-project centroid to
        # lat-long to check against UTM (lat-long) north/south limits
        if is_projected(gdf.crs):
            centroid, _ = project_geometry(centroid, crs=gdf.crs, to_latlong=True)

        # if centroid is north or south of UTM limits, use UPS CRS instead
        if centroid.y < UTM_SOUTH_LIMIT:
            to_crs = "epsg:32761"
        elif centroid.y > UTM_NORTH_LIMIT:
            to_crs = "epsg:32661"
        else:
            # otherwise, we're within UTM limits, so choose a UTM zone
            to_crs = gdf.estimate_utm_crs()

    # project the gdf
    gdf_proj = gdf.to_crs(to_crs)
    crs_desc = f"{gdf_proj.crs.to_string()} / {gdf_proj.crs.name}"

    msg = f"Projected GeoDataFrame to {crs_desc!r}"
    utils.log(msg, level=lg.INFO)
    return gdf_proj

```

[osmnx/projection.py](https://github.com/gboeing/osmnx/blob/0be7bf02dace325a66c0b7fcf06eca542db3a9a6/osmnx/projection.py#L81-L144) · [More projects using GeoPandas →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20geopandas%20for%20geospatial%20transformations%20and%20spatial%20analysis&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import geopandas as gpd
from shapely import Point

points = gpd.GeoSeries([Point(-75, 40)], crs="EPSG:4326")
projected = points.to_crs("EPSG:3857")

```

From [create_geopandas_from_pandas.html](https://geopandas.org/en/stable/docs/user_guide/projections.html)

### Pyogrio

[GitHub](https://github.com/geopandas/pyogrio) · [pypi](https://pypi.org/project/pyogrio) · [Docs](https://pyogrio.readthedocs.io/en/latest/api.html)

Reads and writes spatial vector file formats in vectorized form through GDAL and OGR.

- Downloads / mo: 14.2M
- Last release: 0.13.0
- License: MIT
- Capabilities: [From the Pyogrio docs](https://pyogrio.readthedocs.io/en/latest/api.html)

```sh
python -m pip install pyogrio==0.13.0
```

**geopandas/geopandas** (5.3K stars)

[geopandas/geopandas](https://github.com/geopandas/geopandas) 

```python
def _to_file_pyogrio(df, filename, driver, schema, crs, mode, metadata, **kwargs):
    import pyogrio

    if schema is not None:
        raise ValueError(
            "The 'schema' argument is not supported with the 'pyogrio' engine."
        )

    if mode == "a":
        kwargs["append"] = True

    if crs is not None:
        raise ValueError("Passing 'crs' is not supported with the 'pyogrio' engine.")

    # for the fiona engine, this check is done in gdf.iterfeatures()
    if not df.columns.is_unique:
        raise ValueError("GeoDataFrame cannot contain duplicated column names.")

    pyogrio.write_dataframe(df, filename, driver=driver, metadata=metadata, **kwargs)
```

[geopandas/io/file.py](https://github.com/geopandas/geopandas/blob/f596bc16071809a3e86c550fb3a9158c9bae5292/geopandas/io/file.py#L781-L799) · [More projects using Pyogrio →](https://dashboard.exa.ai/playground/search?q=pyogrio%20GitHub%20projects)

**Quickstart**

```python
import pyogrio

drivers = pyogrio.list_drivers()

```

From [api.html](https://pyogrio.readthedocs.io/en/latest/api.html)

### Rtree

[GitHub](https://github.com/Toblerity/rtree) · [pypi](https://pypi.org/project/rtree) · [Docs](https://rtree.readthedocs.io/en/stable/tutorial.html)

Provides an R-tree spatial index for Python GIS.

- Downloads / mo: 12.2M
- Last release: 1.4.1
- License: MIT
- Capabilities: [From the Rtree docs](https://rtree.readthedocs.io/en/stable/tutorial.html)

```sh
python -m pip install rtree==1.4.1
```

**mikedh/trimesh** (3.7K stars)

[mikedh/trimesh](https://github.com/mikedh/trimesh) 

```python
def bounds_tree(bounds: ArrayLike) -> Any:
    """
    Given a set of axis aligned bounds create an r-tree for
    broad-phase collision detection.

    Parameters
    ------------
    bounds : (n, 2D) or (n, 2, D) float
      Non-interleaved bounds where D=dimension
      E.G a 2D bounds tree:
      [(minx, miny, maxx, maxy), ...]

    Returns
    ---------
    tree : Rtree
      Tree containing bounds by index
    """
    import rtree

    # make sure we've copied bounds
    bounds = np.array(bounds, dtype=np.float64, copy=True)
    if len(bounds.shape) == 3:
        # should be min-max per bound
        if bounds.shape[1] != 2:
            raise ValueError("bounds not (n, 2, dimension)!")
        # reshape to one-row-per-hyperrectangle
        bounds = bounds.reshape((len(bounds), -1))
    elif len(bounds.shape) != 2 or bounds.size == 0:
        raise ValueError("Bounds must be (n, dimension * 2)!")

    # check to make sure we have correct shape
    dimension = bounds.shape[1]
    if (dimension % 2) != 0:
        raise ValueError("Bounds must be (n,dimension*2)!")
    dimension = int(dimension / 2)

    properties = rtree.index.Property(dimension=dimension)
    # stream load was verified working on import above
    return rtree.index.Index(
        zip(np.arange(len(bounds)), bounds, [None] * len(bounds)), properties=properties
    )
```

[trimesh/util.py](https://github.com/mikedh/trimesh/blob/7fe4ac4405ba5af02756c2db729da6822510304c/trimesh/util.py#L1883-L1923) · [More projects using Rtree →](https://dashboard.exa.ai/playground/search?q=rtree%20GitHub%20projects)

**Quickstart**

```python
from rtree import index

spatial_index = index.Index()
spatial_index.insert(0, (0, 0, 1, 1))
matches = list(spatial_index.intersection((0.5, 0.5, 2, 2)))

```

From [tutorial.html](https://rtree.readthedocs.io/en/stable/tutorial.html)

### geopy

[GitHub](https://github.com/geopy/geopy) · [pypi](https://pypi.org/project/geopy) · [Docs](https://geopy.readthedocs.io/en/stable/#module-geopy.distance)

Provides a geocoding toolbox for Python.

- Downloads / mo: 12.1M
- Last release: 2.5.0
- License: MIT
- Capabilities: [From the geopy docs](https://geopy.readthedocs.io/en/stable/#module-geopy.distance)

```sh
python -m pip install geopy==2.5.0
```

**geopandas/geopandas** (5.3K stars)

[geopandas/geopandas](https://github.com/geopandas/geopandas) 

```python
def _query(data, forward, provider, throttle_time, **kwargs):
    # generic wrapper for calls over lists to geopy Geocoders
    from geopy.geocoders import get_geocoder_for_service
    from geopy.geocoders.base import GeocoderQueryError

    if forward:
        if not isinstance(data, pd.Series):
            data = pd.Series(data)
    else:
        if not isinstance(data, geopandas.GeoSeries):
            data = geopandas.GeoSeries(data)

    if isinstance(provider, str):
        provider = get_geocoder_for_service(provider)

    coder = provider(**kwargs)
    results = {}
    for i, s in data.items():
        try:
            if forward:
                results[i] = coder.geocode(s)
            else:
                results[i] = coder.reverse((s.y, s.x), exactly_one=True)
        except (GeocoderQueryError, ValueError):
            results[i] = (None, None)
        time.sleep(throttle_time)

    df = _prepare_geocode_result(results)
    return df
```

[geopandas/tools/geocoding.py](https://github.com/geopandas/geopandas/blob/f596bc16071809a3e86c550fb3a9158c9bae5292/geopandas/tools/geocoding.py#L119-L147) · [More projects using geopy →](https://dashboard.exa.ai/playground/search?q=geopy%20GitHub%20projects)

**Quickstart**

```python
from geopy.distance import geodesic

distance_km = geodesic((41.49, -71.31), (41.5, -81.69)).km

```

From [index.html](https://geopy.readthedocs.io/en/stable/#module-geopy.distance)

### Rasterio

[GitHub](https://github.com/rasterio/rasterio) · [pypi](https://pypi.org/project/rasterio) · [Docs](https://rasterio.readthedocs.io/en/stable/quickstart.html)

Reads and writes geospatial raster datasets through NumPy-based Python APIs.

- Downloads / mo: 7.4M
- Stars: 2.6K
- Last release: 1.5.2
- License: BSD-3-Clause
- Capabilities: [From the Rasterio docs](https://rasterio.readthedocs.io/en/stable/quickstart.html)

**Strengths**

- **Works directly with raster arrays.** Read and write pixel bands as array data.
- **Reprojects raster grids.** Use reproject to map arrays into another geospatial grid.

**Watch out for**

- **Writing support varies by driver.** Use GeoTIFF for the best-supported writing path.

```sh
python -m pip install rasterio==1.5.2
```

**cogeotiff/rio-tiler** (594 stars)

[cogeotiff/rio-tiler](https://github.com/cogeotiff/rio-tiler) 

```python
def point(
    src_dst: DatasetReader | DatasetWriter | WarpedVRT,
    coordinates: tuple[float, float],
    indexes: Indexes | None = None,
    coord_crs: CRS = WGS84_CRS,
    nodata: NoData | None = None,
    vrt_options: dict | None = None,
    out_dtype: str | numpy.dtype | None = None,
    resampling_method: RIOResampling = "nearest",
    reproject_method: WarpResampling = "nearest",
    interpolate: bool = False,
    unscale: bool = False,
    post_process: Callable[[numpy.ma.MaskedArray], numpy.ma.MaskedArray] | None = None,
) -> PointData:
    """Read a pixel value for a point.

    Args:
        src_dst (rasterio.io.DatasetReader or rasterio.io.DatasetWriter or rasterio.vrt.WarpedVRT): Rasterio dataset.
        coordinates (tuple): Coordinates in form of (X, Y).
        indexes (sequence of int or int, optional): Band indexes.
        coord_crs (rasterio.crs.CRS, optional): Coordinate Reference System of the input coords. Defaults to `epsg:4326`.
        nodata (int or float, optional): Overwrite dataset internal nodata value.
        vrt_options (dict, optional): Options to be passed to the rasterio.warp.WarpedVRT class.
        resampling_method (RIOResampling, optional): RasterIO resampling algorithm. Only used when `interpolate=True`. Defaults to `nearest`.
        reproject_method (WarpResampling, optional): WarpKernel resampling algorithm. Defaults to `nearest`.
        interpolate (bool, optional): Interpolate pixels around the coordinates. Defaults to `False`.
        unscale (bool, optional): Apply dataset's 'scales' and 'offsets' on output data value. Defaults to `False`.
        post_process (callable, optional): Function to apply on output data and mask values.

    Returns:
        PointData

    """
    indexes = cast_to_sequence(indexes)

    with contextlib.ExitStack() as ctx:
        # Use WarpedVRT when User provided Nodata or VRT Option (cutline)
        if nodata is not None or vrt_options:
            vrt_params = {
                "add_alpha": True,
                "resampling": Resampling[reproject_method],
                "dtype": src_dst.dtypes[0],
            }
            nodata = nodata if nodata is not None else src_dst.nodata
            if nodata is not None:
                vrt_params.update(
                    {"nodata": nodata, "add_alpha": False, "src_nodata": nodata}
                )

            if has_alpha_band(src_dst):
                vrt_params.update({"add_alpha": False})

            if vrt_options:
                vrt_params.update(**vrt_options)

            dataset = ctx.enter_context(WarpedVRT(src_dst, **vrt_params))

        else:
            dataset = src_dst

        lon, lat = coordinates
        if coord_crs != dataset.crs:
            xs, ys = transform_coords(coord_crs, dataset.crs, [lon], [lat])
            lon, lat = xs[0], ys[0]

        dataset_min_lon, dataset_min_lat, dataset_max_lon, dataset_max_lat = (
            dataset.bounds
        )
        # check if latitude is inverted
        if dataset_min_lat > dataset_max_lat:
            warnings.warn(
                "BoundingBox of the dataset is inverted (minLat > maxLat).",
                UserWarning,
            )

        dataset_min_lat, dataset_max_lat = (
            min(dataset_min_lat, dataset_max_lat),
            max(dataset_min_lat, dataset_max_lat),
        )
        if not (
            (dataset_min_lon < lon < dataset_max_lon)
            and (dataset_min_lat < lat < dataset_max_lat)
        ):
            raise PointOutsideBounds("Point is outside dataset bounds")

        if interpolate:
            # Ref: https://github.com/cogeotiff/rio-tiler/issues/793
            # https://github.com/OSGeo/gdal/blob/a3d68b069e6b3676ba437faca5dca6ae2076ce24/swig/python/gdal-utils/osgeo_utils/samples/gdallocationinfo.py#L185-L197
            rows, cols = rowcol(dataset.transform, xs=[lon], ys=[lat], op=lambda x: x)
            row, col = float(rows[0]), float(cols[0])
            row_off, col_off = row - 0.5, col - 0.5

        else:
            if resampling_method != "nearest":
                warnings.warn(
                    f"{resampling_method} resampling will be ignored when `interpolate=False`.",
                    UserWarning,
                )

            row, col = dataset.index(lon, lat)
            row_off, col_off = row, col

        window = windows.Window(row_off=row_off, col_off=col_off, width=1, height=1)

        img = read(
            dataset,
            indexes=indexes,
            window=window,
            out_dtype=out_dtype,
            resampling_method=resampling_method,
            unscale=unscale,
            post_process=post_process,
        )

        return PointData(
            img.array[:, 0, 0],
            band_names=img.band_names,
            band_descriptions=img.band_descriptions,
            coordinates=coordinates,
            crs=coord_crs,
            pixel_location=(col, row),
            nodata=img.nodata,
            metadata=img.metadata,
        )

```

[rio_tiler/reader.py](https://github.com/cogeotiff/rio-tiler/blob/f0197bfc5ec95215451bf401e0e0f3092b41e64e/rio_tiler/reader.py#L521-L644) · [More projects using Rasterio →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20rasterio%20for%20geospatial%20transformations%20and%20spatial%20analysis&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import rasterio

with rasterio.open("example.tif") as dataset:
    band = dataset.read(1)

```

From [quickstart.html](https://rasterio.readthedocs.io/en/stable/quickstart.html)

## FAQ

### Which Python geospatial library should I use?

[GeoPandas](#geopandas) suits most vector analysis, with geometry columns on a pandas DataFrame. [Shapely](#shapely) suits operations on individual geometries. [Rasterio](#rasterio) suits satellite images and other raster datasets.

### What is GeoPandas?

[GeoPandas](#geopandas) extends pandas with geometry columns, spatial operations, and reading and writing of geospatial files.

### What is Shapely?

[Shapely](#shapely) manipulates and analyzes geometric objects such as points, lines, and polygons in a Cartesian plane. [pyproj](#pyproj) handles transformations between coordinate systems.

### What is geopy?

[geopy](#geopy) is a geocoding toolbox that turns addresses into coordinates and coordinates into addresses through outside geocoding services.

### What is Rasterio?

[Rasterio](#rasterio) reads and writes geospatial raster datasets as NumPy arrays.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python geospatial libraries GeoPandas Shapely pyproj Rasterio code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
