You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all! With new gepandas release, the pyproj.CRS object has been enriched and the old way (pyproj4) to specify projection as parameter (`crs') seems to have changed considerably.
When you try to plot a gd over a a layer with display method:
TypeError: type object argument after ** must be a mapping, not CRS
This is seems to be explained because CRS with new geopandas release has a new obtect type.
Passing the crs with the .to_dict() this error doesn't appears again, but as I'm still getting some warnings like this one:
UserWarning: You will likely lose important projection information when converting to a PROJ string from another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
proj_string = self.to_proj4()
I would like to know if this is the correct way to pass the gdf.crs as parameter in the display method.
Great work wit this library, much thanks!
The text was updated successfully, but these errors were encountered:
Not sure if this is helpful but when I ran into the same problem (only being able to plot things in the default EPSG4326 crs and not being able to pass in a different crs/epsg optional argument for mplleaflet.show), I came up with this workaround:
Besides downgrading pyproj to 1.9.6 (which means you wont be able to use geopandas >= 0.7.0), what you can also do is edit the leaflet_renderer.py script, when defining the LeafletRenderer class you can substitute:
old code which works with pyproj 1.9.6 or below -
proj_in = pyproj.Proj(crs)
proj_out = pyproj.Proj(crs_out)
self.transformfunc = partial(pyproj.transform, proj_in, proj_out)
new code which works for pyproj >= 2.0.0 -
proj_in = pyproj.CRS(crs)
proj_out = pyproj.CRS(crs_out)
transformer = pyproj.Transformer.from_crs(proj_in, proj_out, always_xy=True)
self.transformfunc = partial(transformer.transform)
You should also return epsgstr rather than crs in the _crs_from_epsg(epsg) function at the bottom of leaflet_renderer.py to satisfy the new crs format used in pyproj >= 2.0.0.
Hi all! With new gepandas release, the pyproj.CRS object has been enriched and the old way (pyproj4) to specify projection as parameter (`crs') seems to have changed considerably.
When you try to plot a gd over a a layer with
display
method:The following error is returned:
This is seems to be explained because CRS with new geopandas release has a new obtect type.
Passing the crs with the
.to_dict()
this error doesn't appears again, but as I'm still getting some warnings like this one:I would like to know if this is the correct way to pass the gdf.crs as parameter in the display method.
Great work wit this library, much thanks!
The text was updated successfully, but these errors were encountered: