[R-sig-Geo] plot.Map deprecated, alternative ?

Roger Bivand Roger.Bivand at nhh.no
Thu Nov 1 16:12:03 CET 2007


On Thu, 1 Nov 2007, Markus Loecher wrote:

> Dear all,
> I understand that plot.Map (the default method for plotting shape objects) is deprecated, however I have not found a working method converting my shape file into either a polylist or sp class.
> I tried the following
>   p2roads <- read.shape("sf.shp")
>  SF.map <- Map2poly(p2roads)
> where sf.shp is a shape object of the San Francisco street map, and get the following error message:
>   Error in Map2poly(p2roads) : maptype not poly
> Are there differences between shape files ? Which other way could I try to convert my shape object so that plot.Spatial will work ?

For example:

library(maptools)
getinfo.shape("sf.shp")
# presumably lines
roads <- readShapeLines("sf.shp")
class(roads)
plot(roads, axes=TRUE)

or

library(rgdal)
roads <- readOGR(".", "sf")
class(roads)
plot(roads, axes=TRUE)

Roger


>
> Thanks !
>
> Markus
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> 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