MESQUAL Folium Area Visualization System¶
viz_arrow_icon
¶
ResolvedArrowIconFeature
dataclass
¶
Bases: ResolvedFeature
Resolved visual properties for animated arrow icon elements.
Container for all computed styling properties of arrow icon visualizations, including position, orientation, colors, animation settings, and size. Used by ArrowIconGenerator to create folium markers with SVG arrow icons.
Source code in submodules/mesqual/mesqual/visualizations/folium_viz_system/viz_arrow_icon.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
ArrowIconFeatureResolver
¶
Bases: FeatureResolver[ResolvedArrowIconFeature]
Resolves visual properties for animated arrow icon elements.
Specialized feature resolver for arrow icon visualizations that handles point locations, arrow styling, animation parameters, and directional indicators. Commonly used for visualizing directional flows, network connections, or any point-based data with directional significance.
Integrates with the captain_arro library to provide various arrow types and animation effects for dynamic flow visualization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arrow_type
|
Union[PropertyMapper, ArrowTypeEnum]
|
Type of arrow from ArrowTypeEnum (static value or PropertyMapper) |
None
|
color
|
PropertyMapper | str
|
Arrow color (static value or PropertyMapper) |
'#2563eb'
|
stroke_width
|
PropertyMapper | int
|
Arrow stroke width in pixels (static value or PropertyMapper) |
8
|
width
|
PropertyMapper | int
|
Arrow icon width in pixels (static value or PropertyMapper) |
60
|
height
|
PropertyMapper | int
|
Arrow icon height in pixels (static value or PropertyMapper) |
60
|
speed_in_px_per_second
|
PropertyMapper | float | None
|
Animation speed in pixels/second (static value or PropertyMapper) |
20.0
|
speed_in_duration_seconds
|
PropertyMapper | float | None
|
Animation duration in seconds (static value or PropertyMapper) |
None
|
num_arrows
|
PropertyMapper | int
|
Number of animated arrows (static value or PropertyMapper) |
3
|
opacity
|
PropertyMapper | float
|
Icon opacity 0-1 (static value or PropertyMapper) |
0.8
|
reverse_direction
|
PropertyMapper | bool
|
Reverse arrow direction (static value or PropertyMapper) |
False
|
tooltip
|
PropertyMapper | str | bool
|
Tooltip content (True for auto-generated, False for none) |
True
|
popup
|
PropertyMapper | Popup | bool
|
Popup content (True/False/PropertyMapper) |
False
|
location
|
PropertyMapper | Point
|
Point location (defaults to smart location detection) |
None
|
rotation_angle
|
Arrow rotation angle in degrees (static value or PropertyMapper) |
required | |
**property_mappers
|
PropertyMapper | Any
|
Additional custom property mappings |
{}
|
Examples:
Basic directional flow arrows:
>>> from captain_arro import ArrowTypeEnum
>>> resolver = ArrowIconFeatureResolver(
... arrow_type=ArrowTypeEnum.MOVING_FLOW_ARROW,
... color='#FF0000',
... width=50,
... height=30
... )
Data-driven flow visualization:
>>> flow_color_scale = SegmentedContinuousColorscale(...)
>>> size_scale = SegmentedContinuousInputToContinuousOutputMapping(...)
>>> resolver = ArrowIconFeatureResolver(
... arrow_type=PropertyMapper.from_kpi_value(
... lambda v: ArrowTypeEnum.SPOTLIGHT_FLOW_ARROW if abs(v) > 100
... else ArrowTypeEnum.BOUNCING_SPREAD_ARROW
... ),
... color=PropertyMapper.from_kpi_value(flow_color_scale),
... width=PropertyMapper.from_kpi_value(size_scale),
... reverse_direction=PropertyMapper.from_kpi_value(lambda v: v < 0),
... rotation_angle=PropertyMapper.from_item_attr('azimuth_angle')
... )
Source code in submodules/mesqual/mesqual/visualizations/folium_viz_system/viz_arrow_icon.py
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 125 126 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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
ArrowIconGenerator
¶
Bases: FoliumObjectGenerator[ArrowIconFeatureResolver]
Generates folium Marker objects with animated SVG arrow icons.
Creates interactive map markers featuring animated arrow icons from the captain_arro library. Handles SVG generation, base64 encoding, rotation, and integration with folium's marker system.
Commonly used for visualizing: - Directional border flow directions with magnitude-based styling - Border price-spread with magnitude-based styling - Any point-based directional data with animation needs
Examples:
Power flow visualization:
>>> from captain_arro import ArrowTypeEnum
>>> flow_color_scale = SegmentedContinuousColorscale(...)
>>> size_mapping = SegmentedContinuousInputToContinuousOutputMapping(...)
>>>
>>> generator = ArrowIconGenerator(
... ArrowIconFeatureResolver(
... arrow_type=PropertyMapper.from_kpi_value(
... lambda v: ArrowTypeEnum.MOVING_FLOW_ARROW if abs(v) > 50
... else ArrowTypeEnum.BOUNCING_SPREAD_ARROW
... ),
... color=PropertyMapper.from_kpi_value(lambda v: flow_color_scale(abs(v))),
... width=PropertyMapper.from_kpi_value(lambda v: size_mapping(abs(v))),
... reverse_direction=PropertyMapper.from_kpi_value(lambda v: v < 0),
... rotation_angle=PropertyMapper.from_item_attr('azimuth_angle'),
... speed_in_duration_seconds=4
... )
... )
>>>
>>> fg = folium.FeatureGroup('Flow Arrows')
>>> generator.generate_objects_for_kpi_collection(flow_kpis, fg)
>>> fg.add_to(map)
Border flow indicators:
>>> generator.generate_objects_for_model_df(border_df, feature_group)
Source code in submodules/mesqual/mesqual/visualizations/folium_viz_system/viz_arrow_icon.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
generate
¶
generate(data_item: VisualizableDataItem, feature_group: FeatureGroup) -> None
Generate and add a folium Marker with animated SVG arrow icon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_item
|
VisualizableDataItem
|
Data item containing point location and associated data |
required |
feature_group
|
FeatureGroup
|
Folium feature group to add the arrow marker to |
required |
Source code in submodules/mesqual/mesqual/visualizations/folium_viz_system/viz_arrow_icon.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |