RasterFlow_S2_Mosaic.ipynb), but swaps satellite imagery for NAIP’s sub-meter aerial imagery.
Built-in NAIP datasets
RasterFlow ships four built-in NAIP datasets, selectable by name in thebuild_mosaics task’s datasets input. They come from NAIP’s two imagery products, each at 30 cm and 60 cm, and all of them store 8-bit (Byte) values:
This notebook uses the RGB datasets. They are what the Tile2Net, Meta CHM and SAM3 recipes run on, and with three bands instead of four there is less imagery to read and store. The RGB product uses lossy JPEG compression, so use a 4-band dataset when you need near-infrared (for example for NDVI or false-color views), exact pixel values, or a model that takes near-infrared, such as ChesapeakeRSC.
A built-in mosaic’s bands are labeled
<dataset>:<band> — for example naip_rgb_30cm:red, naip_rgb_30cm:green and naip_rgb_30cm:blue. The 4-band datasets add a nir band, as in naip_30cm:nir.
NAIP is flown state-by-state on a multi-year cycle, and the available resolution varies by state and year. RasterFlow selects imagery for the requested resolution and date window from its built-in NAIP index; if a location has no imagery at the requested resolution in that window, the mosaic will be empty. We use two AOIs below, each chosen because it has coverage at the target resolution:
- 30 cm → College Park, MD (2023) — the AOI from the SAM3 notebook.
- 60 cm → Nashua, NH (2021) — the AOI from the CHM notebook.
Setup and Imports
Using the Wherobots Tasks API
Each RasterFlow workflow runs as a task through the Wherobots Python SDK.run_task below starts a task run, waits for it to finish, and returns the URI of its output. Call wb.tasks.get("<task name>").input_schema to see every input a task accepts.
30 cm NAIP mosaic — College Park, MD
We build a 30 cm RGB NAIP mosaic over College Park, Maryland using the built-innaip_rgb_30cm dataset. College Park has 30 cm NAIP coverage in 2023, so we use a date window covering that year. (This is the same AOI used in the SAM3 notebook, RasterFlow_SAM3.ipynb.)
Preview: example mosaic
A pre-generated NAIP 30 cm optimized mosaic over College Park is available in the Wherobots Cloud map viewer, so you can see the kind of output this section builds without waiting for the build to finish. View the interactive map here.Note: This pre-generated sample was built from the 4-band NAIP product via the GTI approach (seeRasterFlow_Bring_Your_Own_Rasters_NAIP.ipynb), so its store also holds a near-infrared band and its bands are labeledr/g/b/ir. The preview renders only the RGB bands. A mosaic you build with the built-innaip_rgb_30cmdataset has only the three RGB bands, labelednaip_rgb_30cm:red/naip_rgb_30cm:green/naip_rgb_30cm:blue.
Selecting the Area of Interest (AOI)
We use College Park, Maryland — an urban/suburban area in the Northeastern US with recent 30 cm NAIP coverage.Building the 30 cm mosaic
This step builds an RGB NAIP mosaic at 30 cm resolution using the built-innaip_rgb_30cm dataset. RasterFlow queries its built-in index of the RGB product for 30 cm imagery intersecting the AOI within the date window, reprojects/resamples into the target CRS, and mosaics the tiles into a Zarr store with red, green, and blue bands.
Note: This step can take several minutes to complete. If you already have a pre-built mosaic store, you can skip this build by assigning its URI directly in the next cell.
Build an optimized Zarr and visualize the output
RasterFlow writes its outputs as Zarr stores at native resolution, which isn’t ideal for interactive viewing — every pan or zoom would have to stream full-resolution pixels.build_zarr_multiscales adds downsampled overview levels (image pyramids) so the map can stream coarse tiles when zoomed out and full-resolution pixels when zoomed in. This typically takes a few minutes for large outputs.
Once built, open it in the Wherobots Cloud map viewer with a cloud.wherobots.com/map link to the store’s URI.
Pass aoi to select a chunk-aligned bounding window from a single Zarr source. It accepts polygon or multipolygon WKT in EPSG:4326, or an S3 GeoJSON or GeoParquet URI with a CRS. Pixels outside the polygon remain within that rectangular window. Omit aoi to process the full store.
60 cm NAIP mosaic — Nashua, NH
Thenaip_rgb_60cm dataset builds a mosaic from NAIP’s 60 cm RGB imagery. Pick 60 cm over 30 cm when:
- You need coverage for a year or location that wasn’t flown at 30 cm — 60 cm imagery is available for more states and more years.
- You’re mosaicking a large area and want smaller outputs and faster builds — 60 cm imagery is roughly a quarter of the pixels of 30 cm.
RasterFlow_CHM.ipynb.)
Preview: example mosaic
A pre-generated 60 cm NAIP mosaic over Nashua, NH is available in the Wherobots Cloud map viewer. It was built from the 4-band NAIP product, so its store also holds a near-infrared band; a mosaic you build withnaip_rgb_60cm has only red, green, and blue.
View the interactive map here.
Selecting the AOI and building the mosaic
We build the Nashua mosaic withnaip_rgb_60cm the same way as the 30 cm mosaic above. As in the 30 cm example above, you can add an additional cell to pass the resulting store to build_zarr_multiscales and open it in the Wherobots Cloud map viewer to view your freshly built output.
Summary
This notebook demonstrated how to:- Build a 30 cm RGB NAIP aerial mosaic over College Park, MD with the built-in
naip_rgb_30cmdataset - Optimize the Zarr store with overviews and open it in the Wherobots Cloud map viewer
- Build a 60 cm RGB NAIP mosaic over Nashua, NH with
naip_rgb_60cm
Next steps
- Compare a NAIP mosaic with the Sentinel-2 mosaic over the same AOI (see
RasterFlow_S2_Mosaic.ipynb) - Run a model on the NAIP mosaic — for example text-prompted object detection with SAM3 on the College Park mosaic (
RasterFlow_SAM3.ipynb) or tree canopy height with Meta CHM on the Nashua mosaic (RasterFlow_CHM.ipynb) - Use the mosaic as input for model inference using the
run_mosaic_inferencetask - Build a 4-band mosaic with
naip_30cmornaip_60cmwhen you need the near-infrared band, for example to compute NDVI

