Skip to content

maps to PBSmapping conversion

3 messages · Roger Bivand, Ted Rosenbaum

#
On Thu, 25 Nov 2010, Ted Rosenbaum wrote:

            
map() and plootMap() have different pen-up and pen-down conventions. The 
easiest correction is:

md <- map('state','maryland',interior=FALSE, plot=FALSE, fill=TRUE)
spmd <- map2SpatialLines(md)
xx <- SpatialLines2PolySet(spmd)
plotMap(xx)

where fill=TRUE reverses those lines that do not connect. I think that a 
PolySet thinks that it is a polygon, with fill=FALSE you get 11 lines, 
which although they are converted correctly with correct PID, seem to be 
closed by plotMap(). Indeed, using plotLines() instead of plotMap() 
achieves the effect you want (but with an odd axis artefact - plotLines() 
probably assumes that it is being added to an existing plot, and doesn't 
seem to set aspect correctly), plotMap() imposes the assumption that you 
have polygons.

Why not just plot(spmd)? Are you sure about the datum in your spatial 
reference (if it matters for you)?

Roger