Can't change crs
See original GitHub issueHi, I can’t make this toy example work:
from shapely.geometry import Point
s = geopandas.GeoSeries([Point(4.42, 50.4), Point(4.43, 50.2)])
s.crs = {'init': 'epsg:4326', 'no_defs': True}
s.to_crs(epsg=31370)
It yelds to:
---------------------------------------------------------------------------
CRSError Traceback (most recent call last)
<ipython-input-153-c63352d64344> in <module>
1 s = geopandas.GeoSeries([Point(4.42, 50.4), Point(4.43, 50.2)])
2 s.crs = {'init': 'epsg:4326', 'no_defs': True}
----> 3 s.to_crs(epsg=31370)
/opt/conda/lib/python3.7/site-packages/geopandas/geoseries.py in to_crs(self, crs, epsg)
302 except TypeError:
303 raise TypeError('Must set either crs or epsg for output.')
--> 304 proj_in = pyproj.Proj(self.crs, preserve_units=True)
305 proj_out = pyproj.Proj(crs, preserve_units=True)
306 if _PYPROJ2:
/opt/conda/lib/python3.7/site-packages/pyproj/proj.py in __init__(self, projparams, preserve_units, **kwargs)
293 '116.366 39.867'
294 """
--> 295 self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs)
296 # make sure units are meters if preserve_units is False.
297 if not preserve_units and "foot" in self.crs.axis_info[0].unit_name:
/opt/conda/lib/python3.7/site-packages/pyproj/crs.py in from_user_input(cls, value)
222 return cls.from_epsg(value)
223 elif isinstance(value, dict):
--> 224 return cls(**value)
225 elif isinstance(value, string_types):
226 return cls.from_string(value)
/opt/conda/lib/python3.7/site-packages/pyproj/crs.py in __init__(self, projparams, **kwargs)
144 # on case-insensitive filesystems).
145 projstring = projstring.replace("+init=EPSG", "+init=epsg").strip()
--> 146 super(CRS, self).__init__(projstring)
147
148 @classmethod
pyproj/_crs.pyx in pyproj._crs._CRS.__init__()
CRSError: Invalid projection: +init=epsg:4326 +no_defs +type=crs: (Internal Proj Error: proj_create: cannot expand +init=epsg:4326 +no_defs +type=crs)
What am I doing wrong?
Using:
- Python 3.7.3
- Jupyter Docker image jupyter/scipy-notebook latest
- conda 4.6.14
- pyproj ‘2.1.3’
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
QGIS - cannot change CRS of shapefile - Stack Overflow
Here is the steps that you must to follow to change CRS of a SHP: Open a new project and add your layer...
Read more >Layer disappears when changing from CRS in degrees to ...
It seems that whenever I try with different CRS in UTM, the layer doesn't show. Does this mean that the polygons are somehow...
Read more >Can't change the crs with coord_sf() · Issue #1645 · r-spatial/sf
I have an issue while trying to change the projection of natural earth data using the coord_sf() function from ggplot.
Read more >How to change the CRS of your shapefile with QGIS
If you can't see your shapes or dots or whatnot, right-click your layer and select Zoom to Layer . It should take you...
Read more >CRS of a new shapefile doesn't match CRS of the project
If you create a new layer, it does not have a CRS when you load it (after creation). It is created on disk...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
SOLVED
It was pyproj 2.1.3. By setting it to 1.9.6, it works. Spotted on the list on dependencies that conda uses. Dockerized Jupyter makes just difficult to apply the correct lib without deleting bunch of dirs and restarting the kernel.
What is the dependency of geopandas to this on pip? Because the error was mainly triggered by the following combination:
This leads to the installation of most recent version of pyproj
My duty.
Your library rocks the ages!