Skip to content
Prev 19965 / 29559 Next

ggmap::fortify()

Thanks.

The example with an spatial polygons DF in p. 159 of
http://journal.r-project.org/archive/2013-1/kahle-wickham.pdf
works nicely.

Instead, fortify() refuses processing spatial poins or pixels DF
with an error:
Error: ggplot2 doesn't know how to deal with data of class
SpatialPixelsDataFrame

Based on what you say, using
adf <- dataframe(a)
where a is an spatial points DF in epsg 4326 (== CRS("+proj=longlat
+ellps=WGS84 +no_defs"))
results into a dataframe adf that is as the table of a but including
the coordinates as well.
Then doing the equivalent to that explained in the pdf for the
polygons seems to work.
It might be that for the case of spatial points DF, dataframe() is
enough and fortify() is just not required.

Agus



On Mon, Dec 9, 2013 at 7:18 PM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote: