Circles, polygons, polylines and rectangles drawn over Curitiba, all rendered as SVG. Hover any shape to highlight it; click for a popup.
Circle takes its radius in metres and grows as you
zoom in. CircleMarker takes it in pixels and never
changes size. Both are on the map above — zoom out and watch the difference.
Polygon closes the ring for you. Repeating the first coordinate at the
end is harmless but unnecessary.
Rectangle is the odd one out: it takes a LatLngBounds
(south-west and north-east corners), not a list of points.
setStyle restyles a path in place, which is how the hover highlight
works here. getBounds() plus fitBounds frames a layer.
import {CargoMap, TileLayer, Circle, CircleMarker, Polygon, Polyline, Rectangle, LatLngBounds} from 'cargocanvas';