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.

Filename, size & hash SHA256 hash help File type Python version Upload date
rastertodataframe-0.2.0-py2.py3-none-any.whl (10.8 kB) Copy SHA256 hash SHA256 Wheel py2.py3
rastertodataframe-0.2.0.tar.gz (41.4 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page