Skip to content

Commit 9372403

Browse files
committed
Fix projections
1 parent 4c5bfc2 commit 9372403

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

examples/standalone/gpd_fit_bounds.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
data = "zip+https://github.com/Toblerity/Fiona/files/11151652/coutwildrnp.zip"
44

55
gdf = ol.GeoDataFrame.from_file(data)
6+
print(gdf.crs)
67

78
# print(gdf)
89
m = gdf.ol.color_category("STATE").explore()
9-
m.add_call("fitBoundsFromLonLat", list(gdf.total_bounds))
10+
# m.add_call("fitBoundsFromLonLat", list(gdf.total_bounds))
11+
m.fit_bounds(list(gdf.total_bounds))
1012
m.save()

examples/standalone/ol_express.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@
5555
# print(json.dumps(m.map_options))
5656

5757
# m.set_center((9.5, 51.31667))
58-
m.set_view(View(center=(9.5, 51.31667), zoom=14))
58+
# m.set_view(View(center=(9.5, 51.31667), zoom=14))
5959
m.save()

examples/standalone/polygons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
# m.add_tooltip()
1111
m.add_control(ol.controls.ZoomSliderControl())
1212
m.add_control(ol.controls.InfoBox(
13-
html="OpenLayers4Py",
13+
html="PyOL",
1414
css_text="right: .5em; top: .5em; background: white; padding: 5px;"))
1515
m.save()

src/openlayers/geopandas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
COLOR_COLUMN = "color"
1919

2020

21-
def gdf_to_geojson(data: gpd.GeoDataFrame, crs: str | None = Projection.WEB_MERCATOR):
21+
def gdf_to_geojson(data: gpd.GeoDataFrame, crs: str | None = Projection.MERCATOR):
2222
if crs:
2323
data = data.to_crs(crs)
2424

src/openlayers/map.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def add_view_call(self, method_name: str, *args: Any) -> None:
5757
view_call = dict(method=method_name, args=args)
5858
self.add_call("applyCallToView", view_call)
5959

60+
def fit_bounds(self, bounds: tuple[float, float, float, float]) -> None:
61+
self.add_call("fitBounds", bounds)
62+
6063
def set_view(self, view: View) -> None:
6164
"""Set the view state of the map
6265

0 commit comments

Comments
 (0)