Tool to convert rasters to points
Project description
raster2points
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.
Installation and Dependencies
This module uses rasterio and requires GDAL>=1.11
.
Use pip to install.
pip install raster2points
CLI Usage:
raster2csv.py [-h]
[--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, 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, separator="\t", calc_area=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
raster2points-0.1.3.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for raster2points-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed4b60f020d158d025a133b80a81292c1b0483524c5f47ead373de7911a26019 |
|
MD5 | 49ab8714794ca5066757cfacaf1e3cf1 |
|
BLAKE2b-256 | e359a2710eb989e7722a8af13a7812dd620d6795dcfea5ca9cdd640bbd189ce1 |