rasterstats


Namerasterstats JSON
Version 0.19.0 PyPI version JSON
download
home_page
SummarySummarize geospatial raster datasets based on vector geometries
upload_time2023-05-29 13:37:57
maintainer
docs_urlhttps://pythonhosted.org/rasterstats/
author
requires_python>=3.7
licenseBSD-3-Clause
keywords gis geospatial geographic raster vector zonal statistics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            rasterstats
===========

|BuildStatus|_

``rasterstats`` is a Python module for summarizing geospatial raster datasets based on vector geometries.
It includes functions for **zonal statistics** and interpolated **point queries**. The command-line interface allows for
easy interoperability with other GeoJSON tools.

Documentation
-------------
For details on installation and usage, visit the documentation at `http://pythonhosted.org/rasterstats <http://pythonhosted.org/rasterstats/>`_.

What does it do?
----------------
Given a vector layer and a raster band, calculate the summary statistics of each vector geometry.
For example, with a polygon vector layer and a digital elevation model (DEM) raster, compute the
mean elevation of each polygon.

.. figure:: https://github.com/perrygeo/python-raster-stats/raw/master/docs/img/zones_elevation.png
   :align: center
   :alt: zones elevation

Command Line Quick Start
------------------------

The command line interfaces to zonalstats and point_query
are `rio` subcommands which read and write geojson features

.. code-block:: bash

    $ fio cat polygon.shp | rio zonalstats -r elevation.tif

    $ fio cat points.shp | rio pointquery -r elevation.tif

See the `CLI Docs <http://pythonhosted.org/rasterstats/cli.html>`_. for more detail.

Python Quick Start
------------------

For zonal statistics

.. code-block:: python

    >>> from rasterstats import zonal_stats
    >>> stats = zonal_stats("tests/data/polygons.shp", "tests/data/slope.tif")
    >>> stats[0].keys()
    dict_keys(['min', 'max', 'mean', 'count'])
    >>> [f['mean'] for f in stats]
    [14.660084635416666, 56.60576171875]

and for point queries

.. code-block:: python

    >>> from rasterstats import point_query
    >>> point = {'type': 'Point', 'coordinates': (245309.0, 1000064.0)}
    >>> point_query(point, "tests/data/slope.tif")
    [74.09817594635244]


Issues
------

Find a bug? Report it via github issues by providing

- a link to download the smallest possible raster and vector dataset necessary to reproduce the error
- python code or command to reproduce the error
- information on your environment: versions of python, gdal and numpy and system memory

