Skip to main content

Convert georeferenced Geotiff or any spatial raster format to machine learning ready data.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raster2ML-0.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file raster2ML-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: raster2ML-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for raster2ML-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d3f65dfaf3d45a8cbe11e18e6637e80d48535dba8fc0dda907db116f766bc0e
MD5 f026998f7ac7eaed172c0716da0090af
BLAKE2b-256 02cb3fcdc6f905832ecb9e5eede57f58d6eced6b84bc3abc664bb837f7969ddd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page