A distribution network across Curitiba, loaded from a FeatureCollection. Points become sized circles, the delivery zone is styled from its properties, and every feature gets a popup.
[longitude, latitude]. Everything else
in CargoCanvas uses [latitude, longitude]. The layer converts for you —
just don't mix the two up when writing data by hand.
style for paths,
pointToLayer for points, filter to exclude features, and
onEachFeature for interactions.
pointToLayer can return any layer — a Marker, a
CircleMarker, even a LayerGroup. Without it, points
become default markers.
Control with an
onAdd that returns an element. The legend at the bottom right is
thirteen lines.
addData(geojson) whenever your fetch resolves — the styling hooks apply to
the new features too.
import {CargoMap, TileLayer, GeoJSON, CircleMarker, Control, DomUtil} from 'cargocanvas';