[R-sig-Geo] map2SpatialPolygons' 'proj4string' in spmaps

Roger Bivand Roger.Bivand at nhh.no
Wed Oct 15 19:24:18 CEST 2008


On Wed, 15 Oct 2008, Sebastian P. Luque wrote:

> Hi,
>
> I don't understand what the 'proj4string' argument in
> map2SpatialPolygons() does.  map() in the maps package has a
> 'projection' argument:
>
> ,-----[ *help[R](map)* ]
> | projection: character string that names a map projection to use. See
> |           'mapproject' (in the 'mapproj' library). The default is to
> |           use a rectangular projection with the aspect ratio chosen so
> |           that longitude and latitude scales are equivalent at the
> |           center of the picture.
> `-----
>
> so I don't know what projection was actually used in a given map() call
> with that default 'projection' argument.  I suppose 'proj4string' in
> map2SpatialPolygons() should match the actual projection used in the
> map() call, shouldn't it?  Thanks.
>

No, not at all. The coordinates returned by map() if projection= is used 
are only for plotting, are in arbitrary units, and are only documented in 
code. map2SpatialPolygons() assumes that the data are in geographical 
coordinates, and ought perhaps to guess an ellipse and datum based on the 
age of the dataset (world possibly WGS84, US counties probably NAD27), but 
allows the user to set the CRS object directly. The projection= argument 
of map() makes the function call mapproject() with the given projection on 
the data flowing through, I believe.

If you do str() of map(projection=) output, you will see the projection 
name used, but note that the coordinates are arbitrary.

Roger

>
> Cheers,
>
>

-- 
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