简体   繁体   English

是否有使用R的shapefile与pdf dev.off()类似的东西

[英]Is there something similar to pdf dev.off() for shapefiles using R

Is there something similar to 是否有类似的东西

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

for shapefiles ?? 对于shapefile?

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. 不会有R系统可以解析pdf文件,甚至无法编辑pdf文件。 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. 我想你可以调用system()与ImageMagick的呼叫,但是这将是很荒谬。你需要为使用latticeggplot2文件创建之前,当你想要做的增量增加的R剧情对象...。 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. 您将能够使用postscript()设备创建一个.eps文件,并且如果它具有透明背景,则应该可以将结果用作覆盖。

This is not how shapefiles work. 这不是shapefile的工作方式。 You cannot combine more than one geometry in a shapefile. 您不能在一个shapefile中组合多个几何图形。 So, you can have a point shapefile, a line shapefile, or a polygon shapefile, but not a combination of these. 因此,您可以具有点shapefile,线shapefile或多边形shapefile,但不能同时使用它们。

To save a particular layer as a shapefile, you could use writeOGR(...) in package rgdal . 要将特定图层另存为shapefile,可以在包rgdal使用writeOGR(...) But then you would have to combine the layers later using a GIS program. 但是随后您将不得不使用GIS程序将这些图层组合在一起。

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. 最后,kml规范的确在单个kml文件中允许多个几何,但是R(我知道)无法在R中创建这样的kml文件。 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. 另一方面,由于kml是XML词汇表,因此您可以编写一个程序,以这种方式将所有几何形状组合到单个kml文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM