Skip to main content

Satellie extraction and cutter

Project description

Introduction

This python code is intended to automate/make easier the data extraction and cutting of satellite data from the netherlands space office (NSO). NSO provides free satellite images from the Netherlands, a downside however is that the NSO provides a very large region and as such a very large data file. This leads to a unnecessary large amount of data, if you only want to study a smaller specific region.

This python code cuts a selected region out of the original satellite image, provided that the selected region is smaller than the original file. And then saves this cutout thus reducing the unnecessary saved data. While also calculating the Normalized difference vegetation index (NVDI, used in crop analysis) of the cutout region. We are working on extracting more variables on satellite images.

This image gives a illustration: Alt text

Getting Started

  1. Get a NSO account, register at https://satellietdataportaal.nl/register.php
  2. First get a GeoJSON file of the region you want to cut. Geojson.io can you help you with that.
  3. Make a instance of nso_geojsonregion with instance of the geojson region you have, where you want to store the cropped files and the NSO account based on step 0.
  4. Retrieve download links for the specific region you want to have.
  5. Download the found links.

Example code.

# This the way the import nso.
import satellite_images_nso.api.nso_georegion as nso
path_geojson = "/src/example/example.geojson"
# The first parameter is the path to the geojson, the second the map where the cropped satellite data will be installed
georegion = nso.nso_georegion(path_geojson,"/src/output/",\
                              YOUR_USER_NAME_HERE,\
                             YOUR_PASSWORD_HERE)

# This method fetches all the download links to all the satelliet images which contain region in the geojson.
links = georegion.retrieve_download_links()

# Downloads a satelliet image from the NSO, make a crop out of it so it fits the geojson region and calculate the NVDI index.
# The output will stored in the designated output folder.
georegion.execute_link(links[0])


# The sat_manipulator gives other handy transmations on satellite data.
import satellite_images_nso.api.sat_manipulator as sat_manipulator

# This function reads a .tif file, which is a format the satellite data is stored in,  and converts it to a pixel based geopandas dataframe.
# For machine learning purposes.
path_to_vector = "path/to/folder/*.tif"
geo_df_pixel = sat_manipulator.tranform_vector_to_pixel_gpdf(path_to_vector)

Installation.

Install this package with: pip install satellite_images_nso

Be sure you've installed GDAL already on your computer. Other python dependencies will install automatically (Fiona>=1.8.13, GDAL>=3.0.4, geopandas>=0.7.0, rasterio>=1.1.3 Shapely>=1.7.0)

Install GDAL on Windows

If you are a Windows user you have to install the GDAL dependency yourself via a wheels.

Instead install these wheels with pip install XXX.XX.XX.whl.

Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/ for the wheels of these depencies:

Depencencies are : "Fiona>=1.8.13", "GDAL>=3.0.4", "geopandas>=0.7.0","rasterio>=1.1.3","Shapely>=1.7.0"

Install GDAL on MacOS

Install GDAL by using Brew:
brew install GDAL

Run as a docker container

docker run -it --entrypoint bash dockerhubpzh/satellite_images_nso_docker

See: https://hub.docker.com/r/dockerhubpzh/satellite_images_nso_docker

Local development

Run rebuild.bat to build and install package on local computer.

Author

Michael de Winter

Daniel Overdevest

Yilong Wen

Project details


Download files

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

Source Distribution

satellite_images_nso-1.1.9.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

satellite_images_nso-1.1.9-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file satellite_images_nso-1.1.9.tar.gz.

File metadata

  • Download URL: satellite_images_nso-1.1.9.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for satellite_images_nso-1.1.9.tar.gz
Algorithm Hash digest
SHA256 d02c9599ccdb495adf81dd60ec92a574d56b3109ea486fc25d6b95e1ab342336
MD5 f416b814beb6f6ca2b5c7b05b1cab028
BLAKE2b-256 b9e61e5c63c7f48a47367dae7280af4cafbcfad07dfbbd0abb4628c5d25efd08

See more details on using hashes here.

File details

Details for the file satellite_images_nso-1.1.9-py3-none-any.whl.

File metadata

  • Download URL: satellite_images_nso-1.1.9-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for satellite_images_nso-1.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ad0c9670882db977bb2a0254ec5444e7fe007af773f0cfc4877ba6dd9364a9ab
MD5 6d2e8b03f676e8ed1e0f4781bf7aeae7
BLAKE2b-256 a14028324dc0cd04ea14cf0b3ea690cde89d8ed296e22ddb477d7a0e22a4f8e6

See more details on using hashes here.

Supported by

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