`add_geojson` from local path unable to transform CRS correctly
patel-zeel opened this issue · 5 comments
Environment Information
- leafmap version: 0.38.5
- Python version: 3.10.12
- Operating System: Ubuntu 20.04.6 LTS
Description
I was working with a GeoJSON file in UTM projection Zone 43 (EPSG:32643). I kept it in EPSG:32643 and not in EPSG:4326 because I wanted to create a K km buffer around the geometry as accurately as I can. When I saved this file locally with GeoPandas and tried to visualize it by providing a path to the add_geojson
method, it was unable to show the geometry correctly (lines are visible at the perimeter of the entire map). I have included a minimum working example below.
What I Did
show_what_fails = True
import leafmap.foliumap as leafmap
# OR
# import leafmap.leafmap as leafmap # This also fails
import geopandas as gpd
m = leafmap.Map()
m.add_basemap("HYBRID")
gdf = gpd.read_file("https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cable_geo.geojson")
if show_what_fails:
gdf = gdf.to_crs("EPSG:3857")
gdf.to_file("/tmp/cable_geo.geojson", driver='GeoJSON')
m.add_geojson("/tmp/cable_geo.geojson")
m
Thank you for reporting! The bug has been fixed. Please update leafmap to the latest version and try again
Thank you, Prof. @giswqs, for fixing it quickly.
Prof. @giswqs, the latest version is not yet pushed to PyPI right?
I just published it. Please try again.
It's working now. Thank you, Prof. @giswqs.