MCPcopy
hub / github.com/python-visualization/folium / get_bounds

Method get_bounds

folium/features.py:1088–1121  ·  view source on GitHub ↗

Computes the bounds of the object itself (not including it's children) in the form [[lat_min, lon_min], [lat_max, lon_max]]

(self)

Source from the content-addressed store, hash-verified

1086 super().render(**kwargs)
1087
1088 def get_bounds(self) -> TypeBoundsReturn:
1089 """
1090 Computes the bounds of the object itself (not including it's children)
1091 in the form [[lat_min, lon_min], [lat_max, lon_max]]
1092
1093 """
1094 if not self.embed:
1095 raise ValueError("Cannot compute bounds of non-embedded TopoJSON.")
1096
1097 xmin, xmax, ymin, ymax = None, None, None, None
1098
1099 for arc in self.data["arcs"]:
1100 x, y = 0, 0
1101 for dx, dy in arc:
1102 x += dx
1103 y += dy
1104 xmin = none_min(x, xmin)
1105 xmax = none_max(x, xmax)
1106 ymin = none_min(y, ymin)
1107 ymax = none_max(y, ymax)
1108 return [
1109 [
1110 self.data["transform"]["translate"][1]
1111 + self.data["transform"]["scale"][1] * ymin, # noqa
1112 self.data["transform"]["translate"][0]
1113 + self.data["transform"]["scale"][0] * xmin, # noqa
1114 ],
1115 [
1116 self.data["transform"]["translate"][1]
1117 + self.data["transform"]["scale"][1] * ymax, # noqa
1118 self.data["transform"]["translate"][0]
1119 + self.data["transform"]["scale"][0] * xmax, # noqa
1120 ],
1121 ]
1122
1123
1124class GeoJsonDetail(MacroElement):

Callers 15

test_builtin_tileMethod · 0.80
test_custom_tileMethod · 0.80
test_feature_groupMethod · 0.80
test_fit_bounds_2Method · 0.80
test_custom_iconMethod · 0.80
test_json_requestMethod · 0.80
test_circleFunction · 0.80
test_circle_markerFunction · 0.80
test_rectangleFunction · 0.80
test_polygon_markerFunction · 0.80
test_polylineFunction · 0.80
test_mulyipolylineFunction · 0.80

Calls

no outgoing calls

Tested by 15

test_builtin_tileMethod · 0.64
test_custom_tileMethod · 0.64
test_feature_groupMethod · 0.64
test_fit_bounds_2Method · 0.64
test_custom_iconMethod · 0.64
test_json_requestMethod · 0.64
test_circleFunction · 0.64
test_circle_markerFunction · 0.64
test_rectangleFunction · 0.64
test_polygon_markerFunction · 0.64
test_polylineFunction · 0.64
test_mulyipolylineFunction · 0.64