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.
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)
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
Built Distribution
File details
Details for the file raster2points-0.1.9.tar.gz
.
File metadata
- Download URL: raster2points-0.1.9.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d39ae9a68475de76bb04f0213d4fc919391d2bdc60f96e149e4e86430aca1d2b |
|
MD5 | 804527e82c9ba8973dc668a8c8a0d6ab |
|
BLAKE2b-256 | 4b4aba9b191024f523fc7f4da119f8c19b3bc4cb9bc3e266167ffef40006c902 |
File details
Details for the file raster2points-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: raster2points-0.1.9-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51dfb3ebb5ca19d73dec245fa54aa4ae794dc461d0b8f4d56820d61304ae635c |
|
MD5 | 46dd7d5c4cd230dba62cc17b6c1746c9 |
|
BLAKE2b-256 | f7327b61a3f4a5eedb7d8fb50a01869c62ec8e2d60241742ba8a07695018aef3 |