I working with spatial data in R for a commercial application and would like to use ggplot2 for data visualization. If you run the Hadley's example at https://github.com/hadley/ggplot2/wiki/plotting-polygon-shapefiles you find that in order to run the fortify
command you need to enable the use of gpclib tools using gpclibPermit()
.
I'm looking for an efficient way (that doesn't involve manually hacking into the S4 object) to perform the same operation that fortify
does here, i.e. take a spatial polygon object and turn it into a regular data frame where row entries contain latitudinal and longitudinal coordinates along with a polygon id.
Has anyone else solved this one?