Skip to main content

A simple python module that converts a raster to a Pandas DataFrame.

Project description

Raster To DataFrame

PyPI Status Build Status Documentation Status Coverage Status

A simple python module that converts a raster to a Pandas DataFrame.

from rastertodataframe import raster_to_dataframe

raster_path = '/some/gdal/compatible/file.tif'
vector_path = '/some/ogr/compatible/file.geojson'

# Extract all image pixels (no vector).
df = raster_to_dataframe(raster_path)

# Extract only pixels the vector touches and include the vector metadata.
df = raster_to_dataframe(raster_path, vector_path=vector_path)

Features

  • Convert any GDAL compatible raster to a Pandas DataFrame.

  • Optionally, if any OGR compatible vector file is given, only pixels touched by the vector are extracted from the raster. The output DataFrame includes these pixels as well as any attributes from the vector file.

Installation

pip install rastertodataframe
  • A working GDAL/OGR installation is required. This is best accomplished with conda.

conda install -c conda-forge numpy gdal geopandas pandas pyproj

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.2.0 (2018-07-12)

  • Implement tiling to reduce memory use for large rasters.

0.1.3 (2018-07-09)

  • Remove dependencies to fix non-building installs.

0.1.2 (2018-07-09)

  • Fix creation of temporary files on windows.

0.1.1 (2018-07-08)

  • All logic implement with unit tests. Prepare for PyPI release.

0.1.0 (2018-07-07)

  • Project started.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rastertodataframe-0.2.0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rastertodataframe-0.2.0-py2.py3-none-any.whl (10.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file rastertodataframe-0.2.0.tar.gz.

File metadata

File hashes

Hashes for rastertodataframe-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0497764d13b74f9dd610e77b0bb27b26a4aa1e5b5c2c8cfc7001eecf80a80479
MD5 b0db874de63c7f67184e7ec2f4f8167d
BLAKE2b-256 8ee59a8b54267b3e93a3c122215ee4302fb9f27c4cf9c26d780dcd0814a0234b

See more details on using hashes here.

File details

Details for the file rastertodataframe-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for rastertodataframe-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 95085cde092c448115da71ca312f3e2cc1e85853d4b14cd35fb57cb693097ea1
MD5 8edee943732a2c760654079a463f1322
BLAKE2b-256 22d697b57a790ee0ae621519d1ef9d9a095ef21fe50b72050dcd2e4a7091368a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page