[R-sig-Geo] extracting coordinates

Robin W Hunnewell rhunne at mac.com
Mon Feb 28 18:33:21 CET 2011


Hi again,
Thanks, sorry about that - here is the code to illustrate what I did - following the ASDAR book example of choosing a subset of coordinates in Brazil:

> brazil
[1] 4 5 6 7 8
> coordinates(CRAN_sp[brazil, ])
  coords.x1 coords.x2
4 -49.26667 -25.41667
5 -42.86667 -20.75000
6 -43.20000 -22.90000
7 -47.63333 -22.71667
8 -46.63333 -23.53333
> summary(CRAN_sp[brazil, ])
Object of class SpatialPoints
Coordinates:
                 min      max
coords.x1 -122.95000 153.0333
coords.x2  -37.81667  57.0500
Is projected: FALSE 
proj4string : [+proj=longlat +ellps=WGS84]
Number of points: 5

> summary(CRAN_sp)
Object of class SpatialPoints
Coordinates:
                 min      max
coords.x1 -122.95000 153.0333
coords.x2  -37.81667  57.0500
Is projected: FALSE 
proj4string : [+proj=longlat +ellps=WGS84]
Number of points: 54

  
My problem is: the object "brazil" should have a new bounding box -- as it does in the ASDAR book example text. But when I do it, the bounding box remains identical to the original one for CRAN_sp.
Sorry for the confusion, thanks greatly for any help.
Robin



Begin forwarded message:

From: Tom Gottfried <tom.gottfried at wzw.tum.de>
Date: February 28, 2011 1:05:21 PM
To: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] extracting coordinates

Hi Robin,

could you please post some example code (possibly self-contained, e.g. with meuse data)?
So it's less guessing what you actually did. More on this topic:
http://www.r-project.org/posting-guide.html

regards,
Tom

Am 28.022011 16:59, schrieb Robin W Hunnewell:
> Hi,
> 
> I'm going through some initial data inspection, and working through
> steps in the "Applied Spatial Data analysis with R" book. 
> Following steps in Ch. 2 of the "Applied Spatial Data analysis with R"
> book, I was able to extract a set of coordinates from my
> SpatialPoints object just fine. The object returned looks right - the
> coordinates are extracted correctly, but my bounding box does 
> not change. The same min/max for coords.x1 and x2 get returned instead
> of a new bounding box that reflects the selection.
> 
> Not sure what I'm missing, would appreciate any help - I apologize if
> this is overly simple!
> thanks,
> Robin
> 
> 
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Technische Universität München
Department für Pflanzenwissenschaften
Lehrstuhl für Grünlandlehre
Alte Akademie 12
85350 Freising / Germany
Phone: ++49 (0)8161 715324
Fax: ++49 (0)8161 713243
email: tom.gottfried at wzw.tum.de
http://www.wzw.tum.de/gruenland

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110228/84c6d8a9/attachment.html>


More information about the R-sig-Geo mailing list