[R-sig-Geo] Distances in geoR package
Tim Keitt
tkeitt at mail.utexas.edu
Thu Jun 16 18:42:03 CEST 2005
Great. This looks useful. We need a "geoToolbox" package to collect
these sorts of utility functions...
THK
On Thu, 2005-06-16 at 09:26 -0700, White.Denis at epamail.epa.gov wrote:
> In higher latitudes, if the study area has a relatively small range of
> latitude (say less than 5 degrees), then simply scaling the longitudes
> by the cosine of the mid-latitude, will give a satisfactory coordinate
> system. For example, if the study area ranges from latitude 40 to 45,
> multiply the longitudes by cos (42.5 * pi/180) = 0.73..., or use the
> function below. This projection is neither equal-area nor conformal.
>
> marinus <- function (lon, lat)
> # Arguments are vectors of longitude and latitude,
> # that is, geographic coordinates in decimal degrees.
> # Projection center defined as midpoint in lat-lon space.
> # Returns a two column matrix with column names "x" and "y",
> # in units of kilometers.
> # Line identifiers in lon[is.na (lat)] retained in x.
> # This is the equidistant cylindric map projection,
> # here named after Marinus of Tyre.
> # (ref JP Snyder, USGS Prof Paper 1395, p 90).
> {
> R <- 6371 # authalic radius of Clarke 1866 rounded to km
> rlat <- range (lat, na.rm=TRUE)
> rlon <- range (lon, na.rm=TRUE)
> clat <- diff (rlat) / 2 + rlat[1]
> clon <- diff (rlon) / 2 + rlon[1]
> x <- R * (lon-clon)*pi/180 * cos (clat*pi/180)
> y <- R * (lat-clat)*pi/180
> x[is.na (lat)] <- lon[is.na (lat)]
> xy <- cbind (x=x, y=y)
> xy
> }
>
> r-sig-geo-bounces at stat.math.ethz.ch wrote on 2005-06-16 07:43:22:
>
> > For low-latitudes and small distances, the error should be
> > insignificant. You can check using proj.4 to compute some distances in
> > both Euclidean and geodesic distances. For large distances or high
> > latitudes, you can 1) project to a Cartesian coordinate system or 2)
> > compute geodesic distances. I think there is an "earth.distance"
> > somewhere in R.
> >
> > THK
> >
> >
> > On Thu, 2005-06-16 at 15:58 +0200, giovanna jona lasinio wrote:
> > > Dear all, this may be a stupid question, but I wasn't able to find
> an
> > > answer in the FAQ and in the mail archive.
> > > I have a huge amount of data, 644 sites for 30 different times,
> which
> > > coordinates are expressed in decimal longitude and latitude, I'd
> like to
> > > simply compute the empirical variogram and use "variofit" to
> estimate
> > > variogram's parameters for each time. The "variog" function uses
> > > euclidean distances and then it is not appropriate for lon-lat
> > > coordinate. Is there any way to change the distance type in
> "variog"? Or
> > > which information are necessary to "variofit" in order to estimate
> > > variogram's parameters?
> > >
> > > Thanks for any help
> > > Giovanna Jona Lasinio
> > >
> > > _______________________________________________
> > > R-sig-Geo mailing list
> > > R-sig-Geo at stat.math.ethz.ch
> > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> > --
> > Tim Keitt
> > Section of Integrative Biology
> > http://www.keittlab.org/
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Tim Keitt
Section of Integrative Biology
http://www.keittlab.org/
More information about the R-sig-Geo
mailing list