# A native Julia package for satellite images?

**URL:** <https://discourse.julialang.org/t/a-native-julia-package-for-satellite-images/44689>\
**Category:** Geo\
**Created:** [August 10, 2020, 2:23pm UTC](https://discourse.julialang.org/t/a-native-julia-package-for-satellite-images/44689 "2020-08-10T14:23:29Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![JoshuaBillson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joshuabillson/32/52706_2.png) [@JoshuaBillson](https://discourse.julialang.org/u/JoshuaBillson)\
**Post date:** [September 5, 2023, 8:44pm UTC](https://discourse.julialang.org/t/a-native-julia-package-for-satellite-images/44689/21 "2023-09-05T20:44:54Z")

</div>

I realize this topic has been dormant for several months, but I thought the community may be interested in my new package [RemoteSensingToolbox](https://github.com/JoshuaBillson/RemoteSensingToolbox.jl). It’s been under development for several months, but since it’s starting to get some traction, I figured that now was a good time to formally introduce it.

`RemoteSensingToolbox` is a pure Julia Package built ontop of [Rasters.jl](https://github.com/rafaqz/Rasters.jl) with the goal of providing common tools for visualizing, processing, and analyzing remotely sensed imagery. I’m currently aiming to support the following features:

| Feature | Description | Implemented |
| --- | --- | --- |
| Visualization | Visualize images with various band combinations | ✅ |
| Land Cover Indices | Calculate indices such as MNDWI and NDVI | ✅ |
| QA and SCL Decoding | Decode Quality Assurance and Scene Classification masks | ✅ |
| Pixel Masking | Mask pixels to remove objects such as clouds or shadows | ✅ |
| PCA | Perform PCA analysis, transformation, and reconstruction | ✅ |
| MNF | Minimum Noise Fraction transformation and reconstruction | ✅ |
| Signature Analysis | Analyze spectral signatures for different land cover types | ✅ |
| Land Cover Classification | Expose an `MLJ` interface for classifying land cover types | ❌ |
| Endmember Extraction | Extract spectral endmembers from an image | ❌ |
| Spectral Unmixing | Perform spectral unmixing under a given endmember library | ❌ |

I’m currently working on a fairly major refactor to make the project more maintainable and to improve interop with existing Julia packages. For example, I’ve recently broken out a lot of the sensor-specific functionality to a separate package called `SatelliteDataSources`, which aims to provide a similar interface to `RasterDataSources`, but for satellite imagery. The idea is that you can request specific layers from a locally stored satellite product by name or color. You can also retrieve bands by color from a loaded `Raster` or `RasterStack`. The interface looks something like this:

```julia
# Load The Red, Green, and Blue Sentinel 2 Bands At 10m Resolution
RasterStack(Sentinel2{10}, "data/L2A_T11UPT_A017828_20200804T184659/", [:red, :green, :blue])

# Load The SCL Layer At 60m Resolution
Raster(Sentinel2{60}, "data/L2A_T11UPT_A017828_20200804T184659/", :SCL)

# Load All Sentinel 2 Bands With 10m Resolution, Then Compute NDWI
sen = RasterStack(Sentinel2{10}, "data/L2A_T11UPT_A017828_20200804T184659/")
g = green(Sentinel2{10}, sen) .* 0.0001f0 # Get green band and convert DNs to reflectance
n = nir(Sentinel2{10}, sen) .* 0.0001f0 # Get NIR band and convert DNs to reflectance
ndwi = (g .- n) ./ (g .+ n)

```

This low-level functionality is what allows `RemoteSensingToolbox` to support generic code like the following:

```julia
# Visualize a landsat scene using a true color band combination
visualize(landsat, TrueColor{Landsat8}; upper=0.90)

# Visualize a landsat scene using the agriculture band combination
visualize(landsat, Agriculture{Landsat8}; upper=0.90)

# Convert Digital Numbers (DNs) to reflectance
landsat_sr = dn_to_reflectance(Landsat8, landsat)

# Calculate the MNDWI from a Landsat 8 scene
index = mndwi(landsat, Landsat8)

```

This is very much a work in progress and new features are being added on a regular basis. I’m also refactoring the package to make sensor types like `Landsat8` or `Sentinel2{10}` the first argument to all methods for the sake of consistency. After that, I’ll probably look into adding support for `GeoStats.jl` for land cover classification. Feel free to open new GitHub issues to discuss features you want to see or to influence the discussion on our development going forward.

[Previous page](https://discourse.julialang.org/t/a-native-julia-package-for-satellite-images/44689.md?page=1)
