如何在 Python matplotlib Basemap 中获取绘制地图元素的坐标? [英] How to get the coordinates of drawn map elements in Python matplotlib Basemap?

查看:81
本文介绍了如何在 Python matplotlib Basemap 中获取绘制地图元素的坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检索 Basemap 用于绘制大盐湖的点

I want to retrieve the points Basemap uses to draw the Great Salt Lake

推荐答案

在创建地图元素后,即 m = Basemap(),得到这样的顶点...

After you have created a map element, i.e. m = Basemap(), get the vertices like this...

m.drawcoastlines().properties()['paths'][0].vertices # Lake outline
m.drawcoastlines().properties()['paths'][1].vertices # Island outline

针对绘制轮廓的每个点返回纬度/经度对数组.

Which returns arrays of latitude/longitude pair for each point used to draw the outline.

array([[-112.766113281, 41.660003662],
       [-112.782218933, 41.643051147],
       [-112.786392212, 41.619445801],
       ....and so on]])

我想你可以对绘制的州、县等进行同样的操作.

I imagine you can do the same for drawn states, counties, etc.

这篇关于如何在 Python matplotlib Basemap 中获取绘制地图元素的坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