Skip to content

Commit e5c57b9

Browse files
committed
?
1 parent 0948006 commit e5c57b9

File tree

8 files changed

+15
-10
lines changed

8 files changed

+15
-10
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
.gitattributes
33
LICENSE
44
README.md
5+
^revdep$
6+
.travis.yml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
revdep
12
*.tar.gz
23
*Rcheck/
34
*.o

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
Package: geosphere
22
Type: Package
33
Title: Spherical Trigonometry
4-
Version: 1.5-9
5-
Date: 2018-07-18
4+
Version: 1.5-11
5+
Date: 2020-04-19
66
Imports: sp
77
Depends: R (>= 3.0.0)
88
Suggests: methods, raster
99
Authors@R: c(
1010
person("Robert J.", "Hijmans", role = c("cre", "aut"), email = "[email protected]"),
11+
person("Charles", "Karney", role = "ctb", comment="GeographicLib"),
1112
person("Ed", "Williams", role = "ctb"),
1213
person("Chris", "Vennes", role = "ctb"))
1314
Description: Spherical trigonometry for geographic applications. That is, compute distances and related measures for angular (longitude/latitude) locations.

man/centroid.Rd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
\title{Centroid of spherical polygons}
99

1010
\description{
11-
Compute the centroid of longitude/latitude polygons. Unlike other functions in this package, there is no spherical trigonomery involved in the implementation of this function. Instead, the function projects the polygon to the (conformal) Mercator coordinate reference system, computes the centroid, and then inversely projects it to longitude and latitude. This approach fails for polygons that include one of the poles (and is rather biased for anything close to the poles). The function should work for polygons that cross the -180/180 meridian (date line).
11+
Compute the centroid of longitude/latitude polygons. Unlike other functions in this package, there is no spherical trigonometry involved in the implementation of this function. Instead, the function projects the polygon to the (conformal) Mercator coordinate reference system, computes the centroid, and then inversely projects it to longitude and latitude. This approach fails for polygons that include one of the poles (and is rather biased for anything close to the poles). The function should work for polygons that cross the -180/180 meridian (date line).
1212
}
1313

1414
\usage{
1515
centroid(x, ...)
1616
}
1717

1818
\arguments{
19-
\item{x}{a 2-column matrix (longitude/latitude)}
19+
\item{x}{SpatialPolygons* object, or a 2-column matrix or data.frame reprenting a single polgyon (longitude/latitude)}
2020
\item{...}{Additional arguments. None implemented}
2121
}
2222

man/destPoint.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ destPoint(p, b, d, a=6378137, f=1/298.257223563, ...)
2727

2828

2929
\note{
30-
Direction changes continuously when travelling along a geodesic. Therefore, the final direction is not the same as the initial direction. You can compute the final direction with \code{\link[geosphere]{finalBearing}} (see examples, below)
30+
Direction changes continuously when travelling along a geodesic. Therefore, the final direction is not the same as the initial direction. You can compute the final direction with \code{\link{finalBearing}} (see examples, below)
3131
}
3232

3333

man/lengthLine.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ length (in meters) for each line
2525

2626

2727
\seealso{
28-
For planar coordinates, see \code{\link[rgeos]{gLength}}
28+
For planar coordinates, see \code{\link[rgeos:misc-gLength]{gLength}}
2929
}
3030

3131

man/perimeter.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Numeric. The perimeter or length in m.
3636
}
3737

3838
\seealso{
39-
\code{ \link[geosphere]{areaPolygon}, \link[geosphere]{centroid} }
39+
\code{ \link{areaPolygon}, \link[geosphere]{centroid} }
4040
}
4141

4242

src/dist.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ double distVinSph(double lon1, double lat1, double lon2, double lat2, double r)
5454
lat1 = toRad(lat1);
5555
lat2 = toRad(lat2);
5656

57-
x1 = sqrt(cos(lat2) * sin(lon1-lon2));
58-
x2 = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon1-lon2);
59-
x = x1*x1 + x2*x2;
57+
x1 = cos(lat2) * sin(lon1-lon2);
58+
x2 = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(lon1-lon2);
59+
x = sqrt(x1*x1 + x2*x2);
60+
6061
y = sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon1-lon2);
6162

6263
return r * atan2(x, y);

0 commit comments

Comments
 (0)