Skip to main content

raster2ML

Purpose

raster2ML is a utility designed to process a Raster file and its corresponding shapefile to produce a raster mask file. The mask assigns class names based on the specified field in the shapefile.

Output

The result is an 8-bit PNG file where each distinct class from the shapefile is represented by a different color.

Usage

1. raster2png:

Converts a Raster image into an 8-bit PNG.

Command:

test_raster2png.py [-h] src_raster output_folder

Example:

!python tutorial/test_raster2png.py tutorial/in_folder/myraster.tif tutorial/out_folder

View Source Code

2. shp2labelme:

Generate a labelme JSON structure using raster and shapefile data.

Command:

test_shp2labelme.py [-h] raster_file shapefile_path label_field

Example:

!python tutorial/test_shp2labelme.py tutorial/out_folder/myraster_8bit.png tutorial/in_folder/myvector.shp idlin

View Source Code

3. labelme2mask:

Defines a set of functions that transform a given labelme JSON file into a labeled image (mask).

Command:

test_labelme2mask.py [-h] source_json_file target_folder

Example:

!python tutorial/test_labelme2mask.py tutorial/out_folder/myraster_8bit.json tutorial/out_folder

View Source Code

Dependencies

Ensure you have all the necessary dependencies installed. Refer to requirements.txt for a list of required packages.

Release files for raster2ML 0.1.1

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

Built distribution (wheel)

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

Release files / raster2ML-0.1.1-py3-none-any.whl

Download URL raster2ML-0.1.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d3f65dfaf3d45a8cbe11e18e6637e80d48535dba8fc0dda907db116f766bc0e
BLAKE2b-256 checksum
How to use checksums
02cb3fcdc6f905832ecb9e5eede57f58d6eced6b84bc3abc664bb837f7969ddd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

2 release files

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