Re: [R] from long/lat to UTM

2005-03-10 Thread Ted Harding
On 10-Mar-05 Sander Oom wrote:
 Hi Yyan,
 
 The proj4R package by Roger Bivand will allow you to project data in 
 many ways and directions.
 
 http://spatial.nhh.no/R/Devel/proj4R-pkg.pdf
 
 It uses the proj libraries from:
 
 http://www.remotesensing.org/proj/
 
 Not sure where you would derive the time zone!
 
 Good luck,
 
 Sander.

While there is a longitude-based nominal time-zone
structure (0deg E is the centre of Zone 0 which extends
for 7.5deg either side; successive time-zones move round
by 15deg), this does not apply cleanly to the time-shifts
adopted in different places for local time.

A World map of regions with different local-time offsets
is a crazy patchwork, with all sorts of contradictory
looking regions. For instance, the -0700 region of
the USA extends from approx -0830 to approx -0620,
covering over 2 hours, and parts of -0800 touch the
-0700 line and are more than 0100 East of parts of -0700.
Even worse can be found over the Indian/Central Asian
and Malaysian parts of the world, where time-shifts
of 30 miniutes are also frequent (and, according to my
Atlas, one country, Nepal, has 52/3 i.e. +0540!).

As Sander says, Not sure where you would derive the time zone!.

Unless you can refer a (long,lat) position to a look-up
table, you can't predict what the zone will be to less
the 1 hour (except of course for the nominal time-zones
by 15deg sectors). I've never encountered a digital
version of such a table (my Atlas must be based on one,
though).

Best wishes,
Ted.

 yyan liu wrote:
 Hi:
   Is there any function in R which can convert the
 long/lat to UTM(Universal Transverse Mercator)?
   There are quite a few converters on Internet.
 However, the interface is designed as input-output
 which I can not convert lots of locations at the same
 time.
   Another question is whether there is a function in R
 which can tell the time zone from the location's
 lat/long?
   Thank you!
 
 liu
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 
 
 -- 
 
 Dr. Sander P. Oom
 Animal, Plant and Environmental Sciences,
 University of the Witwatersrand
 Private Bag 3, Wits 2050, South Africa
 Tel (work)  +27 (0)11 717 64 04
 Tel (home)  +27 (0)18 297 44 51
 Fax +27 (0)18 299 24 64
 Email   [EMAIL PROTECTED]
 Web www.oomvanlieshout.net/sander
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 10-Mar-05   Time: 09:47:25
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] from long/lat to UTM

2005-03-10 Thread Gabor Grothendieck
 Ted.Harding at nessie.mcc.ac.uk writes:
: 
:  yyan liu wrote:
:  Hi:
:Is there any function in R which can convert the
:  long/lat to UTM(Universal Transverse Mercator)?
:There are quite a few converters on Internet.
:  However, the interface is designed as input-output
:  which I can not convert lots of locations at the same
:  time.
:Another question is whether there is a function in R
:  which can tell the time zone from the location's
:  lat/long?
:Thank you!
:  
:  liu
: 
: On 10-Mar-05 Sander Oom wrote:
:  Hi Yyan,
:  
:  The proj4R package by Roger Bivand will allow you to project data in 
:  many ways and directions.
:  
:  http://spatial.nhh.no/R/Devel/proj4R-pkg.pdf
:  
:  It uses the proj libraries from:
:  
:  http://www.remotesensing.org/proj/
:  
:  Not sure where you would derive the time zone!
:  
:  Good luck,
:  
:  Sander.
: 
: While there is a longitude-based nominal time-zone
: structure (0deg E is the centre of Zone 0 which extends
: for 7.5deg either side; successive time-zones move round
: by 15deg), this does not apply cleanly to the time-shifts
: adopted in different places for local time.
: 
: A World map of regions with different local-time offsets
: is a crazy patchwork, with all sorts of contradictory
: looking regions. For instance, the -0700 region of
: the USA extends from approx -0830 to approx -0620,
: covering over 2 hours, and parts of -0800 touch the
: -0700 line and are more than 0100 East of parts of -0700.
: Even worse can be found over the Indian/Central Asian
: and Malaysian parts of the world, where time-shifts
: of 30 miniutes are also frequent (and, according to my
: Atlas, one country, Nepal, has 52/3 i.e. +0540!).
: 
: As Sander says, Not sure where you would derive the time zone!.
: 
: Unless you can refer a (long,lat) position to a look-up
: table, you can't predict what the zone will be to less
: the 1 hour (except of course for the nominal time-zones
: by 15deg sectors). I've never encountered a digital
: version of such a table (my Atlas must be based on one,
: though).
: 
: Best wishes,
: Ted.

The fBasics package of the rmetrics project uses the Olsen time
zone data base which does take some of these things into account.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] from long/lat to UTM

2005-03-10 Thread Ted Harding
On 10-Mar-05 Gabor Grothendieck wrote:
  Ted.Harding at nessie.mcc.ac.uk writes:
: [...]
: As Sander says, Not sure where you would derive the time zone!.
: 
: Unless you can refer a (long,lat) position to a look-up
: table, you can't predict what the zone will be to less
: the 1 hour (except of course for the nominal time-zones
: by 15deg sectors). I've never encountered a digital
: version of such a table (my Atlas must be based on one,
: though).
: 
: Best wishes,
: Ted.
 
 The fBasics package of the rmetrics project uses the Olsen time
 zone data base which does take some of these things into account.

