python断言失败,Python底图“断言失败”

I am using Anaconda 2.1.0 and Basemap installation is successful

conda install basemap

conda install gdal

I have geos version 3.3.3 and proj4 4.8.0-0. However, I keep getting the following error when I try to project (lat,lon) degrees to a planar:

Assertion failed: (0), function query, file AbstractSTRtree.cpp, line 286.

My code looks like this:

import shapely.geometry as sg

from pymongo import MongoClient

from mpl_toolkits.basemap import Basemap

p = Basemap(projection='sinu',lon_0=0,resolution='c')

projected_xy = p(24.4,45.1)

解决方案

I was running into the same issues when working with geopandas. Again, the order of imports was relevant. In this case, I had to import geopandas after Basemap. My list of imports looks as follows:

from mpl_toolkits.basemap import Basemap

import geopandas as gp

from shapely.geometry import Point, Polygon, MultiPoint, MultiPolygon

from shapely.prepared import prep

Note that if you are working in a Jupyter notebook your Kernel connection will crash and no information of the error will be given. After using the python shell, the following error was given:

Assertion failed: (0), function query, file AbstractSTRtree.cpp, line 285.

Abort trap: 6

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值