UNPKG

agentscript

Version:

AgentScript Model in Model/View architecture

47 lines (33 loc) 1.25 kB
<html> <head> <title>VectorMap</title> </head> <body> <script type="module"> import * as gis from '../src/gis.js' import * as mltools from './mltools.js' const bbox = gis.santaFeBBox let zoom = 10 // int for computing usages, maplibre uses fractional zooms // ===== Start of map & layers // terrain sources: osm topo topo1 smooth usgs // elevation sources: mapzen maptiler redfishUSA redfishWorld mapbox const terrain = gis.template('usgs') const contour = gis.template('contour') const elevation = gis.elevationTemplate('mapzen') const map = await mltools.newMap(bbox, zoom) mltools.showTileBoundaries(map) mltools.addRasterLayer(map, 'terrain', terrain) mltools.addRasterLayer(map, 'elevation', elevation, 0.25) mltools.addVectorLayer(map, 'contour', contour, 'red', 2) const msg = props => 'height: ' + props.height + ', nth line: ' + props.nth_line mltools.addLayerMovePopup(map, 'contour', msg) // ===== End of map & layers mltools.startupMessage( 'Hover the mouse over the red vector lines for information.' + '\nThis layer uses vector tiles rather than the usual raster tiles' + '\nYou can use the return key to remove this' ) </script> <div id="map"></div> </body> </html>