(
self,
data: Any,
style_function: Optional[Callable] = None,
highlight_function: Optional[Callable] = None,
popup_keep_highlighted: bool = False,
name: Optional[str] = None,
overlay: bool = True,
control: bool = True,
show: bool = True,
smooth_factor: Optional[float] = None,
tooltip: Union[str, Tooltip, "GeoJsonTooltip", None] = None,
embed: bool = True,
popup: Optional["GeoJsonPopup"] = None,
zoom_on_click: bool = False,
on_each_feature: Optional[JsCode] = None,
marker: Union[Circle, CircleMarker, Marker, None] = None,
**kwargs: Any,
)
| 686 | ) # noqa |
| 687 | |
| 688 | def __init__( |
| 689 | self, |
| 690 | data: Any, |
| 691 | style_function: Optional[Callable] = None, |
| 692 | highlight_function: Optional[Callable] = None, |
| 693 | popup_keep_highlighted: bool = False, |
| 694 | name: Optional[str] = None, |
| 695 | overlay: bool = True, |
| 696 | control: bool = True, |
| 697 | show: bool = True, |
| 698 | smooth_factor: Optional[float] = None, |
| 699 | tooltip: Union[str, Tooltip, "GeoJsonTooltip", None] = None, |
| 700 | embed: bool = True, |
| 701 | popup: Optional["GeoJsonPopup"] = None, |
| 702 | zoom_on_click: bool = False, |
| 703 | on_each_feature: Optional[JsCode] = None, |
| 704 | marker: Union[Circle, CircleMarker, Marker, None] = None, |
| 705 | **kwargs: Any, |
| 706 | ): |
| 707 | super().__init__(name=name, overlay=overlay, control=control, show=show) |
| 708 | self._name = "GeoJson" |
| 709 | self.embed = embed |
| 710 | self.embed_link: Optional[str] = None |
| 711 | self.json = None |
| 712 | self.parent_map = None |
| 713 | self.smooth_factor = smooth_factor |
| 714 | self.style = style_function is not None |
| 715 | self.highlight = highlight_function is not None |
| 716 | self.zoom_on_click = zoom_on_click |
| 717 | if marker: |
| 718 | if not isinstance(marker, (Circle, CircleMarker, Marker)): |
| 719 | raise TypeError( |
| 720 | "Only Marker, Circle, and CircleMarker are supported as GeoJson marker types." |
| 721 | ) |
| 722 | |
| 723 | if popup_keep_highlighted and popup is None: |
| 724 | raise ValueError( |
| 725 | "A popup is needed to use the popup_keep_highlighted feature" |
| 726 | ) |
| 727 | self.popup_keep_highlighted = popup_keep_highlighted |
| 728 | |
| 729 | self.marker = marker |
| 730 | self.on_each_feature = on_each_feature |
| 731 | self.options = remove_empty(**kwargs) |
| 732 | |
| 733 | self.data = self.process_data(data) |
| 734 | |
| 735 | if self.style or self.highlight: |
| 736 | self.convert_to_feature_collection() |
| 737 | if style_function is not None: |
| 738 | self._validate_function(style_function, "style_function") |
| 739 | self.style_function = style_function |
| 740 | self.style_map: dict = {} |
| 741 | if highlight_function is not None: |
| 742 | self._validate_function(highlight_function, "highlight_function") |
| 743 | self.highlight_function = highlight_function |
| 744 | self.highlight_map: dict = {} |
| 745 | self.feature_identifier = self.find_identifier() |
nothing calls this directly
no test coverage detected