Skip to content

Commit 2187681

Browse files
committed
new CRAN submission with earthDist: Map download excluded from checks + numerical rounding.
1 parent 091fa02 commit 2187681

File tree

4 files changed

+42
-18
lines changed

4 files changed

+42
-18
lines changed

DESCRIPTION

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: OSMscale
22
Title: Add a Scale Bar to 'OpenStreetMap' Plots
3-
Version: 0.4.0
4-
Date: 2017-01-18
3+
Version: 0.4.1
4+
Date: 2017-01-19
55
Author: Berry Boessenkool
66
Maintainer: Berry Boessenkool <[email protected]>
77
Description: Functionality to handle and project lat-long coordinates, easily download background maps

NEWS

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
package OSMscale: project points and add a scalebar to OpenStreetMap plots.
22
Feedback, ideas, code suggestions welcome at [email protected] or via github.com/brry/OSMscale
33

4+
5+
For all changes, see:
6+
https://github.com/brry/OSMscale/compare/master@{2017-01-18}...master@{2017-01-19}#files_bucket
7+
8+
49
-----------------------------
510
-----------------------------
611

7-
Version 0.4.0 (2017-01-18)
12+
Version 0.4.1 (2017-01-19)
813
- scaleBar default choices improved
914
- pointsMap remowes margins before plotting and has proj argument instead of utm
1015
- earthDist can now compute distance relative to any of the coordinate pairs

R/earthDist.R

+18-8
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,25 @@
1515
#' @examples
1616
#' d <- read.table(header=TRUE, sep=",", text="
1717
#' lat, long
18-
#' 52.514687, 13.350012 # Berlin
19-
#' 35.685024, 139.753365 # Tokio
20-
#' 51.503162, -0.131082") # London
21-
#' earthDist(lat, long, d) # from Berlin to T and L: 8922 and 928 km
22-
#' earthDist(lat, long, d, i=3) # from London to B and T: 928 and 9562 km
18+
#' 52.514687, 13.350012 # Berlin
19+
#' 51.503162, -0.131082 # London
20+
#' 35.685024, 139.753365") # Tokio
21+
#' earthDist(lat, long, d) # from Berlin to L and T: 928 and 8922 km
22+
#' earthDist(lat, long, d, i=2) # from London to B and T: 928 and 9562 km
23+
#' # slightly different with other formulas:
24+
#' # install.packages("geosphere")
25+
#' # geosphere::distHaversine(as.matrix(d[1,2:1]), as.matrix(d[2,2:1])) / 1000
26+
#'
27+
#' \dontrun{ # don't download stuff in R CMD check
2328
#' map <- pointsMap(lat, long, d, zoom=2, abslen=5000, y=0.7)
2429
#' scaleBar(map, y=0.5, abslen=5000) # in mercator projections, scale bars are not
2530
#' scaleBar(map, y=0.3, abslen=5000) # transferable to other latitudes
26-
#' # slightly different with other formulas:
27-
#' # geosphere::distHaversine(as.matrix(d[1,2:1]), as.matrix(d[2,2:1])) / 1000
31+
#'
32+
#' map_utm <- pointsMap(lat, long, d[1:2,], proj=putm(long=d$long[1:2]),
33+
#' zoom=4, y=0.7, abslen=500)
34+
#' scaleBar(map_utm, y=0.5, abslen=500) # transferable in UTM projection
35+
#' scaleBar(map_utm, y=0.3, abslen=500)
36+
#' }
2837
#'
2938
#' # compare with UTM distance
3039
#' set.seed(42)
@@ -76,7 +85,8 @@ x2 <- long*pi/180
7685
# angle preparation (numerical inaccuracies may lead to 1.0000000000000002):
7786
cosinusangle <- sin(y1)*sin(y2) + cos(y1)*cos(y2)*cos(x1-x2)
7887
cosinusangle <- replace(cosinusangle, cosinusangle>1, 1)
79-
cosinusangle <- replace(cosinusangle, cosinusangle<0, 0)
88+
#cosinusangle <- replace(cosinusangle, cosinusangle<0, 0)
89+
cosinusangle[ sapply(cosinusangle, function(x) isTRUE(all.equal(x,1))) ] <- 1
8090
# angle between lines from earth center to coordinates:
8191
angle <- acos( cosinusangle )
8292
# compute great-circle-distance:

man/earthDist.Rd

+16-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)