UNPKG

agentscript

Version:

AgentScript Model in Model/View architecture

37 lines (26 loc) 1.14 kB
<html> <head> <title>USCounties</title> </head> <body> <div id="map"></div> <script type="module"> import * as mltools from './mltools.js' import statecodes from '../models/data/statecodes.js' import uscounties from 'https://backspaces.s3.amazonaws.com/uscounties.json' with { type: 'json' } import usstates from 'https://backspaces.s3.amazonaws.com/usstates.json' with { type: 'json' } const usaCenter = mltools.usaCenter const terrain = mltools.terrain('usgs') const map = await mltools.newMap(usaCenter, 4) mltools.addRasterLayer(map, 'terrain', terrain) mltools.addGeojsonFillLayer(map, 'countiesFill', uscounties, 'orange', 0.3) mltools.addGeojsonLineLayer(map, 'countiesBorder', 'countiesFill', 'red', 2) mltools.addGeojsonLineLayer(map, 'usstates', usstates, 'blue') const msg = props => props.NAME + ', ' + statecodes[props.STATE].name mltools.addLayerClickPopup(map, 'countiesFill', msg, 'bottom-left') mltools.addLayerCursor(map, 'countiesFill') </script> </body> </html>