Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_func(button=None):
p = ipyleaflet.Marker(name=point_name,
location=coords,
draggable=False)
self._add_EELayer(point_name, {
'type': 'temp',
'object': None,
'visParams': None,
'layer': p
})
for value in data:
key = ""
for i,k in enumerate(keyValues):
if i > 0:
key += "."
if k in value:
key += value[k]
keys.append(key)
if key in self._markers:
marker = self._markers[key]
else:
if self._icon != None:
icon = maps.Icon(icon_url=self._icon,icon_size=[40,30])
marker = maps.Marker(icon=icon)
else:
marker = maps.CircleMarker()
marker.stroke = border
marker.fill_opacity = opacity
self._map.add_layer(marker)
self._markers[key] = marker
if len(popup) > 0:
marker.popup = widgets.HTML()
if self._lat in value and self._lon in value:
lat = value[self._lat]
lon = value[self._lon]
marker.location = (lat,lon)
if tracking and center == None:
def add_func(button=None):
p = ipyleaflet.Marker(name=point_name,
location=coords,
draggable=False)
self._add_EELayer(point_name, {
'type': 'temp',
'object': None,
'visParams': None,
'layer': p
})
def print_geojson(geojson, limit = 100):
center = None
j = json.load(StringIO(geojson))
layer_group = LayerGroup()
features = j['features']
if limit is not None:
features = features[0:limit]
for f in features:
location = (f['geometry']['coordinates'][1], f['geometry']['coordinates'][0])
marker = Marker(location = location)
marker.popup = HTML(str(f['properties']))
layer_group.add_layer(marker)
if not center:
center = location
if not center:
center = (0, 0)
m = Map(
layers = (basemap_to_tiles(basemaps.OpenStreetMap.Mapnik), ),
center = center,
zoom = 8
)
m.add_layer(layer_group)
return m
def point_leaflet(point: "PointMixin", **kwargs) -> Marker:
"""Returns a Leaflet layer to be directly added to a Map.
.. warning::
This is only available if the Leaflet `plugin `_ is
activated. (true by default)
The elements passed as kwargs as passed as is to the Marker constructor.
"""
default = dict()
if hasattr(point, "name"):
default["title"] = point.name
kwargs = {**default, **kwargs}
marker = Marker(location=(point.latitude, point.longitude), **kwargs)
label = HTML()
label.value = repr(point)
marker.popup = label
return marker