Package 'maposm'

Title: Get Map Layers from OpenStreetMap
Description: Download and assemble multiple geographic layers from the OpenStreetMap database for mapping purposes.
Authors: Timothée Giraud [cre, aut] , Matthieu Viry [ctb]
Maintainer: Timothée Giraud <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-03-21 09:19:52 UTC
Source: https://github.com/riatelab/maposm

Help Index


Get map layers

Description

Download various OpenStreetMap features to create map layers.

Usage

om_get(x, r = 1000, quiet = FALSE)

Arguments

x

an sf or sfc object, or a couple of coordinates

r

radi of the extraction if x is an sf POINT or a couple of coordinates

quiet

suppress info

Value

A list of map layers is returned :

  • zone, the extraction zone;

  • urban, urban areas;

  • building, buildings (if the extraction zone area is below 15 km^2);

  • green, green spaces;

  • road, main roads;

  • street, secondary roads;

  • railway, railroads (line);

  • water, water bodies

Examples

## Not run: 
bb1 = osmdata::getbb("Gare Matabiau, 31000 TOULOUSE, France")
lon = mean(bb1[1, ])
lat = mean(bb1[2, ])
res = om_get(c(lon, lat), r = 700)
om_map(res)

## End(Not run)

Map layers

Description

Display a map of the downloaded layers.

Usage

om_map(x, title = "Data from OpenStreetMap", theme = "light")

Arguments

x

a list of map layers

title

map title

theme

cartographic theme; "light", "dark" or "grey"

Value

Nothing is returned. A map is displayed.

Examples

## Not run: 
r = om_get(c(1.453587,43.611408), 700)
om_map(r, "Matabiau neighbourhood", "light")

## End(Not run)

Import a list of map layers

Description

Read and import a list of layers.

Usage

om_read(filename)

Arguments

filename

a geopackage file

Value

A list of map layers is returned.

Examples

## Not run: 
r = om_get(c(2.17, 41.39), 500)
om_write(r, "bcn.gpkg")
r = om_read("bcn.gpkg")
om_map(r)

## End(Not run)

Save map layers to a file

Description

Write a list a map of layers to a geopackage file.

Usage

om_write(x, filename)

Arguments

x

a list of map layers produce with om_get

filename

a geopackage file

Value

The layers are saved to a geopackage file. Nothing is returned.

Examples

## Not run: 
r = om_get(c(2.17, 41.39), 500)
(om_write(r, "bcn.gpkg"))

## End(Not run)