.. |BuildStatus| image:: https://github.com/perrygeo/python-rasterstats/workflows/Rasterstats%20Python%20package/badge.svg
.. _BuildStatus: https://github.com/perrygeo/python-rasterstats/actions

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "rasterstats",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/rasterstats/",
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "gis,geospatial,geographic,raster,vector,zonal statistics",
    "author": "",
    "author_email": "Matthew Perry <perrygeo@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f8/e6/48de382414aeef85d6ac3eae6fbd0f09ee98ba4a7dfd84ddfb2a689353fb/rasterstats-0.19.0.tar.gz",
    "platform": null,
    "description": "rasterstats\n===========\n\n|BuildStatus|_\n\n``rasterstats`` is a Python module for summarizing geospatial raster datasets based on vector geometries.\nIt includes functions for **zonal statistics** and interpolated **point queries**. The command-line interface allows for\neasy interoperability with other GeoJSON tools.\n\nDocumentation\n-------------\nFor details on installation and usage, visit the documentation at `http://pythonhosted.org/rasterstats <http://pythonhosted.org/rasterstats/>`_.\n\nWhat does it do?\n----------------\nGiven a vector layer and a raster band, calculate the summary statistics of each vector geometry.\nFor example, with a polygon vector layer and a digital elevation model (DEM) raster, compute the\nmean elevation of each polygon.\n\n.. figure:: https://github.com/perrygeo/python-raster-stats/raw/master/docs/img/zones_elevation.png\n   :align: center\n   :alt: zones elevation\n\nCommand Line Quick Start\n------------------------\n\nThe command line interfaces to zonalstats and point_query\nare `rio` subcommands which read and write geojson features\n\n.. code-block:: bash\n\n    $ fio cat polygon.shp | rio zonalstats -r elevation.tif\n\n    $ fio cat points.shp | rio pointquery -r elevation.tif\n\nSee the `CLI Docs <http://pythonhosted.org/rasterstats/cli.html>`_. for more detail.\n\nPython Quick Start\n------------------\n\nFor zonal statistics\n\n.. code-block:: python\n\n    >>> from rasterstats import zonal_stats\n    >>> stats = zonal_stats(\"tests/data/polygons.shp\", \"tests/data/slope.tif\")\n    >>> stats[0].keys()\n    dict_keys(['min', 'max', 'mean', 'count'])\n    >>> [f['mean'] for f in stats]\n    [14.660084635416666, 56.60576171875]\n\nand for point queries\n\n.. code-block:: python\n\n    >>> from rasterstats import point_query\n    >>> point = {'type': 'Point', 'coordinates': (245309.0, 1000064.0)}\n    >>> point_query(point, \"tests/data/slope.tif\")\n    [74.09817594635244]\n\n\nIssues\n------\n\nFind a bug? Report it via github issues by providing\n\n- a link to download the smallest possible raster and vector dataset necessary to reproduce the error\n- python code or command to reproduce the error\n- information on your environment: versions of python, gdal and numpy and system memory\n\n.. |BuildStatus| image:: https://github.com/perrygeo/python-rasterstats/workflows/Rasterstats%20Python%20package/badge.svg\n.. _BuildStatus: https://github.com/perrygeo/python-rasterstats/actions\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Summarize geospatial raster datasets based on vector geometries",
    "version": "0.19.0",
    "project_urls": {
        "Documentation": "https://pythonhosted.org/rasterstats/",
        "Source Code": "https://github.com/perrygeo/python-rasterstats"
    },
    "split_keywords": [
        "gis",
        "geospatial",
        "geographic",
        "raster",
        "vector",
        "zonal statistics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0264ac8b537b3213740e875e0b3d8b8fe97ebf64a592803d44cefc381576c326",
                "md5": "86332328d50c040a65ec2dd38ab80092",
                "sha256": "d9196f8672fc56e23aa606f34a4e5449fdbcf8e0fb5bbb00f6c05b454e020994"
            },
            "downloads": -1,
            "filename": "rasterstats-0.19.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "86332328d50c040a65ec2dd38ab80092",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16991,
            "upload_time": "2023-05-29T13:37:55",
            "upload_time_iso_8601": "2023-05-29T13:37:55.189202Z",
            "url": "https://files.pythonhosted.org/packages/02/64/ac8b537b3213740e875e0b3d8b8fe97ebf64a592803d44cefc381576c326/rasterstats-0.19.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f8e648de382414aeef85d6ac3eae6fbd0f09ee98ba4a7dfd84ddfb2a689353fb",
                "md5": "7d6f2535cef903337f10ed9b96242f6e",
                "sha256": "066c44feb6f3936804a0c79d112271fa5bf5de0d5058823ab5c1e0047ab7bbbc"
            },
            "downloads": -1,
            "filename": "rasterstats-0.19.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7d6f2535cef903337f10ed9b96242f6e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 23434,
            "upload_time": "2023-05-29T13:37:57",
            "upload_time_iso_8601": "2023-05-29T13:37:57.654270Z",
            "url": "https://files.pythonhosted.org/packages/f8/e6/48de382414aeef85d6ac3eae6fbd0f09ee98ba4a7dfd84ddfb2a689353fb/rasterstats-0.19.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-29 13:37:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "perrygeo",
    "github_project": "python-rasterstats",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "rasterstats"
}
        
Elapsed time: 0.07134s