| Title: | Get Map Layers from 'OpenStreetMap' |
|---|---|
| Description: | The 'OpenStreetMap' database provides a wide range of highly detailed geographic layers on a global scale. To obtain synthetic information for cartographic purposes, layers must be selected, simplified, merged, or modified. 'maposm' downloads 'OpenStreetMap' extracts and performs these operations to create a set of composite layers of urban areas, buildings, green spaces, main roads, secondary roads, railways, and water bodies. |
| Authors: | Timothée Giraud [cre, aut] (ORCID: <https://orcid.org/0000-0002-1932-3323>), Matthieu Viry [ctb] (ORCID: <https://orcid.org/0000-0002-0693-8556>), Louis Laurian [ctb] (ORCID: <https://orcid.org/0009-0002-7275-5536>) |
| Maintainer: | Timothée Giraud <[email protected]> |
| License: | GPL-3 |
| Version: | 0.5.1.9000 |
| Built: | 2026-10-16 13:08:36 UTC |
| Source: | https://codeberg.org/riatelab/maposm |
The OpenStreetMap database provides a wide range of highly
detailed geographic layers on a global scale. To obtain synthetic
information for cartographic purposes, layers must be selected, simplified,
merged, or modified. maposm downloads OpenStreetMap extracts and performs
these operations to create a set of composite layers of urban areas,
buildings, green spaces, main roads, secondary roads, railways, and water
bodies.
om_get is used to download, merge and simplify the geographic layers.
om_map is used to map the layers. Several themes are available to map
the layers ("light", "dark", "grey" and "pizza").
om_write can be used to write the layers to a geopackage file.
om_read can be used to read these geopackages.
Maintainer: Timothée Giraud [email protected] (ORCID)
Authors:
Timothée Giraud [email protected] (ORCID)
Other contributors:
Useful links:
Report bugs at https://codeberg.org/riatelab/maposm/issues
Download various OpenStreetMap features to create map layers.
om_get( x, r, download_directory = tempdir(), force_download = FALSE, max_file_size = 20, force_building = FALSE, quiet = FALSE )om_get( x, r, download_directory = tempdir(), force_download = FALSE, max_file_size = 20, force_building = FALSE, quiet = FALSE )
x |
an sf or sfc object, or a couple of coordinates (lon/lat, EPSG:4326) |
r |
radius of the extraction if x is an sf POINT or a couple of coordinates |
download_directory |
directory to store the file containing raw OpenStreetMap data |
force_download |
if TRUE, the OpenSteetMap file is updated even if it has already been downloaded. |
max_file_size |
the maximum file size to download without asking in interactive mode, in megabytes (default to 20 MB) |
force_building |
force the extraction of buildings in zones larger than 20 km² |
quiet |
if FALSE, the function prints informative messages |
A list of map layers is returned :
zone, the extraction zone;
urban, urban areas;
building, buildings (if the extraction zone area is below 20 km² or
force_building = TRUE);
green, green spaces;
road, main roads;
street, secondary roads;
railway, railways (line);
water, water bodies
If x uses an unprojected CRS (lon/lat, EPSG:4326), ouput uses
Web Mercator CRS (EPSG:3857), it uses x CRS otherwise.
res = om_get(c(-61.070, 14.605), r = 600) om_map(res, title = "Fort-de-France town centre")res = om_get(c(-61.070, 14.605), r = 600) om_map(res, title = "Fort-de-France town centre")
Display a map of the downloaded layers.
om_map(x, title = "Data from OpenStreetMap", theme = "light")om_map(x, title = "Data from OpenStreetMap", theme = "light")
x |
a list of map layers |
title |
map title |
theme |
cartographic theme; "light", "dark", "grey" or "pizza" |
Nothing is returned. A map is displayed.
res = om_get(c(-61.070, 14.605), r = 600) om_map(res, title = "Fort-de-France town centre", theme = "light")res = om_get(c(-61.070, 14.605), r = 600) om_map(res, title = "Fort-de-France town centre", theme = "light")
Read and import a list of layers.
om_read(filename)om_read(filename)
filename |
a geopackage file |
A list of map layers is returned.
res = om_get(c(-61.070, 14.605), r = 600) om_map(res, title = "Fort-de-France town centre") om_write(res, file.path(tempdir(), "f2f.gpkg")) r = om_read(file.path(tempdir(), "f2f.gpkg")) om_map(r, theme = "grey")res = om_get(c(-61.070, 14.605), r = 600) om_map(res, title = "Fort-de-France town centre") om_write(res, file.path(tempdir(), "f2f.gpkg")) r = om_read(file.path(tempdir(), "f2f.gpkg")) om_map(r, theme = "grey")
Write a list a map of layers to a geopackage file.
om_write(x, filename)om_write(x, filename)
x |
a list of map layers produce with |
filename |
a geopackage file |
The layers are saved to a geopackage file. Nothing is returned.
res = om_get(c(-61.070, 14.605), r = 600) om_map(res, title = "Fort-de-France town centre") (om_write(res, file.path(tempdir(), "f2f.gpkg")))res = om_get(c(-61.070, 14.605), r = 600) om_map(res, title = "Fort-de-France town centre") (om_write(res, file.path(tempdir(), "f2f.gpkg")))