Geospatial Analysis of Satellite Images - Masking regions

Hello everyone,

I have run into a problem that I am unable to solve, or even to get started on, and I am hoping some of you may know of a way to do this.

For a research project we have downloaded Landsat satellite images, and we have access to a geoJSON dataset with coordinates (polygons) which represent farm land. What we want to do is to mask everything in the image (give it the pixel value of 0) while retaining the pixels within those polygons. In this way we would have transformed a picture of an entire region (in our case of the country the Netherlands) into an image of the Netherlands in which you only see the areas of farmland.

The Landsat satellite images are geoTIFFs and contain rasterdata plus some geospatial data, such as the coordinate reference system (CRS) and the spatial extent data (what area of the world does this image cover). This can be used to transform geo-coordinates (as in the geoJSON file) into pixel locations [row, column] in the satellite image and vice versa.

The geoJSON files contain sets of coordinates that together mark the (farmland) area, see an example below.

What we want to do in KNIME is to transform these geoJSON coordinates into areas of pixels which we then retain in the image while every pixel outside of these areas is being set to pixel value of 0.

In python, which I am more familiar with, something like this is demonstrated here It shows a very simple example being done using one polygon to extract a part of the image (in our case we have multiple polygons and we do not want the crop=True because we want to keep the original image size).

Any help would be very much appreciated.

Kind regards,

Wouter

Here is an example of one set of coordinates in the geoJSON file

{
“type”: “MultiPolygon”,
“coordinates”: [
[
[
[
593382.0613257578,
5697800.022431435
],
[
593351.3846211357,
5697797.781335618
],
[
593345.0959035985,
5697876.534227
],
[
593373.6250270541,
5697885.913048923
],
[
593382.0613257578,
5697800.022431435
]
]
]
]
}