Over in Planetary Computer land, we’re working on bringing Sentinel-5P into our STAC catalog.

STAC items require a geometry property, a GeoJSON object that describes the footprint of the assets. Thanks to the satellites’ orbit and the (spatial) size of the assets, we started with some…interesting… footprints:

That initial footprint, shown in orange, would render the STAC collection essentially useless for spatial searches. The assets don’t actually cover (most of) the southern hemisphere.

Pete Gadomski did some really great work to understand the problem and fix it (hopefully once and for all). As the satellite crosses the antimeridian, a pole, or both, naive approaches to generating a footprint fails. It takes some more complicated logic to generate a good geometry. That’s now available as antimeridian on PyPI. It produces much more sensible footprints:

Building Tools

The real reason I wanted to write this post was to talk about tool building. This is a common theme of the Oxide and Friends podcast, but I think spending time building these kinds of small, focused tools almost always pays off.

Pete had a handful of pathologic test cases in the antimeridian test suite, but I wanted a way to quickly examine hundreds of footprints that I got back from our test STAC catalog. There are probably already tools for this, but I was able to put one together in Jupyter in about 10 minutes by building on Jupyter Widgets and ipyleaflet.

You can see it in action here (using Sentinel-2 footprints rather than Sentinel 5-P):

We get a STAC footprint browser (connected to our Python kernel!) with a single, pretty simple function.

m = ipyleaflet.Map(zoom=3)
m.layout.width = "600px"
layer = ipyleaflet.GeoJSON()
m.add(layer)


@ipywidgets.interact(item: pystac.ItemCollection = items)
def browse(item: pystac.Item):
    shape = shapely.geometry.shape(item)
    m.center = tuple(shape.centroid.coords[0])[::-1]

    layer.data = item.geometry
    print(item.id, item.datetime.isoformat())

Using this browser, I could quickly scrub through the Sentinel-5P items with the arrow keys and verify that the footprints looked reasonable.

The demo for this lives in the Planetary Computer Examples repository, and you can view the rendered version.