CRSError: The WKT could not be parsed. #2964
Unanswered
shdlovezxm
asked this question in
Q&A
Replies: 1 comment
-
reinstalling |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, my code has encountered an error. Can you help me?
%matplotlib inline
import contextily as cx
import geopandas
import matplotlib.pyplot as plt
data_url = './sp_blg_adbscan_city_boundaries_v1.gpkg'
db = geopandas.read_file(data_url)
ax = db.plot(color="red", figsize=(9, 9))
cx.add_basemap(ax)
print(db.crs.to_string())
ax = db.plot(color="red", figsize=(9, 9))
cx.add_basemap(ax, crs=db.crs.to_string())
CPLE_BaseError Traceback (most recent call last)
File rasterio\crs.pyx:775, in rasterio.crs.CRS.from_user_input()
File rasterio\_err.pyx:209, in rasterio._err.exc_wrap_ogrerr()
CPLE_BaseError: OGR Error code 6
During handling of the above exception, another exception occurred:
CRSError Traceback (most recent call last)
Cell In[6], line 2
1 ax = db.plot(color="red", figsize=(9, 9))
----> 2 cx.add_basemap(ax, crs=db.crs.to_string())
File ~\anaconda3\envs\mtpy_v2\lib\site-packages\contextily\plotting.py:125, in add_basemap(ax, zoom, source, interpolation, attribution, attribution_size, reset_extent, crs, resampling, **extra_imshow_args)
123 # Convert extent from
crs
into WM for tile query124 if crs is not None:
--> 125 left, right, bottom, top = _reproj_bb(
126 left, right, bottom, top, crs, "epsg:3857"
127 )
128 # Download image
129 image, extent = bounds2img(
130 left, bottom, right, top, zoom=zoom, source=source, ll=False
131 )
File ~\anaconda3\envs\mtpy_v2\lib\site-packages\contextily\plotting.py:215, in _reproj_bb(left, right, bottom, top, s_crs, t_crs)
214 def _reproj_bb(left, right, bottom, top, s_crs, t_crs):
--> 215 n_l, n_b, n_r, n_t = transform_bounds(s_crs, t_crs, left, bottom, right, top)
216 return n_l, n_r, n_b, n_t
File ~\anaconda3\envs\mtpy_v2\lib\site-packages\rasterio\warp.py:147, in transform_bounds(src_crs, dst_crs, left, bottom, right, top, densify_pts)
113 def transform_bounds(
114 src_crs,
115 dst_crs,
(...)
119 top,
120 densify_pts=21):
121 """Transform bounds from src_crs to dst_crs.
122
123 Optionally densifying the edges (to account for nonlinear transformations
(...)
145 Outermost coordinates in target coordinate reference system.
146 """
--> 147 src_crs = CRS.from_user_input('EPSG:3857')
148 dst_crs = CRS.from_user_input(dst_crs)
149 return _transform_bounds(
150 src_crs,
151 dst_crs,
(...)
156 densify_pts,
157 )
File rasterio\crs.pyx:777, in rasterio.crs.CRS.from_user_input()
CRSError: The WKT could not be parsed. OGR Error code 6
Beta Was this translation helpful? Give feedback.
All reactions