UNPKG

agentscript

Version:

AgentScript Model in Model/View architecture

40 lines (28 loc) 1.03 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 </script> <div id="map"></div> </body> </html>