Skip to content

Commit 0e02b0b

Browse files
committed
fix: configure geojson in Geometry.explore #240
* pass through args to `.geojson()`
1 parent 331752a commit 0e02b0b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

odc/geo/geom.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -883,9 +883,13 @@ def explore(
883883
:param map_kwds:
884884
Additional keyword arguments to pass to :py:class:`folium.Map`.
885885
:param kwargs:
886-
Additional keyword arguments to pass to :py:class:`folium.GeoJson`.
886+
Additional keyword arguments to pass to :py:meth:`odc.geo.geom.Geometry.geojson`
887+
and :py:class:`folium.GeoJson`.
887888
888889
:return: A :py:mod:`folium` map containing the plotted Geometry.
890+
891+
:seealso: :py:meth:`odc.geo.geom.Geometry.geojson` for more details on
892+
the parameters.
889893
"""
890894
# pylint: disable=import-outside-toplevel, redefined-builtin
891895
have.check_or_error("folium")
@@ -898,9 +902,15 @@ def explore(
898902

899903
# Convert to GeoJSON with resolution based on approx 100
900904
# points per side for proper plotting/reprojection
901-
bbox = self.boundingbox
902-
res = max(bbox.span_x, bbox.span_y) / 100
903-
geojson = self.geojson(resolution=res)
905+
gj_args = {}
906+
for k in ("simplify", "wrapdateline", "resolution"):
907+
if k in kwargs:
908+
gj_args[k] = kwargs.pop(k)
909+
910+
if "resolution" not in gj_args:
911+
bbox = self.boundingbox
912+
gj_args["resolution"] = max(bbox.span_x, bbox.span_y) / 100
913+
geojson = self.geojson(**gj_args)
904914

905915
# Create layer and add to map
906916
layer = GeoJson(data=geojson, **kwargs)

0 commit comments

Comments
 (0)