MCPcopy Index your code
hub / github.com/python-visualization/folium / GeoJsonPopup

Class GeoJsonPopup

folium/features.py:1344–1408  ·  view source on GitHub ↗

Create a popup feature to bind to each element of a GeoJson layer based on its attributes. Parameters ---------- fields: list or tuple. Labels of GeoJson/TopoJson 'properties' or GeoPandas GeoDataFrame columns you'd like to display. aliases: list/tuple of st

Source from the content-addressed store, hash-verified

1342
1343
1344class GeoJsonPopup(GeoJsonDetail):
1345 """
1346 Create a popup feature to bind to each element of a GeoJson layer based on
1347 its attributes.
1348
1349 Parameters
1350 ----------
1351 fields: list or tuple.
1352 Labels of GeoJson/TopoJson 'properties' or GeoPandas GeoDataFrame
1353 columns you'd like to display.
1354 aliases: list/tuple of strings, same length/order as fields, default None.
1355 Optional aliases you'd like to display in the tooltip as field name
1356 instead of the keys of `fields`.
1357 labels: bool, default True.
1358 Set to False to disable displaying the field names or aliases.
1359 localize: bool, default False.
1360 This will use JavaScript's .toLocaleString() to format 'clean' values
1361 as strings for the user's location; i.e. 1,000,000.00 comma separators,
1362 float truncation, etc.
1363 Available for most of JavaScript's primitive types (any data you'll
1364 serve into the template).
1365 style: str, default None.
1366 HTML inline style properties like font and colors. Will be applied to
1367 a div with the text in it.
1368
1369 Examples
1370 ---
1371 gjson = folium.GeoJson(gdf).add_to(m)
1372
1373 folium.features.GeoJsonPopup(fields=['NAME'],
1374 labels=False
1375 ).add_to(gjson)
1376 """
1377
1378 _template = Template(
1379 """
1380 {% macro script(this, kwargs) %}
1381 {{ this._parent.get_name() }}.bindPopup("""
1382 + GeoJsonDetail.base_template
1383 + """,{{ this.popup_options | tojavascript }});
1384 {% endmacro %}
1385 """
1386 )
1387
1388 def __init__(
1389 self,
1390 fields: Sequence[str],
1391 aliases: Optional[Sequence[str]] = None,
1392 labels: bool = True,
1393 style: str = "margin: auto;",
1394 class_name: str = "foliumpopup",
1395 localize: bool = True,
1396 **kwargs: TypeJsonValue,
1397 ):
1398 super().__init__(
1399 fields=fields,
1400 aliases=aliases,
1401 labels=labels,

Callers 1

test_timelineFunction · 0.90

Calls 1

TemplateClass · 0.90

Tested by 1

test_timelineFunction · 0.72