[R-sig-Geo] how to change provincial boundaries and combine two regions

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri May 6 13:46:30 CEST 2011


On Fri, May 6, 2011 at 11:56 AM, 王国成 <wangguocheng1986 at gmail.com> wrote:
> Hi, all
> I recently have a problem about Chinese map drawing. The original code as
> follows:
>
> *library(maps)
> library(mapdata)
> map('china')*
>
> This is a China map with provincial boundaries. First, how to change the
> boundaries into dashed lines? Second, how to combine two regions (like Xin
> Jiang and Tibet) together and create a new bold boundary of this new region
> combined by Xin Jiang and Tibet?

 ?map says:

     ...: Extra arguments passed to ‘polygon’ or ‘lines’.

 and if you read ?lines and ?polygon you'll see that dashed lines can
be drawn using the lty parameter.

map("china",lty=2) will get you dashed lines.

 Your second question is a bit harder. The china data in the mapdata
package seems to not have the region names, and merging regions from
maps package data format might be a bit tricky.

 Try getting China map data in shapefile or RData format from
www.gadm.org - then you can merge areas using some of the functions of
the sp package, or you can do it interactively using a GIS - I
recommend Quantum GIS as a free, open-source package which can do this
kind of editing very easily.

Barry



More information about the R-sig-Geo mailing list