Я пытаюсь преобразовать некоторые координаты LAT, LON в национальную сетку. Я был бы признателен за вашу помощь, поскольку я часами искал ответ.
Консоль в anaconda / spyder выдает ошибку: RuntimeError: b'no arguments in initialization list'
Мой код:
import geopandas as gpd
import pandas as pd
import shapely
postcodeDF = pd.DataFrame({'lp': ['1', '2', '3', '4', '5'],
'nazwa': ['Aleksandrów Kujawski', 'Aleksandrów Łódzki', 'Alwernia', 'Andrychów', 'Annopol'],
'szer_geo': [52.875, 51.820278, 50.06861, 49.855278, 50.885278],
'dlug_geo': [18.694722, 19.305, 19.54194, 19.345, 21.854]})
crs = {'init':'epsg:4326'}
geometry = [shapely.geometry.Point(xy) for xy in zip(postcodeDF['dlug_geo'], postcodeDF['szer_geo'])]
postcodeGDF = gpd.GeoDataFrame(postcodeDF,
crs = crs,
geometry = geometry)
postcodeGDF['geometry'] = postcodeGDF['geometry'].to_crs('+proj=tmerc +lat_0=0 +lon_0=19 +k=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs')
postcodeGDF.plot()
print(gpd.show_versions())
дает:
SYSTEM INFO
-----------
python : 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
executable : C:\Anaconda3\pythonw.exe
machine : Windows-10-10.0.18362-SP0
GEOS, GDAL, PROJ INFO
---------------------
GEOS : None
GEOS lib : None
GDAL : 2.3.3
GDAL data dir: None
PROJ : 0.5.20
PROJ data dir:
PYTHON DEPENDENCIES
-------------------
geopandas : 0.6.3
pandas : 0.25.1
fiona : 1.8.4
numpy : 1.16.5
shapely : 1.6.4.post2
rtree : 0.9.4
pyproj : 1.9.6
matplotlib : 3.1.1
mapclassify: None
pysal : None
geopy : None
psycopg2 : None
На консоли отображается такая информация:
runfile('D:/Dydaktyka/SIPwT (1z2)/test.py', wdir='D:/Dydaktyka/SIPwT (1z2)')
0 POINT (18.69472 52.87500)
1 POINT (19.30500 51.82028)
2 POINT (19.54194 50.06861)
3 POINT (19.34500 49.85528)
4 POINT (21.85400 50.88528)
Name: geometry, dtype: geometry
Traceback (most recent call last):
File "<ipython-input-1-6c6c8104c1e8>", line 1, in <module>
runfile('D:/Dydaktyka/SIPwT (1z2)/test.py', wdir='D:/Dydaktyka/SIPwT (1z2)')
File "C:\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/Dydaktyka/SIPwT (1z2)/test.py", line 28, in <module>
postcodeGDF['geometry'] = postcodeGDF['geometry'].to_crs('+proj=tmerc +lat_0=0 +lon_0=19 +k=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs')
File "C:\Anaconda3\lib\site-packages\geopandas\geoseries.py", line 423, in to_crs
proj_in = pyproj.Proj(self.crs, preserve_units=True)
File "C:\Anaconda3\lib\site-packages\pyproj\__init__.py", line 362, in __new__
return _proj.Proj.__new__(self, projstring)
File "_proj.pyx", line 129, in _proj.Proj.__cinit__
RuntimeError: b'no arguments in initialization list'