# NOT RUN {
## GeoJSON
### Get region
res <- mr_geojson(key = "Morocco:dam")
### Plot data
if (!requireNamespace("leaflet")) {
install.packages("leaflet")
}
library('leaflet')
leaflet() %>%
addProviderTiles(provider = 'OpenStreetMap') %>%
addGeoJSON(geojson = res$features) %>%
setView(-3.98, 35.1, zoom = 11)
## Shape
### Get region
res <- mr_shp(key = "MarineRegions:eez_iho_union_v2")
library('leaflet')
leaflet() %>%
addProviderTiles(provider = 'OpenStreetMap') %>%
addPolygons(data = res)
## Convert to WKT
### From geojson
res <- mr_geojson(key = "Morocco:dam")
mr_as_wkt(res, fmt = 5)
### From shp object (`SpatialPolygonsDataFrame`) or file, both work
mr_as_wkt(mr_shp(key = "Morocco:dam", read = FALSE))
## spatial object to wkt
mr_as_wkt(mr_shp(key = "Morocco:dam", read = TRUE))
# }
Run the code above in your browser using DataLab