Description Usage Arguments Value References See Also Examples

View source: R/approx_distances.R

Approximate distances between two points or across the horizontal and vertical center lines of a bounding box.

1 2 |

`x` |
object that can be coerced to a bounding box with |

`y` |
a pair of coordintes, vector of two. Only required when |

`projection` |
projection code, needed in case |

`target` |
target unit, one of: |

`orig` |
original unit, i.e. by which |

`to` |
multiplier used as follows: |

`show.warnings` |
should warnings be shown? |

If `y`

is specified, a list of two: unit and dist. Else, a list of three: unit, hdist (horizontal distance) and vdist (vertical distance).

Tennekes, M., 2018, tmap: Thematic Maps in R, Journal of Statistical Software, 84(6), 1-39, DOI

`projection_units`

and `approx_areas`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
## Not run:
if (require(tmap)) {
data(NLD_prov)
# North-South and East-West distances of the Netherlands
approx_distances(NLD_prov)
# Distance between Maastricht and Groningen
p_maastricht <- geocode_OSM("Maastricht")$coords
p_groningen <- geocode_OSM("Groningen")$coords
approx_distances(p_maastricht, p_groningen)
# Check distances in several projections
sapply(c("wintri", "utm31", "laea_Eur", "rd", "longlat"), function(projection) {
p_maastricht <- geocode_OSM("Maastricht", projection = projection)$coords
p_groningen <- geocode_OSM("Groningen", projection = projection)$coords
approx_distances(p_maastricht, p_groningen, projection = projection)
})
}
## End(Not run)
``` |

tmaptools documentation built on April 10, 2018, 9:07 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.