import gdal ломает красивую геометрию - PullRequest
0 голосов
/ 10 июля 2020

Я обнаружил странную ошибку в своем коде, использующем библиотеки gdal и shapely, и сузил ее до этого воспроизводимого примера. Когда я вызываю красивую функцию LinearRing после импорта gdal, я получаю valueError.

import gdal
from shapely.geometry import  LinearRing

xy = [[-0.47486949, -0.88005623],
 [-0.34778166, -0.93757555],
 [-0.20477201, -0.97868982],
 [-0.0849363 , -0.96742823],
 [ 0.00251463, -0.9127174 ],
 [ 0.11352044, -0.80900363],
 [-0.71757589,  0.68140257],
 [-0.85337551,  0.51307985],
 [-0.94632047,  0.32239291],
 [-0.9968906 ,  0.07879802],
 [-0.99641132, -0.0846433 ],
 [-0.95748479, -0.28848377],
 [-0.90551044, -0.42432398],
 [-0.77490615, -0.6320763 ],
 [-0.65297609, -0.75737852],
 [-0.47486949, -0.88005623]]
 
L = LinearRing(xy)

Возвращает эту ошибку:

Traceback (most recent call last):
  File "<tmp 4>", line 21, in <module>
    L = LinearRing(xy)
  File "C:\Users\MyRealName\Anaconda3\envs\horpy3\lib\site-packages\shapely\geometry\polygon.py", line 55, in __init__
    self._set_coords(coordinates)
  File "C:\Users\MyRealName\Anaconda3\envs\horpy3\lib\site-packages\shapely\geometry\polygon.py", line 70, in _set_coords
    ret = geos_linearring_from_py(coordinates)
  File "shapely\speedups\_speedups.pyx", line 401, in shapely.speedups._speedups.geos_linearring_from_py
ValueError: GEOSGeom_createLinearRing_r returned a NULL pointer
...