如何在 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.