library(leaflet)
library(geojsonio)
## Registered S3 method overwritten by 'geojsonsf':
## method from
## print.geojson geojson
##
## Attaching package: 'geojsonio'
## The following object is masked from 'package:base':
##
## pretty
library(sp)
#punctele
puncte <- geojson_read("data/puncte.geojson", what = "sp")
#poligon WFS
coords <- matrix(c(
24.30, 45.00,
24.38, 45.00,
24.38, 44.80,
24.30, 44.80,
24.30, 45.00
), ncol = 2, byrow = TRUE)
poly <- SpatialPolygons(list(Polygons(list(Polygon(coords)), ID = "1")))
# Harta
leaflet(puncte) %>%
addProviderTiles(providers$Esri.WorldImagery) %>%
addCircleMarkers(data = subset(puncte, tip == "real"),
radius = 8,
fillColor = "red",
color = "black",
weight = 1,
fillOpacity = 0.9,
popup = ~paste0("<strong>", nume, "</strong><br>", descriere)) %>%
addCircleMarkers(data = subset(puncte, tip == "radar"),
radius = 8,
fillColor = "red",
color = "black",
weight = 1,
fillOpacity = 0.9,
popup = ~paste0("<strong>", nume, "</strong><br>", descriere)) %>%
addCircleMarkers(data = subset(puncte, tip == "radar"),
radius = 14,
color = "red",
fillOpacity = 0,
weight = 3,
label = "Punct radar animat – simulat",
labelOptions = labelOptions(
style = list(
"color" = "black",
"background-color" = "white",
"padding" = "4px",
"border-radius" = "4px",
"box-shadow" = "0 0 3px rgba(0,0,0,0.3)",
"border" = "1px solid gray"
),
direction = "top",
offset = c(0, -10),
textsize = "13px"
)) %>%
addPolygons(data = poly,
color = "blue",
weight = 2,
fillOpacity = 0.1,
label = "Strat WFS",
labelOptions = labelOptions(
style = list(
"color" = "black",
"background-color" = "white",
"padding" = "4px",
"border-radius" = "4px",
"box-shadow" = "0 0 3px rgba(0,0,0,0.3)",
"border" = "1px solid gray"
),
direction = "center",
textsize = "13px"
)) %>%
addScaleBar(position = "bottomleft")