[R-sig-Geo] Fwd: Re: negative latitudes in coordinates function

Tomislav Hengl hengl at spatial-analyst.net
Thu Oct 6 14:51:01 CEST 2011


Erin,

Southern latitudes and Greenich-west longitudes are negative coordinates 
in the DD system:

> p1 <- data.frame(lon=-10.5, lat=-10.5)
> coordinates(p1) <- ~lon+lat
> proj4string(p1) <- CRS("+proj=longlat +datum=WGS84")
# In the DMS system, geographical coordinates are always positive:
> dd2dms(coordinates(p1)[,1])
[1] 10d30'W
> dd2dms(coordinates(p1)[,2], NS=TRUE)
[1] 10d30'S

sp will not accept DD values outside the -180/180 and -90/90 range (of
course):

> p1 <- data.frame(lon=-110.5, lat=-110.5)
> coordinates(p1) <- ~lon+lat
> proj4string(p1) <- CRS("+proj=longlat +datum=WGS84")
Error in `proj4string<-`(`*tmp*`, value = <S4 object of class "CRS">) :
   Geographical CRS given to non-conformant data

It is a bit trivial question, but things get more complicated once you
start working with geodetic datums because you can have the same
geographic coordinates that are ever kilometer away from each other (as
nicely illustrated in the ASDAR book section 4.1.3 ->
http://asdar-book.org/book/die.R).

T. Hengl
http://www.wewur.wur.nl/popups/vcard.aspx?id=HENGL001


Op 6-10-2011 12:50, Hodgess, Erin schreef:
> Hee hee!
>
> Sorry about this.
>
> Nothing like posting to the list to help you see a dumb mistake!
>
> Thanks!
> erin
>
>
> Erin M. Hodgess, PhD
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: hodgesse at uhd.edu
>
>
>
> -----Original Message-----
> From: b.rowlingson at googlemail.com on behalf of Barry Rowlingson
> Sent: Thu 10/6/2011 5:41 AM
> To: Hodgess, Erin
> Cc: r-sig-geo at r-project.org
> Subject: Re: [R-sig-Geo] negative latitudes in coordinates function
>
> On Thu, Oct 6, 2011 at 11:36 AM, Hodgess, Erin<HodgessE at uhd.edu>  wrote:
>> Dear R Sig Geo People:
>>
>> This is a goofy question.
>>
>> If I have a data set with negative latitude and and I want to use the coordinates function, what should I be changing on the negative latitude please?
>
>   Nothing? Negative latitudes are perfectly valid in sp. There's a
> whole 'nother hemisphere down there, I'm led to believe...
>
>
> Barry
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list