# Încărcare biblioteci
library(sf)
## Warning: package 'sf' was built under R version 4.4.3
## Linking to GEOS 3.13.0, GDAL 3.10.1, PROJ 9.5.1; sf_use_s2() is TRUE
library(leaflet)
## Warning: package 'leaflet' was built under R version 4.4.3
library(htmltools)
## Warning: package 'htmltools' was built under R version 4.4.3
# Puncte definite direct în R, preluate din GeoJSON-ul tău
local_points_raw <- st_as_sf(data.frame(
  id = 1:3,
  Denumire = c("Parcul Drumul Taberei", "Drumul Taberei", "Bd. Timisoara"),
  Lini = c("41", "41", "41"),
  x = c(2898142.36, 2898147.00, 2898007.82),
  y = c(5530423.45, 5531073.30, 5531763.72)
), coords = c("x", "y"), crs = 3857)

# Conversie la WGS84 pentru leaflet
local_points_wgs84 <- st_transform(local_points_raw, crs = 4326)

# Strat WFS (limite administrative)
wfs_lau_url <- paste0(
  "https://www.geo-spatial.org/geoserver/ows?",
  "service=WFS&version=2.0.0&request=GetFeature",
  "&typeName=administrative-boundaries:ro_admin_lau_simplified_polygon",
  "&outputFormat=application/json",
  "&srsName=EPSG:4326"
)
ro_admin_lau <- st_read(wfs_lau_url, quiet = TRUE)

# Harta interactivă
browsable(
  print(
    leaflet() %>%
      addProviderTiles("CartoDB.DarkMatter") %>%

      # Limite administrative
      addPolygons(
        data = ro_admin_lau,
        color = "#006400",
        weight = 1.5,
        fillColor = "#229F22",
        fillOpacity = 0.2,
        label = ~as.character(name)
      ) %>%

      # Puncte din json (inserate direct)
      addCircleMarkers(
        data = local_points_wgs84,
        radius = 6,
        color = "blue",
        stroke = TRUE,
        fillOpacity = 0.8,
        popup = ~paste0("<b>", Denumire, "</b><br/>Linia: ", Lini)
      ) %>%

      # GIF animat
      addMarkers(
        lng = 26.04,
        lat = 44.422,
        popup = "<div style='width:320px; height:240px;'>
           <b>GIF animat:</b><br/>
           <img src='https://i.pinimg.com/originals/10/80/08/1080086f9035e2ff64b14e99cc1042a4.gif' 
                style='width:90%; height:90%; object-fit: contain;'/>
         </div>"
      ) %>%

      setView(lng = 26.0345, lat = 44.423, zoom = 14) %>%
      addScaleBar(position = "bottomleft") %>%
      addControl("© Creat cu R", position = "bottomright")
  )
)