viewof mapContainer = {
const featureIDs = new Set();
const geoJson = {
type: "FeatureCollection",
features: []
};
const container = html`<div style='height:${width}px;' />`;
yield container;
const attribution =
wfsConfig.name == "BAG" ? "PDOK.nl" : "© 3D BAG by tudelft3d";
const map = new mapboxgl.Map({
container,
center: [5.38774, 52.155499],
zoom: 7,
style: "mapbox://styles/selenecodes/ckvgs50no1yw214pkrjm4dy05",
attributionControl: false
}).addControl(
new mapboxgl.AttributionControl({
customAttribution: attribution
})
);
map.addControl(
new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
mapboxgl: mapboxgl
})
);
map.on("load", () => {
map.addSource("buildings", {
attribution: attribution,
type: "geojson",
data: geoJson
});
map.addLayer({
id: "buildings",
type: "fill",
source: "buildings",
layout: {},
paint: {
"fill-color": generateMapboxColorSwatch()
}
});
});
map.on("moveend", () => handleMapDrag(map, geoJson, featureIDs));
map.on("mousemove", (e) => handleMouseMove(e, container, featureIDs));
}