Skip to content

Commit 0279457

Browse files
committed
DivIcons
1 parent 65ec021 commit 0279457

1 file changed

Lines changed: 31 additions & 26 deletions

File tree

folium/features.py

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,21 @@ def __init__(self, data):
170170
Parameters
171171
----------
172172
data: file, dict or str.
173-
The geo-json data you want to plot.
174-
If file, then data will be read in the file and fully embedded in Leaflet's javascript. # noqa
175-
If dict, then data will be converted to JSON and embedded in the javascript.
176-
If str, then data will be passed to the javascript as-is.
173+
The GeoJSON data you want to plot.
174+
* If file, then data will be read in the file and fully
175+
embedded in Leaflet's JavaScript.
176+
* If dict, then data will be converted to JSON and embedded
177+
in the JavaScript.
178+
* If str, then data will be passed to the JavaScript as-is.
179+
180+
Examples:
181+
>>> # Providing file.
182+
>>> GeoJson(open('foo.json'))
183+
>>> # Providing dict.
184+
>>> GeoJson(json.load(open('foo.json')))
185+
>>> # Providing string.
186+
>>> GeoJson(open('foo.json').read())
177187
178-
examples :
179-
# providing file
180-
GeoJson(open('foo.json'))
181-
182-
# providing dict
183-
GeoJson(json.load(open('foo.json')))
184-
185-
# providing string
186-
GeoJson(open('foo.json').read())
187188
"""
188189
super(GeoJson, self).__init__()
189190
self._name = 'GeoJson'
@@ -196,9 +197,9 @@ def __init__(self, data):
196197

197198
self._template = Template(u"""
198199
{% macro script(this, kwargs) %}
199-
var {{this.get_name()}} = L.geoJson({{this.data}}).addTo({{this._parent.get_name()}}); # noqa
200+
var {{this.get_name()}} = L.geoJson({{this.data}}).addTo({{this._parent.get_name()}});
200201
{% endmacro %}
201-
""")
202+
""") # noqa
202203

203204

204205
class TopoJson(MacroElement):
@@ -574,11 +575,11 @@ def __init__(self, image, bounds, opacity=1., attribution=None,
574575
* If string, it will be written directly in the output file.
575576
* If file, it's content will be converted as embedded in the
576577
output file.
577-
* If array-like, it will be converted to PNG base64 string and
578-
embedded in the output.
578+
* If array-like, it will be converted to PNG base64 string
579+
and embedded in the output.
579580
bounds: list
580-
Image bounds on the map in the form
581-
[[lat_min, lon_min], [lat_max, lon_max]]
581+
Image bounds on the map in the form [[lat_min, lon_min],
582+
[lat_max, lon_max]]
582583
opacity: float, default Leaflet's default (1.0)
583584
attr: string, default Leaflet's default ("")
584585
origin : ['upper' | 'lower'], optional, default 'upper'
@@ -587,11 +588,14 @@ def __init__(self, image, bounds, opacity=1., attribution=None,
587588
colormap : callable, used only for `mono` image.
588589
Function of the form [x -> (r,g,b)] or [x -> (r,g,b,a)]
589590
for transforming a mono image into RGB.
590-
It must output iterables of length 3 or 4, with values between
591-
0. and 1. Hint : you can use colormaps from `matplotlib.cm`.
592-
mercator_project : bool, default False, used for array-like image.
593-
Transforms the data to project (longitude, latitude)
594-
coordinates to the Mercator projection.
591+
It must output iterables of length 3 or 4,
592+
with values between 0 and 1.
593+
Hint : you can use colormaps from `matplotlib.cm`.
594+
mercator_project : bool, default False.
595+
Used only for array-like image. Transforms the data to
596+
project (longitude, latitude) coordinates to the
597+
Mercator projection.
598+
595599
"""
596600
super(ImageOverlay, self).__init__()
597601
self._name = 'ImageOverlay'
@@ -632,8 +636,8 @@ def __init__(self, icon_image, icon_size=None, icon_anchor=None,
632636
* If string, it will be written directly in the output file.
633637
* If file, it's content will be converted as embedded in the
634638
output file.
635-
* If array-like, it will be converted to PNG base64 string and
636-
embedded in the output.
639+
* If array-like, it will be converted to PNG base64 string
640+
and embedded in the output.
637641
icon_size : tuple of 2 int
638642
Size of the icon image in pixels.
639643
icon_anchor : tuple of 2 int
@@ -652,6 +656,7 @@ def __init__(self, icon_image, icon_size=None, icon_anchor=None,
652656
popup_anchor : tuple of 2 int
653657
The coordinates of the point from which popups will "open",
654658
relative to the icon anchor.
659+
655660
"""
656661
super(Icon, self).__init__()
657662
self._name = 'CustomIcon'

0 commit comments

Comments
 (0)