两个GIS编程技巧
Jquery如何获得在同一XML文档中的多个namespace下的属性值?
对于GIS编程,一定会遇到处理多个namespace的XML文档,简单的例子,就拿GeoRSS来说,他就经常带着atom,geo,rss等多个namespace,看了很多国内的文献都没有一个很好的解答,一般来说,比如
<atom :entry xmlns:atom="http://www.w3.org/2005/Atom"></atom> <atom :content type="text">blah blah</atom>
会用 $(xml).find(‘atom\\:content’).eq(0).text() 语句来获取atom中content 标签的值。也就是说,用 “\\”。但是有个问题,因为年久未看,好象是google chrome还是IE 8不支持这种方法。比较好的方式是
jQuery(entries).find("[@nodeName=namespace:elementName]");也就是用@nodeName=namespace:elementName的方式获得。详见http://www.nabble.com/namespaces-XML-parsing-td22583488s27240.html的第二篇回帖。
——————————————————————-
第二个问题就是上次帮andrei找如何获得地表上任意经纬度的高程值。我用firebug稍微hacking了一下USGS的一个小的WebServices。如下
http://gisdata.usgs.net/xmlwebservices2/(S(iciielatfvaogp3vexkkn1vy))/elevation_result2.aspx?X=-80.47201518072289&Y=42.16883603773585
x为经度,y为纬度。然后就会通过http返回其高程值(feet),返回结果如下所示
Elevation at -80.47201518072289,42.16883603773585 = 570.301846882179 FEET ( NED 1/3rd arc-second: Eastern United States )
好处在于,可以提供程序获得任何点的高程值只要usgs一直暴露这个webservice。
No related posts.
About this entry
You’re currently reading “两个GIS编程技巧,” an entry on Geoinformatics
- Published:
- 6.18.09 / 8上午
Ajax ArcGIS Dreams Flex Geography Geoinformatics GeoRSS GIS Google Hardware Harvard History Jquery Linux Love Map MapServer NASA OGC OpenGIS OSGeo PHP Politics PostGIS PostgreSQL Python R Social Network SVG Ubuntu Web WebGIS Wordpress 中国 历史地理 宋朝 开源 新儒学 生活 遥感
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.














赵 博 (Bo Zhao),
参与或主持的项目
No comments
Jump to comment form | comments rss [?] | trackback uri [?]