1010import json
1111from jinja2 import Template
1212
13- from folium .element import JavascriptLink , MacroElement , Figure
13+ from folium .element import JavascriptLink , Figure
14+ from folium .map import Marker
1415
15-
16- class BoatMarker (MacroElement ):
16+ class BoatMarker (Marker ):
1717 """Adds a BoatMarker layer on the map."""
18- def __init__ (self , position = None , heading = 0 ,
19- wind_heading = None , wind_speed = 0 , ** kwargs ):
18+ def __init__ (self , location , popup = None , icon = None ,
19+ heading = 0 , wind_heading = None , wind_speed = 0 , ** kwargs ):
2020 """Creates a BoatMarker plugin to append into a map with
2121 Map.add_plugin.
2222
2323 Parameters
2424 ----------
25- position : tuple of length 2, default None
25+ location : tuple of length 2, default None
2626 The latitude and longitude of the marker.
2727 If None, then the middle of the map is used.
2828
@@ -36,9 +36,8 @@ def __init__(self, position=None, heading=0,
3636 wind_speed: int, default 0
3737 Speed of the wind in knots.
3838 """
39- super (BoatMarker , self ).__init__ ()
39+ super (BoatMarker , self ).__init__ (location , popup = popup , icon = icon )
4040 self ._name = 'BoatMarker'
41- self .position = None if position is None else tuple (position )
4241 self .heading = heading
4342 self .wind_heading = wind_heading
4443 self .wind_speed = wind_speed
@@ -47,7 +46,7 @@ def __init__(self, position=None, heading=0,
4746 self ._template = Template (u"""
4847 {% macro script(this, kwargs) %}
4948 var {{this.get_name()}} = L.boatMarker(
50- [{{this.position [0]}},{{this.position [1]}}],
49+ [{{this.location [0]}},{{this.location [1]}}],
5150 {{this.kwargs}}).addTo({{this._parent.get_name()}});
5251 {{this.get_name()}}.setHeadingWind({{this.heading}}, {{this.wind_speed}}, {{this.wind_heading}});
5352 {% endmacro %}
0 commit comments