library(mapsf)
#> Le chargement a nécessité le package : sf
#> Linking to GEOS 3.7.1, GDAL 3.1.2, PROJ 7.1.0
mtq <- mf_get_mtq()
mf_theme("nevermind")
mf_map(mtq, graticule = st_crs(4326),
axes = TRUE,
lon = seq(-60,-62, by=-.2),
lat = seq(14, 15, by = .2))
View mtq.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(raster) | |
library(cartography) | |
library(sf) | |
library(SpatialPosition) | |
mtq <- st_read(system.file("shape/martinique.shp", package="cartography")) | |
# use WGS84 proj | |
mtq_latlon <- st_transform(mtq, 4326) | |
# this call throw an error but seems to work... | |
getData('SRTM', lon=-61, lat=14) |
View zoom.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load libraries | |
library(sf) | |
library(cartography) | |
library(rnaturalearth) | |
# import world countries and coastlines from Natural Earth | |
country <- ne_countries(scale = 50, returnclass = "sf", | |
type="sovereignty") | |
coastline <- ne_coastline(scale = 50, returnclass = "sf") |
View roads.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
library(cartography) | |
library(osrm) | |
# set osrm to my own server | |
options(osrm.server = "http://address.of.my.server/", osrm.profile = "driving") | |
# destination point (useR2019 conference in Toulouse) | |
dst <- data.frame(id="dst", x = 1.4344, y = 43.6113) | |
dst <- st_as_sf(dst, coords = c('x','y'), crs = 4326) |
View cartomix.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(cartography) | |
library(sp) | |
library(sf) | |
# Load data | |
data(nuts2006) | |
# Save image | |
sizes <- getFigDim(x = nuts0.spdf, width = 700, mar = c(0,0,0,0), res = 100) | |
png('./img/map8.png', width = sizes[1], height = sizes[2], res = 100) |
View fisheye-world.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rnaturalearth) | |
library(mapsf) | |
library(fisheye) | |
ct <- ne_download(scale = 50, returnclass = "sf") | |
oc <- ne_download(type = "ocean", category = "physical", | |
scale = 50, returnclass = "sf") | |
x <- st_transform(ct, "+proj=natearth2") | |
z <- st_transform(oc, "+proj=natearth2") | |
View graticules.md
View osrm.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
library(osrm) | |
library(maptiles) | |
# build a bbox for Paris | |
bb <- st_bbox(c(xmin = 643069, ymin = 6857478, | |
xmax = 661079, ymax = 6867081), | |
crs = 2154) | |
# get map tiles | |
osm <- get_tiles(x = bb, provider = "CartoDB.PositronNoLabels", | |
crop = TRUE, zoom = 13) |
View bang.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
library(elevatr) | |
library(raster) | |
library(tanaka) | |
# a polygon of bangalore | |
bangalore <- st_read("export.geojson") | |
elevation <- get_elev_raster(bangalore, z = 10) | |
bangalore_elevation <- trim(mask(elevation, bangalore)) | |
# inspect min and max values |
View points.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(units) | |
library(sf) | |
library(cartography) | |
# library(osmdata) | |
# | |
# # define a bounding box | |
# q0 <- opq(bbox = c(2.2247, 48.8188, 2.4611, 48.9019)) | |
# | |
# # extract Paris boundaries |
View lakes.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rnaturalearth) | |
library(cartography) | |
library(sf) | |
lakes <- ne_download(scale = 10, type = "lakes", category = c("physical"), | |
destdir = tempdir(), load = TRUE, returnclass = c("sf")) | |
countries <- ne_download(scale = 10, type = "countries", | |
category = c("cultural"), destdir = tempdir(), | |
load = TRUE, returnclass = c("sf")) | |
countries <- st_transform(countries, "ESRI:54017") |
NewerOlder