Thanks, Gabor! However, this seems to be just the usual sort
of thing -- TimeZone name with corresponding TZ data. You first
have to know the TZ name. (Unless I have overlooked sonething
in the Olsen database).

What I had in mind was a look-up facility whereby a (long,lat)
pair could be submitted as a query, returning the TZ region
(name) within which that geographical point lay.

The only completely general mechanism I can think of would
consist of

a) a named list of boundary contours
b) a function which, for each name in the list, returns
   the TZ name

Then, for instance, given a point P = (long,lat), the list
could be searched by verifying, for each contour in the list,
whether the point lay in the region circumscribed by the
coutour (e.g. by computing the winding number for the contour
with respect to the point). This would also work for regions
with holes in them, provided the  boundary of the hole was
presented in the correct order of points (e.g. such that the
region of which it was the boundary lies to the left as you
go through the sequence).

If, for instance, I had the contour data for the TZ map
in my Atlas, I could construct such a thing! But, as I say,
I have not come across such a dataset. I'd be interested
to learn of one, though!

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 10-Mar-05   Time: 16:13:01
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] from long/lat to UTM

2005-03-10 Thread Greg Snow

 Ted Harding [EMAIL PROTECTED] 03/10/05 09:13AM 
 On 10-Mar-05 Gabor Grothendieck wrote:
   Ted.Harding at nessie.mcc.ac.uk writes:
 : [...]
 : As Sander says, Not sure where you would derive the time
zone!.
 : 

[snip]

 The only completely general mechanism I can think of would
 consist of
 
 a) a named list of boundary contours

I found a shapefile of time zones at: 
http://openmap.bbn.com/data/shape/timezone/ 

A google search on the keywords timezone  shapefile finds a 
few other possibilities. 

 b) a function which, for each name in the list, returns
the TZ name

The maptools package can read in the above shapefile and 
convert it to a list of polygons and the sgeostat has an
in.polygon function to see if a point is in a given polygon.

The following code worked for me:

library(maptools)
tz - read.shape('c:/maps/WrldTZA')
plot(tz)
plot(tz,xlim=c(-150,-50), ylim=c(20,50))

mappoly - Map2poly(tz)

library(sgeostat)

tmp - sapply(mappoly, function(x){ x - na.exclude(x)
in.polygon( -110, 42, x[,1], x[,2] ) } )

tz$att.data[tmp,]


the -110 and 42 come from me plotting the map and using 
locator to approximate where I am at.  I was actually 
suprized at how quick the sapply was (under a second on
my fairly fast pc (windows 2000)).

It shouldn't be too hard to convert this into a more general
function.




Greg Snow, Ph.D.
Statistical Data Center
[EMAIL PROTECTED]
(801) 408-8111

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] from long/lat to UTM

2005-03-10 Thread Ted Harding
On 10-Mar-05 Greg Snow wrote:
 [...]
 I found a shapefile of time zones at: 
 http://openmap.bbn.com/data/shape/timezone/ 
 
 A google search on the keywords timezone  shapefile finds a 
 few other possibilities. 
 
 b) a function which, for each name in the list, returns
the TZ name
 
 The maptools package can read in the above shapefile and 
 convert it to a list of polygons and the sgeostat has an
 in.polygon function to see if a point is in a given polygon.
 
 The following code worked for me:
 []

Many thanks, Greg. That looks just the job, and I'll look
into it.

All best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 10-Mar-05   Time: 18:10:23
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] from long/lat to UTM

2005-03-09 Thread Mulholland, Tom
I think I recall seeing a limited capability in the PBSmapping package.

Tom

 -Original Message-
 From: yyan liu [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, 9 March 2005 1:20 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] from long/lat to UTM
 
 
 Hi:
   Is there any function in R which can convert the
 long/lat to UTM(Universal Transverse Mercator)?
   There are quite a few converters on Internet.
 However, the interface is designed as input-output
 which I can not convert lots of locations at the same
 time.
   Another question is whether there is a function in R
 which can tell the time zone from the location's
 lat/long?
   Thank you!
 
 liu
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] from long/lat to UTM

2005-03-09 Thread Sander Oom
Hi Yyan,
The proj4R package by Roger Bivand will allow you to project data in 
many ways and directions.

http://spatial.nhh.no/R/Devel/proj4R-pkg.pdf
It uses the proj libraries from:
http://www.remotesensing.org/proj/
Not sure where you would derive the time zone!
Good luck,
Sander.
yyan liu wrote:
Hi:
  Is there any function in R which can convert the
long/lat to UTM(Universal Transverse Mercator)?
  There are quite a few converters on Internet.
However, the interface is designed as input-output
which I can not convert lots of locations at the same
time.
  Another question is whether there is a function in R
which can tell the time zone from the location's
lat/long?
  Thank you!
liu
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--

Dr. Sander P. Oom
Animal, Plant and Environmental Sciences,
University of the Witwatersrand
Private Bag 3, Wits 2050, South Africa
Tel (work)  +27 (0)11 717 64 04
Tel (home)  +27 (0)18 297 44 51
Fax +27 (0)18 299 24 64
Email   [EMAIL PROTECTED]
Web www.oomvanlieshout.net/sander
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] from long/lat to UTM

2005-03-08 Thread yyan liu
Hi:
  Is there any function in R which can convert the
long/lat to UTM(Universal Transverse Mercator)?
  There are quite a few converters on Internet.
However, the interface is designed as input-output
which I can not convert lots of locations at the same
time.
  Another question is whether there is a function in R
which can tell the time zone from the location's
lat/long?
  Thank you!

liu

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html