[R-sig-Geo] How best simplify a road network?

Michal Kvasnička M|ch@|@Kv@@n|ck@ @end|ng |rom econ@mun|@cz
Tue Jul 21 16:23:01 CEST 2020


Hello.

I need to read the OSM map into R and convert it to spatstat linnet class.
In the process, I need to simplify the graph so that no edge is shorter
than several meters. At the same time, the network graph topology must
remain the same, i.e. the crossroads must be kept as they are.

So far, I've proceeded this way: 1) I use the map packed by geofabric.de,
2) I read it with sf::st_read(), 3) transform its CRS to Krovak projection
with st_transform(), and 4) simplify it with

roads %>%
    st_union()
    st_simplify(preserveTopology = TRUE, dTolerance = 20)

My questions:
1. Does st_simplify() the work, i.e. does it keep the crossroads?
2. Is st_union() in front of it necessary?
3. Isn't there a better way? st_simplify() still leaves some very short
(about 1 mm long) edges in the graph. (If necessary, crossroads, i.e.
vertices with more than two edges, can be moved and joined if they are
close to each other and connected with an edge, since all such vertices
closer than several meters may represent a bug in the map anyway. At least,
I guess so.)

One extra question: I going through geofabric.de, sf, sp, and
spatstat::as.linnet() safe?

Many thanks for your kind help.

Best wishes,
*Ing. Michal Kvasnička, Ph.D.*



*Masaryk University | School of Economics and Administration*
Department of Economics
A: Lipová 41a | 602 00 Brno
E: michal.kvasnicka using econ.muni.cz | W: www.econ.muni.cz/~qasar

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list