我一直在按照用户pelson的指示创建一个填充了国家形状的地图。(Fill countries in python basemap)
现在我很想把这一点再往前推进一步,然后创建一个这样的html站点: http://www.ethnologue.com/region/NEU 我不需要那些花哨的弹出窗口,但那些链接(http://www.w3schools.com/tags/att_area_href.asp)对每个国家将是非常好的。 可以用cartopy创建这些坐标列表吗? 我正在寻找一个完全自动的脚本生成一个静态html文件。在
是的,这是绝对可能的,但是如果您正在制作基于web的地图,那么您可能需要看看D3.js(特别是,对于地图,请参阅这个优秀的教程http://bost.ocks.org/mike/map/)。在
不过,对于cartopy,我将一步一步地完成这一步,因为这是matplotlib和cartopy中转换系统的一个很好的演练。在
首先,我们可以得到图形中任意点的像素坐标:
现在,我们已经掌握了编写代码以生成区域地图所需的信息,我已经着手编写了完整的注释(<;80行)。我把这篇文章作为一个要点(https://gist.github.com/pelson/6308997)发布,这样你可以查看一下,如果你愿意的话,可以试一试。对于结果的实时演示:https://rawgithub.com/pelson/6308997/raw/map.html
相关问题 更多 >
编程相关推荐