سؤال

Is there something similar to

pdf(...)
plot commands
...
...
dev.off()

for shapefiles ??

I´d like to save the final plot figure with shapes+points+legend for further overlaying on other map.

هل كانت مفيدة؟

المحلول

There would be no R system that could parse the pdf file or even do editing to a pdf file. I suppose you could call system() with an ImageMagick call but that would be kind of ridiculous.. You need to use either lattice or ggplot2 when you want to do incremental additions to an R plot object ... before file creation. You would be able to create an .eps file using the postscript() device and if it had a transparent background you should be able to use the result as an overlay.

نصائح أخرى

This is not how shapefiles work. You cannot combine more than one geometry in a shapefile. So, you can have a point shapefile, a line shapefile, or a polygon shapefile, but not a combination of these.

To save a particular layer as a shapefile, you could use writeOGR(...) in package rgdal. But then you would have to combine the layers later using a GIS program.

Finally, the kml specification does allow multiple geometries in a single kml file, but there is no way in R (that I am aware of) to create such a kml file. On the other hand, since kml is an XML vocabulary, you might be able to write a program to combine all the geometries into a single kml file that way.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top