Checks for GeoJson GeometryCollection features to warn user about incompatibility.
(self)
| 1192 | self.style = style |
| 1193 | |
| 1194 | def warn_for_geometry_collections(self) -> None: |
| 1195 | """Checks for GeoJson GeometryCollection features to warn user about incompatibility.""" |
| 1196 | assert isinstance(self._parent, GeoJson) |
| 1197 | geom_collections = [ |
| 1198 | feature.get("properties") if feature.get("properties") is not None else key |
| 1199 | for key, feature in enumerate(self._parent.data["features"]) |
| 1200 | if feature["geometry"] |
| 1201 | and feature["geometry"]["type"] == "GeometryCollection" |
| 1202 | ] |
| 1203 | if any(geom_collections): |
| 1204 | warnings.warn( |
| 1205 | f"{self._name} is not configured to render for GeoJson GeometryCollection geometries. " |
| 1206 | f"Please consider reworking these features: {geom_collections} to MultiPolygon for full functionality.\n" |
| 1207 | "https://tools.ietf.org/html/rfc7946#page-9", |
| 1208 | UserWarning, |
| 1209 | ) |
| 1210 | |
| 1211 | def render(self, **kwargs): |
| 1212 | """Renders the HTML representation of the element.""" |