diff --git a/map.html b/map.html index 98f60ab..2e0f7df 100644 --- a/map.html +++ b/map.html @@ -20,6 +20,17 @@ font-weight: bold; } + .label { + font-weight: bold; + text-align: center; + margin-top: -1em; + } + .label div { + position: relative; + left: -50%; + top: 10px; + text-shadow: 0 0 2px white; + } @@ -49,8 +60,21 @@ }).addTo(map); L.geoJSON(plats, { - }).bindPopup(function (layer) { - return layer.feature.properties.TAO_NAME; + onEachFeature: function(feature, layer) { + const latLngs = layer.getLatLngs()[0]; + const centerish = [ // TODO: actual centroid + latLngs.reduce((acc, i) => acc + i.lat, 0) / latLngs.length, + latLngs.reduce((acc, i) => acc + i.lng, 0) / latLngs.length, + ]; + + const label = L.marker(centerish, { + icon: L.divIcon({ + iconSize: null, + className: "label", + html: "
" + feature.properties.TAO_NAME + "
" + }) + }).addTo(map); + }, }).addTo(map); for (let stand of data.stands) {