Skip to content

spatiallysaying/raster2ML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raster2ML

Raster2ML Logo

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 a different color represents each distinct class from the shapefile.

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.

Citation

If you use raster2ML in your research, please consider citing:

@misc{spatiallysaying_2023_raster2ML,
  title={raster2ML: [ Utility designed to process a Raster file and its corresponding shapefile to produce a raster mask file]},
  author={Durga Prasad, Dhulipudi},
  year={2023},
  url={https://github.com/spatiallysaying/raster2ML}
}

About

Given a Raster file and corresponding shapefile, raster mask file is created with class names per the specified shapefile field.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages