Mapping

How to Add LIDAR Hillshade to Your LeafletJS Map

How to Add LIDAR Hillshade to Your LeafletJS Maps

Using the 3DEP Hillshade and some CSS3, it’s quite easy to add beautiful, LIDAR-generated hillshade to LeafletJS Maps.

A few things to note …

  • This is not mobile friendly, as it uses a lot of CPU for the mix-blend-mode, so you may want to disable for mobile browsers
  • Areas without hillshade (e.g. the ocean) are shown as black, so you won’t want to use this for large scale maps

Here is a simple example of how to do this with NY Aerial Orthophotography:

<html>
  <head>
    <title>Example</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px;
      }
     
     .lidarBase {
		 filter: brightness(140%) contrast(100%) !important; 
		 // this filter raises brightness and contrast for better appearance
	 }
      
    .baseLayer  {
		mix-blend-mode: multiply !important;
		// usually a nice way to blend the hillshade with the overlay
	}
	
	.nyAerial {
		filter: saturate(150%) contrast(110%) brightness(130%);
		// enhance colors a bit
	}
    </style>

    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css">
    <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>

  </head>
  <body>	  
    <div id="map-canvas"></div>
          <script>
          
var nyAerial =	L.tileLayer.wms(
	'https://orthos.its.ny.gov/ArcGIS/services/wms/Latest/MapServer/WMSServer?', 
	{ layers: '0,1,2,3,4,5', 
	attribution: 'NYS High-Resolution Color Aerial (Winter 2015-2020) - <a href="https://gis.ny.gov/">NYS Geographic Information Services</a>', 
	className: 'nyAerial',
	maxZoom: 21 });

var lidarBase =	L.tileLayer.wms(
	'https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer?', 
	{ 
		layers: '3DEPElevation:Hillshade Gray',
		className: 'lidarBase',
	}
);

var map = L.map('map-canvas', {
			center: [42.37348470, -76.88088670],
			zoom: 17,
			layers: [lidarBase,nyAerial]
		});
		
</script>
</body>
</html>

Here is the produced map with this code:

Why so many maps?

Why so many maps?

Well for one, I am really loving how easy it to make interactive maps with Leaflet, and I keep hacking away at the code to improve presentation and meaning. I really enjoy exploring the land surface and use of land, and there are seemingly endless places I can explore and share on the blog. Plus, with once the code is written, creating new leaflet maps is easy enough – just scroll and feed the coordinates into the system, and it is displayed.

Running out of web maps

Running out of web maps πŸ•Έ

I concede at some point I will run out of places to tell stories about and make up web maps. But truth be told it’s pretty easy and there are so many interesting places to spot light that I don’t think it will happen right away.

Here is listing of the layers I currently use for making Interactive Leaflet maps on this blog

Here is listing of the layers I currently use for making Interactive Leaflet maps on this blog. πŸ—Ί

Background Layer WMS

  • USGS Aerial Photos (Summer, 2015-2020): https://basemap.nationalmap.gov/arcgis/services/USGSImageryOnly/MapServer/WMSServer?
  • USGS Hillshade: https://basemap.nationalmap.gov/arcgis/services/USGSShadedReliefOnly/MapServer/WMSServer?
  • USGS Hydrology: https://basemap.nationalmap.gov/arcgis/services/USGSHydroCached/MapServer/WMSServer?
  • USGS Topographic Map (Aerial Overlay, contemporary): https://basemap.nationalmap.gov/arcgis/services/USGSImageryTopo/MapServer/WMSServer?
  • USGS Topographic Map (National Map, contemporary): https://basemap.nationalmap.gov/arcgis/services/USGSTopo/MapServer/WMSServer?
  • Vermont High-Resolution Color Aerial (Summer, 2015-2020): https://maps.vcgi.vermont.gov/arcgis/services/EGC_services/IMG_VCGI_CLR_WM_CACHE/ImageServer/WMSServer?
  • NYS High-Resolution Color Aerial (Winter 2015-2020): https://orthos.its.ny.gov/ArcGIS/services/wms/Latest/MapServer/WMSServer?
  • NYS False Color Aerial (Winter 2014-2018): http://orthos.its.ny.gov/arcgis/services/wms/Latest_cir/MapServer/WMSServer?
  • NYS Aerial NAPP False Color (Winter 1994-1998): http://orthos.its.ny.gov/arcgis/services/wms/napp/MapServer/WMSServer?
  • Black Marble (Cities at Night): https://geoint.nrlssc.org/nrltileserver/wms/category/Imagery?
  • Blue/Black Marble 24-Hour: https://geoint.nrlssc.org/nrltileserver/wms/category/Imagery?

Background Layer XYZ Tiles

  • OpenStreetMap: https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
  • OpenTopoMap: https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png
  • US Forest Service Lands (Topographic): https://apps.fs.usda.gov/arcx/rest/services/EDW/EDW_FSTopo_01/MapServer/tile/{z}/{y}/{x}
  • USGS Digital Raster Graphic (Traditional Topographic, old paper): https://services.arcgisonline.com/arcgis/rest/services/USA_Topo_Maps/MapServer/WMTS/tile/1.0.0/USA_Topo_Maps/default/GoogleMapsCompatible/{z}/{y}/{x}.jpg
  • High-Resolution Aerial (contemporary): https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}
  • Blue/Black Marble 24-Hour: https://gibs-{s}.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Terra_CorrectedReflectance_TrueColor/default/default/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg
  • Blue/Black Marble 24-Hour: https://gibs-{s}.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Aqua_CorrectedReflectance_TrueColor/default/default/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg
  • Blue/Black Marble 24-Hour: https://gibs-{s}.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_SNPP_CorrectedReflectance_TrueColor/default/default/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg
  • Blue/Black Marble 24-Hour: https://gibs-{s}.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_NOAA20_CorrectedReflectance_TrueColor/default/default/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg
  • Blue/Black Marble 24-Hour: https://gibs-{s}.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_SNPP_DayNightBand_At_Sensor_Radiance/default/default/GoogleMapsCompatible_Level8/{z}/{y}/{x}.png
  • Blue/Black Marble 24-Hour: https://gibs-{s}.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Terra_EVI_8Day/default/default/GoogleMapsCompatible_Level9/{z}/{y}/{x}.png
  • Blue/Black Marble 24-Hour: https://gibs-{s}.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Combined_MAIAC_L2G_AerosolOpticalDepth/default/default/GoogleMapsCompatible_Level7/{z}/{y}/{x}.png

Overlay Layer WMS

  • NYS DEC Lands: http://gisservices.its.ny.gov/arcgis/services/dec_lands/MapServer/WMSServer?
  • NYS Roads and Trails: http://gisservices.its.ny.gov/arcgis/services/dec_trails/MapServer/WMSServer?
  • National Forest Lands: https://apps.fs.usda.gov/arcx/services/EDW/EDW_BasicOwnership_02/MapServer/WMSServer?
  • National Forest Roads: https://apps.fs.usda.gov/arcx/services/EDW/EDW_RoadBasic_01/MapServer/WMSServer?
  • National Forest Trails: https://apps.fs.usda.gov/arcx/services/EDW/EDW_TrailNFSPublish_01/MapServer/WMSServer?
  • National Forest Recreational Opporunities: https://apps.fs.usda.gov/arcx/services/EDW/EDW_RecreationOpportunities_01/MapServer/WMSServer?
  • NYS Schools: http://gisservices.its.ny.gov/arcgis/services/NYS_Schools/MapServer/WMSServer?
  • NYS COVID Clusters: http://gisservices.its.ny.gov/arcgis/services/COVID19_ClusterZones/MapServer/WMSServer?
  • Watersheds: https://hydro.nationalmap.gov/arcgis/services/wbd/MapServer/WMSServer?
  • FWS Regulated Wetlands: https://www.fws.gov/wetlands/arcgis/services/Wetlands/MapServer/WMSServer?
  • 100 and 500 Year Flood Plain: http://gisservices.its.ny.gov/arcgis/services/gas_station/MapServer/WMSServer?
  • NY State Owned Lands: http://gisservices.its.ny.gov/arcgis/services/NYS_Tax_Parcels_State_Owned/MapServer/WMSServer?
  • NOAA Snow Depth: http://idpgis.ncep.noaa.gov/arcgis/services/NWS_Observations/NOHRSC_Snow_Analysis/MapServer/WMSServer?
  • NOAA Radar: http://idpgis.ncep.noaa.gov/arcgis/services/NWS_Observations/radar_base_reflectivity/MapServer/WMSServer?
  • NOAA Cloud Cover: https://nowcoast.noaa.gov/arcgis/services/nowcoast/forecast_meteoceanhydro_sfc_ndfd_time/MapServer/WMSServer?
  • NOAA Temperature: https://nowcoast.noaa.gov/arcgis/services/nowcoast/forecast_meteoceanhydro_sfc_ndfd_time/MapServer/WMSServer?
  • NOAA Wind Chill: https://nowcoast.noaa.gov/arcgis/services/nowcoast/forecast_meteoceanhydro_sfc_ndfd_time/MapServer/WMSServer?
  • NOAA GEOS Visbile Clouds: https://nowcoast.noaa.gov/arcgis/services/nowcoast/sat_meteo_imagery_time/MapServer/WMSServer?
  • NOAA GEOS Longwave Infrared Clouds: https://nowcoast.noaa.gov/arcgis/services/nowcoast/sat_meteo_imagery_time/MapServer/WMSServer?
  • 8-14 Day Temperature Outlook): http://idpgis.ncep.noaa.gov/arcgis/services/NWS_Climate_Outlooks/cpc_8_14_day_outlk/MapServer/WMSServer?
  • National Land Cover Dataset 2016: https://www.mrlc.gov/geoserver/mrlc_display/wms?
  • NLCD Tree Canopy 2016: https://www.mrlc.gov/geoserver/mrlc_display/wms?
  • NLCD Tree Canopy Change 2016: https://www.mrlc.gov/geoserver/mrlc_display/wms?
  • NLCD Forest Date of Disturbance (Post-1988): https://www.mrlc.gov/geoserver/mrlc_display/wms?
  • NLCD Impervious Soils: https://www.mrlc.gov/geoserver/mrlc_display/wms?
  • NRCS Soils: https://sdmdataaccess.sc.egov.usda.gov/Spatial/SDM.wms?
  • NYS Street Addresses: http://gisservices.its.ny.gov/arcgis/services/SAM_Address_Points_Symbolized/MapServer/WMSServer?
  • NYS Streets: http://gisservices.its.ny.gov/arcgis/services/NYS_Streets/MapServer/WMSServer?
  • Census Street Overlay: https://tigerweb.geo.census.gov/arcgis/services/TIGERweb/tigerWMS_PhysicalFeatures/MapServer/WMSServer?
  • Nat. Map Landmarks: https://carto.nationalmap.gov/arcgis/services/structures/MapServer/WMSServer?
  • NYS Places: https://gisservices.its.ny.gov/arcgis/services/NYS_Place_Points/MapServer/WmsServer?
  • NYS Tax Parcels: http://gisservices.its.ny.gov/arcgis/services/NYS_Tax_Parcels_Public/MapServer/WMSServer?
  • Elevation Contours (DRG/1950s): https://carto.nationalmap.gov/arcgis/services/contours/MapServer/WMSServer?
  • 3DEPElevation: Hillshade Gray: https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer?
  • 3DEPElevation:Aspect Degrees: https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer?
  • 3DEPElevation: Hillshade Elevation Tinted: https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer?
  • 3DEPElevation: Slope Map: https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer?
  • 3DEPElevation:Slope Degrees: https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer?
  • Geology of United States: https://carto.nationalmap.gov/arcgis/services/structures/MapServer/WMSServer?
  • Protected Lands (Overview): https://gis1.usgs.gov/arcgis/rest/services/padus2/all_fee_managers/MapServer?
  • Municipalities: https://tigerweb.geo.census.gov/arcgis/services/TIGERweb/tigerWMS_Current/MapServer/WMSServer?
  • Counties: https://tigerweb.geo.census.gov/arcgis/services/TIGERweb/tigerWMS_Current/MapServer/WMSServer?
  • States: https://tigerweb.geo.census.gov/arcgis/services/TIGERweb/tigerWMS_Current/MapServer/WMSServer?

Overlay Layer XYZ Tiles

  • VIIR SNPP Night Time: https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/VIIRS_SNPP_DayNightBand_At_Sensor_Radiance/default/default/GoogleMapsCompatible_Level8/{z}/{y}/{x}.png
  • MODIS Terra Vegetation Index: https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Terra_EVI_8Day/default/default/GoogleMapsCompatible_Level9/{z}/{y}/{x}.png
  • MODIS Aerosols – Air Pollution: https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/MODIS_Combined_MAIAC_L2G_AerosolOpticalDepth/default/default/GoogleMapsCompatible_Level7/{z}/{y}/{x}.png
  • Carbon Monoxide AIRS/Aqua: https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/AIRS_L2_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Day/default/default/GoogleMapsCompatible_Level6/{z}/{y}/{x}.png
  • UV Index at Noon: https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/OMI_UV_Index/default/default/GoogleMapsCompatible_Level6/{z}/{y}/{x}.png
  • MODIS Terra Vegetation Index: https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/LIS_ISS_Flash_Count/default/default/GoogleMapsCompatible_Level6/{z}/{y}/{x}.png
  • Reference Labels (OSM): https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/Reference_Labels/default/default/GoogleMapsCompatible_Level9/{z}/{y}/{x}.png
  • Reference features (OSM): https://gibs.earthdata.nasa.gov/wmts/epsg3857/best/Reference_Features/default/default/GoogleMapsCompatible_Level9/{z}/{y}/{x}.png
  • Easements and Protected Lands: https://gis1.usgs.gov/arcgis/rest/services/padus2/protection_mechanism_category/MapServer/WMTS/tile/1.0.0/padus2_protection_mechanism_category/default/default028mm/{z}/{y}/{x}.png
  • OpenStreetMap Overlay: https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png