Skip to main content

raster2points

Codacy Badge

Convert one or multiple raster images to points. Tool will read first input raster and extract lat/lon coordinates and values for all pixels which have data. Optional it calculates geodesic area for each point based on pixel size. Successive input rasters will use data mask from first input raster.

Returns a Pandas dataframe, CLI will export results as CSV file.

Input files can be local file paths or S3 paths, or a mix. For reading from S3, you'll need AWS credentials configured, such as with a profile in ~/.aws and an AWS_PROFILE variable in your environment.

Multi-worker only works with S3 inputs, not local files.

Installation and Dependencies

This module uses rasterio and requires GDAL>=1.11. Use pip to install.

pip install raster2points

CLI Usage

raster2csv.py   [-h]
                [--col_names COL_NAMES [COL_NAMES ...]]
                [--separator {,,;,t}]
                [--max_block_size MAX_BLOCK_SIZE]
                [--calc_area [CALC_AREA]]
                [--workers WORKERS]
                INPUT [INPUT ...]
                OUTPUT

Python Usage

You can also use the module directly in python. It will return a Pandas dataframe with your data.

Get Pandas data frame

from raster2points import raster2df

raster1 = "path/to/file1.tif"
raster2 = "path/to/file2.tif"

df = raster2df(raster1, raster2, col_names=["name1", "name2"], calc_area=True)

print(df.columns)
print(df.dtypes)

df.head()

Export to TSV

from raster2points import raster2csv

raster1 = "path/to/file1.tif"
raster2 = "path/to/file2.tif"
output = "path/to/newfile.tsv"

raster2csv(raster1, raster2, output, col_names=["name1", "name2"], separator="\t", calc_area=True)

Metadata

Release files for raster2points 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raster2points 0.1.9
File Size Uploaded Provenance Actions
raster2points-0.1.9.tar.gz 6.2 kB Without provenance Details for raster2points-0.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for raster2points 0.1.9
File Interpreter ABI Platform Actions
raster2points-0.1.9-py3-none-any.whl Python 3 none any Details for raster2points-0.1.9-py3-none-any.whl

Total release size: 15.5 kB

Release files / raster2points-0.1.9.tar.gz

Download URL raster2points-0.1.9.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d39ae9a68475de76bb04f0213d4fc919391d2bdc60f96e149e4e86430aca1d2b
BLAKE2b-256 checksum
How to use checksums
4b4aba9b191024f523fc7f4da119f8c19b3bc4cb9bc3e266167ffef40006c902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Release files / raster2points-0.1.9-py3-none-any.whl

Download URL raster2points-0.1.9-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51dfb3ebb5ca19d73dec245fa54aa4ae794dc461d0b8f4d56820d61304ae635c
BLAKE2b-256 checksum
How to use checksums
f7327b61a3f4a5eedb7d8fb50a01869c62ec8e2d60241742ba8a07695018aef3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

Security for raster2points 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page