Sentinel models

This library was created to create input data for Neural Network based on Satellite images data. First use was on setninel2 satellite images but it will also work for other data sources. Library is in beta version still, some of the functionality may not be available.

Requirements

Use cases

Class Raster

This class allows to load data from various formats. Currently available are:

  • Shapefile (shp)
  • Geotiff (geotiff)
  • PNG (png)
  • WKT (wkt)

  • When the shape file or any other geometry format is loaded, it is converted into raster based on coordinates, Array size depends on pixel size and extent size. It can be passed via extent and pixel in options method.

    Loading from wkt

    wkt = "Polygon((110.0 105.0, 110.0 120.0, 120.0 120.0, 120.0 110.0, 110.0 105.0))"
    raster = Raster\
                .read\
                .format("wkt")\
                .load(wkt)
    raster.show()

    Loading from Shape File

    shape_path = "/tests/data/shapes/domy.shp"
    
    GeometryFrame.from_file(shape_path).show()
    """
     -----------------------------------------------------------------------
    |      id     |     cls     |                 geometry                 |
    ------------------------------------------------------------------------
    |      1      |      4      |   POLYGON ((559610.9241914469 4929878.   |
    ------------------------------------------------------------------------
    |      1      |      5      |   POLYGON ((559649.5178541846 4929868.   |
    ------------------------------------------------------------------------
    |      1      |      5      |   POLYGON ((559678.1483190297 4929851.   |
    ------------------------------------------------------------------------
    |      1      |      2      |   POLYGON ((559648.8379760745 4929819.   |
    ------------------------------------------------------------------------
    |      1      |      4      |   POLYGON ((559587.8988370569 4929857.   |
    ------------------------------------------------------------------------
    """
    raster = Raster\
                .read\
                .format("shp")\
                .load(shape_path)
    raster.show()

    To get raster value based on shape file column, use color_column attribute in options

    raster = Raster\
                .read\
                .format("shp")\
                .options(
                    pixel=Pixel(0.5, 0.5),
                    color_column="cls"
                ).load(shape_path)
    raster.show()

    To get different values for all records pass

    raster = Raster\
                .read\
                .format("shp")\
                .options(
                    all_unique="True"
                ).load(shape_path)
    raster.show()