[R-sig-Geo] Even simpler TM_WORLD_BORDERS_SIMPLE (AND SP???)

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Jan 30 07:47:05 CET 2009



Jim Burke wrote:
> OK I am on decaf coffee now. I reinstalled R and
> all is well now.
>
> Now Hans, below is what I get when I run your code.
> Is this expected? Quick and certainly DIRTY.
>
> > library("maptools")
> Loading required package: foreign
> > 
> load(url("http://spatial.nhh.no/R/etc/TM_WORLD_BORDERS_SIMPL-0.2.RData"))
> > wrld_simpl <- wrld_simpl[wrld_simpl$NAME != "Antarctica",]
> Warning message:
> closing unused connection 3 
> (gzcon(http://spatial.nhh.no/R/etc/TM_WORLD_BORDERS_SIMPL-0.2.RData))
> > for (i in (1:length(wrld_simpl at polygons))) {
> + polyCnt <- length(wrld_simpl at polygons[[i]]@Polygons)
> + if(polyCnt > 2) {
> + pO <- sapply(wrld_simpl at polygons[[i]]@Polygons, function(x) 
> {slot(x,'area')>0.1})
> + new_pO <- pO[ wrld_simpl at polygons[[i]]@plotOrder ]
> + wrld_simpl at polygons[[i]]@plotOrder <- 
> wrld_simpl at polygons[[i]]@plotOrder[ new_pO ]
> + }
> + }
> > save(wrld_simpl,'SIMPLEMAP.Rdata')
> Error in save(wrld_simpl, "SIMPLEMAP.Rdata") :
> object ‘SIMPLEMAP.Rdata’ not found
How about taking a look at the help pages of the save command?
--
Edzer
>
>
>
>
> Thanks,
> Jim Burke
>
> Jim Burke wrote:
>> Thanks Hans,
>>
>> Its been a day or so since I have used R graphics.
>> Now sp seems to lack grid. I cannot run my tried and
>> true graphics workspace at all.
>>
>> Are you folks having any trouble? What am I doing
>> wrong?
>>
>> Below
>> 1. try to load library sp. No go.
>> 2. download sp from Berkeley (US1). Different errors
>>
>>  > library(sp)
>> Error : package 'grid' does not have a name space
>> Error: package/namespace load failed for 'sp'
>>  > chooseCRANmirror()
>>  > utils:::menuInstallPkgs()
>> trying URL 
>> 'http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.8/sp_0.9-29.zip'
>> Content type 'application/zip' length 845890 bytes (826 Kb)
>> opened URL
>> downloaded 826 Kb
>>
>> package 'sp' successfully unpacked and MD5 sums checked
>>
>> The downloaded packages are in
>>         C:\Documents and Settings\Jim Burke\Local 
>> Settings\Temp\RtmpqCMAZS\downloaded_packages
>> updating HTML package descriptions
>> Warning message:
>> dependency 'grid' is not available
>>  >
>>
>> Thanks,
>> Jim Burke
>>
>>
>>
>> Hans-Jörg Bibiko wrote:
>>  
>>> On 29.01.2009, at 16:49, Jonathan Callahan wrote:
>>>    
>>>> Is anyone aware of an even more simplified version of the data that 
>>>> went
>>>> into creating TM_WORLD_BORDERS_SIMPL-0.2.RData so that we might have
>>>> TM_WORLD_BORDERS_LOWRES.RData for use cases like my own.
>>>>       
>>> A very quick solution would be to filter out all irrelevant small 
>>> polygons (islands).
>>> [to reduce the number of polygon points would lead to very unshaped 
>>> boundaries, I mean]
>>>
>>> What is an irrelevant polygon? My first approach is if a country 
>>> consists of more than 2 polygons then draw only those which are 
>>> greater than a given area let's say 0.1 .
>>>
>>> To achieve that without recreating the entire 
>>> SpatialPolygonsDataFrame one could simply change the plotOrder of 
>>> each PolygonsList and save it.
>>>
>>> Like that quick&dirty script:
>>>
>>> library("maptools")
>>> load(url("http://spatial.nhh.no/R/etc/TM_WORLD_BORDERS_SIMPL-0.2.RData")) 
>>>
>>> wrld_simpl <- wrld_simpl[wrld_simpl$NAME != "Antarctica",]
>>> for (i in (1:length(wrld_simpl at polygons))) {
>>>   polyCnt <- length(wrld_simpl at polygons[[i]]@Polygons)
>>>   if(polyCnt > 2) {
>>>     pO <- sapply(wrld_simpl at polygons[[i]]@Polygons, function(x) 
>>> {slot(x,'area')>0.1})
>>>     new_pO <- pO[ wrld_simpl at polygons[[i]]@plotOrder ]
>>>     wrld_simpl at polygons[[i]]@plotOrder <- 
>>> wrld_simpl at polygons[[i]]@plotOrder[ new_pO ]
>>>   }
>>> }
>>> save(wrld_simpl,'SIMPLEMAP.Rdata')
>>>
>>>
>>>
>>> --Hans
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>
>>>     
>>
>>
>>     [[alternative HTML version deleted]]
>>
>>   
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> 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

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de




More information about the R-sig-Geo mailing list