[R-sig-Geo] newbie bbox type question

Roger Bivand Roger.Bivand at nhh.no
Mon May 30 10:31:02 CEST 2011


On Mon, 30 May 2011, Barry Rowlingson wrote:

> On Sun, May 29, 2011 at 8:16 PM, Hodgess, Erin <HodgessE at uhd.edu> wrote:
>
>> I want to have one map (via writeOGR) which has the whole thing, and then have several maps by days.
>>
>> However, I want the whole area as defined by the entire data set to show every day.
>>
>> I looked at bbox but I can't set a bbox.
>
> I think the problem here is that writeOGR doesn't create maps, it
> creates data files.
>
> If you wnt to create a map plot that is based on the bbox of a given
> sp object, you can set up an empty plot from its bbox this way:
>
> > plot(SpatialPoints(t(bbox(m))),cex=0)

Equivalently:

plot(as(m, "Spatial"))

which drops all the unnecessary stuff. I wasn't sure what was needed, 
either. It could be an output file with the data reshaped to "wide" from 
"long", but this is just another guess.

Roger

>
> two things to note: I use cex=0 so the points dont show up (because
> type="n" doesnt work) and the bbox is transposed because of the way
> its rows and columns are arranged.
>
> Then you can add stuff to the plot area, eg the first polygon:
>
> > plot(m[1,],add=TRUE)
>
> Not sure if this is what you are really after since its not clear what
> your 'map' is and where writeOGR fits into this...
>
> Barry
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list