markers
markers
Marker building utilities.
markers.build_icon_marker
build_icon_marker(
icon: str,
css: dict[str, str],
caption: str | None,
caption_css: dict[str, str],
) -> DivIcon
Build an icon-based DivIcon marker with optional caption.
Parameters:
-
icon(str) –Icon name or full CSS class string. Strings containing a space (e.g.
"fa-solid fa-house") are used verbatim. Bare names starting with"fa-"get an"fa-solid"prefix; other bare names (e.g."home") get a"glyphicon"prefix. -
css(dict[str, str]) –CSS property overrides for the icon element.
-
caption(str | None) –Optional caption text below the icon.
-
caption_css(dict[str, str]) –CSS property overrides for the caption.
Returns:
-
DivIcon–
Source code in mapyta/markers.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
markers.build_text_marker
build_text_marker(
text: str,
css: dict[str, str],
caption: str | None,
caption_css: dict[str, str],
) -> DivIcon
Build a text/emoji DivIcon marker with optional caption.
Parameters:
-
text(str) –The actual text/emoji to render.
-
css(dict[str, str]) –CSS property overrides for the text element.
-
caption(str | None) –Optional caption text below the text.
-
caption_css(dict[str, str]) –CSS property overrides for the caption.
Returns:
-
DivIcon–A DivIcon rendering the text and optional caption.
Source code in mapyta/markers.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
markers.caption_html
caption_html(text: str, css: dict[str, str]) -> str
Build an HTML snippet for a caption below a marker icon.
Parameters:
-
text(str) –Caption text.
-
css(dict[str, str]) –CSS property dict merged with appropriate defaults by the caller.
Returns:
-
str–HTML
<div>string.
Source code in mapyta/markers.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
markers.classify_marker
classify_marker(s: str) -> Literal['emoji', 'icon_class', 'icon_name']
Classify a marker string.
Returns:
-
emoji–Non-ASCII content (emojis, unicode symbols) → render as text.
-
icon_class–Full CSS class string containing a space (e.g.
"fa fa-home") → use as-is. -
icon_name–Bare icon name (e.g.
"home","fa-arrow-right") → auto-prefix.
Source code in mapyta/markers.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
markers.css_to_style
css_to_style(css: dict[str, str]) -> str
Convert a CSS property dict to an inline style string.
Source code in mapyta/markers.py
38 39 40 | |