基础地图值必须介于90度和90度之间

2024-09-30 10:37:15 发布

您现在位置:Python中文网/ 问答频道 /正文

目标

  • 将GIS、shapefile(县边界)上载到Basemap
  • 使用Basemap绘制县边界
  • 确定位置是否在边界内
  • 根据其落入的边界,为点指定权重
  • 利用DBSCAN根据坐标和权重发现簇中心线

方法

使用this tutorial on Basemap,上载一个用于映射的shapefile。

#First, we have to import our datasets. 
#These datasets include store locations, existing distribution locations, county borders, and real estate by county
walmartStores = pd.read_csv("data/walmart-stores.csv",header=0, encoding='latin1')
propertyValues = pd.read_csv("data/property values.csv")
shp = fiona.open('data/boundaries/Counties.shp')


#We need to create a workable array with Walmart Stores
longitude = walmartStores.longitude
latitude = walmartStores.latitude
stores = np.column_stack((longitude, latitude))

#We also need to load the shape file for county boundaries
extra = 0.1 
bds = shp.bounds 
shp.close()

#We need to assign the lower-left bound and upper-right bound
ll = (bds[0], bds[1])
ur = (bds[2], bds[3])


#concatenate the lower left and upper right into a variable called coordinates
coords = list(chain(ll, ur))
print(coords)

#define variables for the width and the height of the map
w, h = coords[2] - coords[0], coords[3] - coords[1]

带^{cd1>}=^{cd2>}

到目前为止一切都很好,但是我遇到了以下问题:

^{pr2}$

Error: lat_0 must be between -90.000000 and 90.000000

问题

  1. lat_U0和lon_u0不在-90到90之间。但是,lon_u0不会抛出错误。为什么会这样?
  2. 我在网上找过其他面临类似问题的人,却空手而上。我的笔记本有什么特别的吗?(注意:^{cd3>}显示了`basemap 1.0.7,因此我知道它已安装并正在运行

谢谢!


Tags: andcsvthetodatacoordsneed边界
1条回答
网友
1楼 · 发布于 2024-09-30 10:37:15

纬度只能在-90到90之间-其他任何东西都没有意义。北极是+90,南极是-90,赤道在0。没有其他可接受的值!在

至于长度,它只能在-180和180之间。0在本初子午线,向-180(向西)和+180(向东)

相关问题 更多 >

    热门问题