- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 KML {raster} 将光栅文件写入 KML,并尝试使用 MAPC2MAPC 将它们转换为在移动设备上使用。
但是,MAPC2MAPC 显然不适用于这些导出的 KML。我注意到我导出的 KML 和 Google Earth 导出的 KML 之间的唯一区别(由 MAPC2MAPC 毫无问题地转换)是命名空间定义。然后我手动修复了 kml 中的命名空间并且 MAPC2MAPC 正在工作。现在我尝试在 R 中以编程方式修复命名空间,但没有成功。
默认 KML 的顶部节点如下所示:
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<kml xmlns="http://www.opengis.net/kml/2.2">
最佳答案
试试这个:
library(XML)
# just a sample kml file... needs to be well-formed
z <-
'<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder>
<name>Some Name</name>
<Placemark>
<name>Jackson</name>
<Polygon><outerBoundaryIs><LinearRing><coordinates>-91.151982,44.136728 -91.152627,44.158372 -91.152677,44.170618 -91.152732,44.183928 -91.152372,44.187182 -91.15244,44.187307 -91.152495,44.208702 -91.152892,44.222784 -91.153829,44.24758 -91.165786,44.247429 -91.165936,44.2546 -91.166159,44.272973 -91.166311,44.303743 -91.166469,44.306118 -91.166056,44.30943 -91.165995,44.33161 -91.16614,44.334932 -91.166128,44.335102 -91.16648,44.339077 -91.165909,44.343314 -91.166149,44.34968 -91.165604,44.37626 -91.165545,44.378794 -91.164813,44.418752 -91.164768,44.42248 -91.164873,44.451251 -91.164858,44.45132 -91.164915,44.451544 -91.165155,44.473148 -91.165187,44.480189 -91.165197,44.482528 -91.165636,44.496874 -91.1657,44.498476 -91.16588,44.509756 -91.165916,44.528032 -91.165696,44.550109 -91.165666,44.565612 -91.165408,44.567894 -91.165713,44.567989 -91.165619,44.596987 -91.130969,44.596692 -91.125674,44.596666 -91.119816,44.596285 -91.114632,44.596343 -91.043609,44.596609 -91.026595,44.596426 -91.009307,44.59663 -90.992352,44.596619 -90.990775,44.596447 -90.972986,44.596516 -90.94268,44.596582 -90.92235,44.596293 -90.922637,44.591081 -90.922579,44.580701 -90.922618,44.543798 -90.922775,44.512564 -90.923104,44.509838 -90.801852,44.509573 -90.80194,44.458502 -90.801949,44.429518 -90.801928,44.422301 -90.764289,44.422345 -90.760977,44.422336 -90.72215,44.422293 -90.719005,44.422213 -90.705154,44.422289 -90.680591,44.422218 -90.619465,44.422127 -90.558746,44.42221 -90.497221,44.422613 -90.436472,44.422546 -90.397588,44.423279 -90.31605,44.424673 -90.317397,44.337429 -90.31766,44.291998 -90.317938,44.249963 -90.318107,44.248791 -90.312035,44.248758 -90.31257,44.240933 -90.3125,44.194598 -90.312225,44.19244 -90.312083,44.187037 -90.31249,44.184046 -90.312575,44.155284 -90.435728,44.161022 -90.461889,44.16082 -90.488949,44.160944 -90.49033,44.16076 -90.546446,44.160284 -90.553421,44.160309 -90.591977,44.160163 -90.653047,44.159585 -90.672674,44.159319 -90.774673,44.159056 -90.792783,44.158862 -90.817517,44.158692 -90.817713,44.158644 -90.887873,44.158429 -90.888823,44.158484 -90.8929,44.158323 -90.906152,44.158316 -90.912893,44.154445 -90.916033,44.153313 -90.919834,44.150576 -90.922496,44.147593 -90.927157,44.14646 -90.930865,44.14648 -90.936741,44.147456 -90.939122,44.147337 -90.942552,44.144407 -90.945184,44.146673 -90.947547,44.147332 -90.948945,44.146008 -90.950352,44.143296 -90.952723,44.141954 -90.956902,44.141823 -90.958111,44.140704 -90.958909,44.137424 -90.962404,44.136491 -90.9641,44.137405 -90.966729,44.136248 -90.96894,44.133218 -90.97016,44.129621 -90.971909,44.128667 -90.976753,44.129869 -90.978639,44.127998 -90.978398,44.12666 -90.97364,44.124266 -90.971168,44.122493 -90.967644,44.119582 -90.968004,44.118533 -90.970286,44.117542 -90.973565,44.116895 -90.972764,44.070775 -91.023637,44.071134 -91.04639,44.071139 -91.057154,44.071141 -91.090641,44.071239 -91.091691,44.071192 -91.111766,44.071094 -91.151768,44.071014 -91.151843,44.079656 -91.151901,44.095396 -91.151975,44.114529 -91.151982,44.136728</coordinates></LinearRing></outerBoundaryIs></Polygon>
</Placemark>
</Folder>
</Document>
</kml>'
xmlDoc <- xmlInternalTreeParse(z)
# this is the important bit...
ns <- c(gx="http://www.google.com/kml/ext/2.2",
kml="http://www.opengis.net/kml/2.2",
atom="http://www.w3.org/2005/Atom")
ensureNamespace(xmlDoc, ns)
# save it...
saveXML(xmlDoc,"sample.kml")
gx:
和
atom:
命名空间,但不会添加
kml:
命名空间(因为它已经存在)。所以我不确定它是否可以在移动设备上运行,但可以尝试一下。
关于xml - 使用 R 的 XML 包从头开始构建具有完整命名空间信息的 KML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21632399/
具体详细介绍请看下文: 在使用文件进行交互数据的应用来说,使用FTP服务器是一个很好的选择。本文使用Apache Jakarta Commons Net(commons-net-3.3.jar)
我在日志文件中收到这些警告: WARN 2013-01-15 00:08:15,550 org.eclipse.jetty.http.HttpParser- HttpParser Full for
我在使用特定网页时遇到问题。当我按下链接时,我收到应用程序错误(不是 http 错误等,而是应用程序级别错误)。 但是我打开了开发人员工具和网络控制台,我看到没有请求发送到服务器。 所以我双击并选择查
我没有组装经验,但这是我一直在做的。如果在通过程序集中的指针传递参数和调用函数时缺少任何基本方面,我希望输入。 例如,我想知道是否应该还原ecx,edx,esi,edi,。我读到它们是通用寄存器,但我
我没有组装经验,但这是我一直在做的。如果在通过程序集中的指针传递参数和调用函数时缺少任何基本方面,我希望输入。 例如,我想知道是否应该还原ecx,edx,esi,edi,。我读到它们是通用寄存器,但我
我正在尝试创建完整 uiscrollview 的快照,所有内容大小,我已经搜索了很多,并且我在 SO 上找到了一些东西,如下所示: Getting a screenshot of a UIScroll
我想复制一个包含以下结构的Vector,对我来说重要的是在修改复制的 vector 时保持原始Vector完整: public class objet_poid_n { public int
给定一个示例字符串 s = '嗨,我的名字是 Humpty-Dumpty,来自“爱丽丝,爱丽丝镜中奇遇记”',我想将其分成以下 block : # To Do: something like {l =
已关闭。此问题旨在寻求有关书籍、工具、软件库等的建议。不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以
我正在尝试创建一个正则表达式来查找文本中的 Linux 文件路径,但是正则表达式对我来说非常陌生。我有下面的代码片段,它将识别下面文件结构的开头。 .*(/bin/|/home/).* 完成正则表达式
我正在寻找远程托管的 JPG 的尺寸、宽度和高度。我已经了解了如何通过下载完整图像来执行此操作。 但是,如果我可以通过仅下载足以获取此信息的方式来做到这一点,那将是理想的。 典型的图像大小为 200K
有没有办法让下面的代码: import traceback def log(message): print "%s: %s" %(traceback.extract_stack()[0:-1]
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 3 年前。 Improve this qu
git show 显示了修订版中所做的所有更改。但是,它会打印出所有更改——而不仅仅是文件名。 git show --stat 只显示文件名,但它把它们截断了!有没有办法获得已更改文件名的完整列表?
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想要改善这个问题吗?更新问题,以便将其作为on-topi
当我在模板中调用我的模型 get_absolute_url 方法时,我想要一个绝对/完整的 url。在我的入门模型中,我有以下内容: def get_absolute_url(self): r
我正在使用 jQuery 1.5.1 这是我的代码: $('.cellcontent').animate({ left: '-=190'}, { easing: alert('start
我正在使用下面的方法删除条形图并使用新数据更新条形图,但这样做时出现了一个小故障/完整的图表消失 1 秒,直到加载新数据。但是是否可以通过仅增加/减少柱形而不实际消失图表来实现相同的目的。 d3.se
基于 this question 中的讨论,任何人都可以提供代码或代码链接,显示 NumericLiteralX 模块的完整实现(例如 this one )?我对 NumericLiteralX 模块
我的目标是检索网站的 html,并将其转换为可读的String。我下面的代码可以工作,但我遇到了一个技术问题:当我尝试检索 http://time.gov/HTML5 的 html 时,我在 andr
我是一名优秀的程序员,十分优秀!