The above map loads 1 raster and 1 vector layer in a serverless manner. Mouse over waterbody for more info. Click on map to load waterbody info near point of click.
Update: The CloudNativeMaps SDK is my latest iteration in serverless. Visualize an unlimited number of raster/vector data files without any intermediate servers/services. It requires cloud native data, your web browser and nothing more.
Update: This is a production map with 84 cloud native raster/vector layers that uses the methods outlined below. Read more about this specific map.
What is Serverless?
What are the benefits of Serverless?
The vast majority of maps on the internet are static raster/vector tiles/json served on backend servers using complex services, databases, bloated python/npm code, massive tile caches and expensive resources. Using Cloud Optimized GeoTIFF (COG) for raster and FlatGeoBuf (FGB) for lossless vector on static data negates the need for backend code and expensive resources.
When should Serverless be avoided?
In situations where on demand analysis between multiple/large datasets is needed, it's easy to overwhelm a client's resouces. While analysis can and should be done with serverless, it's a fine line when and where analysis should be done. Consider your own organization and you'll probably find much of what you do can be pushed onto the client and off backend servers.
In fact, here's an example of analysis on 2 very large cloud native vector sources, on the web client. The first is a 34GB FGB file of combined Google/Microsoft building footprints. The second is a 3.5GB national FEMA flood hazard zones. Clicking on a building footprint will show the area of the footprint and the flood zone(s) the footprint occupies.
Example analysis of 2 large cloud native vector layers
But, you need a tile cache!
That's exactly what COG is; it has overviews built in and acts as a tile cache. COG has grown wildly in the last few years. COG use range requests to extract part of a raster file out of cloud storage, this includes those small overviews that act as a tile cache. The above map uses a 1.5GB National Land Cover raster and the associated color table. Only overviews or small sections are used to draw the map layer depending on zoom and extent. The entire file is never downloaded. The inital load of the above map downloads < 1M of raster data.
FGB is an indexed vector data format. Like COG, range requests are used to extract part or all of the data. It's extremely fast. It can also be extremely slow if you request a large amount of data from the file.
Creating a COG from GeoTIFF or other raster type using GDAL:
gdalwarp -f COG -co COMPRESS=DEFLATE -t_srs EPSG:3857 nlcd.tif nlcd_cog.tif
Creating a FlatGeoBuf from shapefile or other vector type using GDAL:
ogr2ogr -f FlatGeobuf -nln waterbody -t_srs EPSG:4326 -nlt PROMOTE_TO_MULTI waterbody.fgb waterbody.shp
Data & Software
As mentioned, the above map uses a 1.5GB Land Cover raster COG and a 500MB National Hydro data vector FGB. Only CONUS named waterbodies are included. A single click on the map will load all waterbodies within .2 degree bounding box of the mouse click. Vanilla JavaScript packages used are: Leaflet, GeoRaster, GeoRaster-Layer-For-Leaflet and FlatGeoBuf-json.
Have Fun!
www.Postholer.com © 2005-2025 - W3C - @postholer