# Încărcare librării
library(leaflet)
## Warning: package 'leaflet' was built under R version 4.4.3
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
# Setează folderul de lucru (modifică dacă e nevoie)
setwd("C:/Users/danie/harta_norvegia")
# Încarcă fișierele GeoJSON
puncte <- st_read("geojson/puncte.geojson")
Reading layer
puncte' from data sourceC:_norvegia.geojson’ using driver
`GeoJSON’ Simple feature collection with 3 features and 2 fields
Geometry type: POINT Dimension: XY Bounding box: xmin: 5.3221 ymin:
58.1467 xmax: 10.7522 ymax: 60.39299 Geodetic CRS: WGS 84
puncte_turistice <- st_read("geojson/puncte_turistice.geojson")
Reading layer
puncte_turistice' from data sourceC:_norvegia_turistice.geojson’
using driver `GeoJSON’ Simple feature collection with 2 features and 2
fields Geometry type: POINT Dimension: XY Bounding box: xmin: 6.19 ymin:
58.9861 xmax: 6.9107 ymax: 62.1015 Geodetic CRS: WGS 84
# Încarcă stratul WFS EEZ
zona_eez <- st_read("https://geo.vliz.be/geoserver/MarineRegions/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=MarineRegions:eez&outputFormat=application/json")
Reading layer OGRGeoJSON' from data sourcehttps://geo.vliz.be/geoserver/MarineRegions/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=MarineRegions:eez&outputFormat=application/json’
using driver `GeoJSON’ Simple feature collection with 285 features and
32 fields Geometry type: MULTIPOLYGON Dimension: XY Bounding box: xmin:
-180 ymin: -62.78834 xmax: 180 ymax: 86.99401 Geodetic CRS: WGS 84
# Filtrare doar pentru Norvegia
zona_eez_norvegia <- zona_eez[zona_eez$Territory1 == "Norway", ]
# Creează harta
leaflet() %>%
addTiles() %>%
setView(lng = 10.75, lat = 59.91, zoom = 5) %>%
addPolygons(data = zona_eez_norvegia, color = "blue", weight = 1, fillOpacity = 0.1) %>%
addCircleMarkers(data = puncte, color = "red", radius = 5, popup = ~name) %>%
addCircleMarkers(data = puncte_turistice, color = "gold", radius = 6, popup = ~name) %>%
addControl(
html = "<div style='background:white;padding:5px;border:1px solid gray;'>
<strong>Legendă</strong><br>
<span style='color:red;'>⬤</span> Orașe<br>
<span style='color:gold;'>⬤</span> Puncte turistice<br>
<span style='color:blue;'>◯</span> Zona EEZ
</div>",
position = "bottomright"
)