Public
Edited
Oct 2, 2024
9 stars
Insert cell
Insert cell
Insert cell
// loading geoblaze is as simple as this
geoblaze = require("geoblaze@1.1.0");
Insert cell
## Use Case 1: Calculating the Population of Boston
Insert cell
Demographic analysis is a perfect example of how cloud optimization can speed up analysis. Gridded demographic data is often provided in large files that cover a country, large area, or the whole globe! In our case, we are going to be using a Global Human Settlement Layer COG of the whole globe and looking at calculating the population (sum of pixels) within a small hub, the city of Boston.
Insert cell
bostonBoundary = fetch("https://geoblaze.s3.amazonaws.com/City_of_Boston_Boundary.geojson").then(response => response.json())
Insert cell
GHS_POP_E2015_GLOBE_R2019A_4326_9ss_V1_0 = geoblaze.parse("https://georaster-layer-for-leaflet.s3.amazonaws.com/GHS_POP_E2015_GLOBE_R2019A_4326_9ss_V1_0.tif")
Insert cell
pop = geoblaze.sum(GHS_POP_E2015_GLOBE_R2019A_4326_9ss_V1_0, bostonBoundary)
Insert cell
Insert cell
### how did this work?
We used HTTP Range Requests (also known as partial read requests) to get pixels from the area we want.
Insert cell
Insert cell
Insert cell
GeoRasterLayer = require("georaster-layer-for-leaflet")
Insert cell
Insert cell
Insert cell
geoblaze.stats(GHS_POP_E2015_GLOBE_R2019A_4326_9ss_V1_0, bostonBoundary)
Insert cell
## Use Case 2: Summary Pixel Statistics
Insert cell
Sometimes you will want to compute statistics on a select area within an image. For example, this is an image from Planet covering Rosenberg, Texas near Houston after Hurricane Harvey. In this example, we will compute statistics for the downtown area of Rosenberg.
Insert cell
// load the Cloud Optimized GeoTIFF
hurricane_harvey_cog = geoblaze.parse("https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/20170831_172754_101c_3b_Visual.tif")
Insert cell
hurricane_harvey_cog.projection
Insert cell
This Cloud Optimized GeoTIFF uses a Universal Transverse Mercator (UTM) Projection! GeoBlaze supports analysis on COGs of all standard projections. It does this by re-projecting the given AOI geometry to the projection system of the COG.
Insert cell
aoi = ({ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [ -95.82026481628418, 29.554494451851024 ], [ -95.79082489013672, 29.554494451851024 ], [ -95.79082489013672, 29.560467315000032 ], [ -95.82026481628418, 29.560467315000032 ], [ -95.82026481628418, 29.554494451851024 ] ] ] } } ] })
Insert cell
{
const container = DOM.element('div', { style: `width:${width}px; height:350px` })
const map = L.map(container, { scrollWheelZoom: false });
const aoiLayer = L.geoJson(aoi).addTo(map);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map);
const lyr = new GeoRasterLayer({ georaster: hurricane_harvey_cog, resolution: 256 }).addTo(map);
yield container;
map.fitBounds(aoiLayer.getBounds());
map.setZoom(map.getZoom() - 1)
}
Insert cell
geoblaze.stats(hurricane_harvey_cog, { srs: 4326, geometry: aoi })
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more