Primary competition visual

Farm Pin Crop Detection Challenge

Helping South Africa
$11 000 USD
Challenge completed over 6 years ago
Classification
Earth Observation
1458 joined
42 active
Starti
Mar 04, 19
Closei
Sep 15, 19
Reveali
Sep 16, 19
Getting started - masking out the images
Help · 6 Jun 2019, 12:26 · 3

Hey guys :)

I wanted to share some resources for everyone who is struggling to get started. Specifically, the thing that I struggled with the most at first was using the shapefiles to extract the data from the different spectral bands. So I'll try to share with you how I figured that out and hopefully start a discussion where we can share ideas for getting up and running with this comp.

Two disclaimers - 1) that I am TOTALLY new to GIS, so take what I say with a grain of salt 2) I'm not going to give you any code or solutions. In order to learn, we need to struggle a bit, but having someone point you in the right direction can make learning much faster and a lot more fun ;)

Seeing as I'm new to GIS, and that my main goal with competing on Zindi is to learn cool new stuff, I started off by doing a short course on GIS for Python (link below). This course really helped me grep the basics, like coordinate systems (which came in handy), and the tools available in this ecosystem.

Specifically, on the 5th day (dont skip there though) they teach you how to mask a raster using rasterio. That is exactly what you want to do in the case of this competition, so pay careful attention here. For some more info, I've added a link to the documentation on rasterio's webpage for how to mask a raster.

Try those things and you should be able to get the raw pixel values of of each of the spectral bands as numpy arrays. What you do with those numpy arrays is up to you, and IMO the most fun part of all of this.

Good luck and pop a reply if this helped you get started ^_^

Intro to GIS Course: https://automating-gis-processes.github.io/CSC/index.html

Masking example: https://rasterio.readthedocs.io/en/stable/topics/masking-by-shapefile.html

Discussion 3 answers

Great thank you very much.

6 Jun 2019, 15:46
Upvotes 0

Thanks @RenierBotha, I have a question, were you able to crop the masks? When I do this :-

mask(src, [new_polygon], crop=True)

where crop = True I get the following error:

Input shapes do not overlap raster.

Note: The CRS of both the src and shapefile have been converted to be the same.