MCPcopy
hub / github.com/python-visualization/folium / GeoJson

Class GeoJson

folium/features.py:483–871  ·  view source on GitHub ↗

Creates a GeoJson object for plotting into a Map. Parameters ---------- data: file, dict or str. The GeoJSON data you want to plot. * If file, then data will be read in the file and fully embedded in Leaflet's JavaScript. * If dict, then data will be

Source from the content-addressed store, hash-verified

481
482
483class GeoJson(Layer):
484 """
485 Creates a GeoJson object for plotting into a Map.
486
487 Parameters
488 ----------
489 data: file, dict or str.
490 The GeoJSON data you want to plot.
491 * If file, then data will be read in the file and fully
492 embedded in Leaflet's JavaScript.
493 * If dict, then data will be converted to JSON and embedded
494 in the JavaScript.
495 * If str, then data will be passed to the JavaScript as-is.
496 * If `__geo_interface__` is available, the `__geo_interface__`
497 dictionary will be serialized to JSON and
498 reprojected if `to_crs` is available.
499
500 style_function: function, default None
501 Function mapping a GeoJson Feature to a style dict.
502 highlight_function: function, default None
503 Function mapping a GeoJson Feature to a style dict for mouse events.
504 popup_keep_highlighted: bool, default False
505 Whether to keep the highlighting active while the popup is open
506 name : string, default None
507 The name of the Layer, as it will appear in LayerControls
508 overlay : bool, default True
509 Adds the layer as an optional overlay (True) or the base layer (False).
510 control : bool, default True
511 Whether the Layer will be included in LayerControls
512 show: bool, default True
513 Whether the layer will be shown on opening.
514 smooth_factor: float, default None
515 How much to simplify the polyline on each zoom level. More means
516 better performance and smoother look, and less means more accurate
517 representation. Leaflet defaults to 1.0.
518 tooltip: GeoJsonTooltip, Tooltip or str, default None
519 Display a text when hovering over the object. Can utilize the data,
520 see folium.GeoJsonTooltip for info on how to do that.
521 popup: GeoJsonPopup, optional
522 Show a different popup for each feature by passing a GeoJsonPopup object.
523 marker: Circle, CircleMarker or Marker, optional
524 If your data contains Point geometry, you can format the markers by passing a Circle,
525 CircleMarker or Marker object with your wanted options. The `style_function` and
526 `highlight_function` will also target the marker object you passed.
527 embed: bool, default True
528 Whether to embed the data in the html file or not. Note that disabling
529 embedding is only supported if you provide a file link or URL.
530 zoom_on_click: bool, default False
531 Set to True to enable zooming in on a geometry when clicking on it.
532 on_each_feature: JsCode, optional
533 Javascript code to be called on each feature.
534 See https://leafletjs.com/examples/geojson/
535 `onEachFeature` for more information.
536 **kwargs
537 Keyword arguments are passed to the geoJson object as extra options.
538
539 Examples
540 --------

Callers 8

__init__Method · 0.90
test_json_requestMethod · 0.90
_assert_id_got_addedFunction · 0.90
__init__Method · 0.85

Calls 1

TemplateClass · 0.90

Tested by 6

test_json_requestMethod · 0.72
_assert_id_got_addedFunction · 0.72