[R-sig-Geo] Reducing the size of the R-produced maps while saving

Karl Ove Hufthammer karl at huftis.org
Fri Feb 3 22:36:01 CET 2012


fr. den 03. 02. 2012 klokka 20.25 (+0100) skreiv Roger Bivand:
> > Couldn’t (part of) the problem also be that the map object contains much 
> > more information than what is displayed? I have experienced this when 
> > plotting small parts of large maps using xlim and ylim. The resulting map 
> > displayed on screen and saved in a vector format (e.g., PDF) would show just 
> > the few countries within the xlim and ylim boundaries, but the file would 
> > actually contain (for example) the entire Eurasia continent (this could be 
> > seen by opening the file in Inkscape and moving map outlines or changing the 
> > boundary box).
> 
> Could you provide an example? 

I think one example is the GSHHS map (especially the non-coarse
versions) if you *don’t* clip it to the bounding box. But when I tried
reproducing it now, I only get an error message:
  
$ library(maptools)
$ x=getRgshhsMap(xlim=c(0,30), ylim=c(55,75), no.clip=TRUE)
Data are polygon data
Data are polygon data
Feil: TopologyException: side location conflict at -178.44555049573185
65.525617234053172

With ‘no.clip=FALSE’, it works fine.

$ sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-suse-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=nn_NO.UTF-8       LC_NUMERIC=C               LC_TIME=nn_NO.UTF-8       
[4] LC_COLLATE=nn_NO.UTF-8     LC_MONETARY=nn_NO.UTF-8    LC_MESSAGES=nn_NO.UTF-8   
[7] LC_PAPER=C                 LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=nn_NO.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
  [1] rgeos_0.2-2     stringr_0.6     maptools_0.8-14 lattice_0.20-0  sp_0.9-94       foreign_0.8-48 

loaded via a namespace (and not attached):
  [1] grid_2.14.1  plyr_1.7.1   tools_2.14.1

-- 
Karl Ove Hufthammer
http://huftis.org/
Jabber: karl at huftis.org



More information about the R-sig-Geo mailing list