showing results for - "geojson in leaflet"
Diego Alejandro
14 Jan 2017
1async function addGeoJson() {
2    const response = await fetch("filepath/filename.geojson");
3    const data = await response.json();
4    L.geoJson(data).addTo(map);
5}
6
7addGeoJson();
8
Jude
03 Nov 2017
1labels <- sprintf(
2  "<strong>%s</strong><br/>%g people / mi<sup>2</sup>",
3  states$name, states$density
4) %>% lapply(htmltools::HTML)
5
6m <- m %>% addPolygons(
7  fillColor = ~pal(density),
8  weight = 2,
9  opacity = 1,
10  color = "white",
11  dashArray = "3",
12  fillOpacity = 0.7,
13  highlight = highlightOptions(
14    weight = 5,
15    color = "#666",
16    dashArray = "",
17    fillOpacity = 0.7,
18    bringToFront = TRUE),
19  label = labels,
20  labelOptions = labelOptions(
21    style = list("font-weight" = "normal", padding = "3px 8px"),
22    textsize = "15px",
23    direction = "auto"))
24m