diff --git a/examples/CRS_comparison.ipynb b/examples/CRS.ipynb
similarity index 100%
rename from examples/CRS_comparison.ipynb
rename to examples/CRS.ipynb
diff --git a/examples/GeoPandas.ipynb b/examples/Geopandas.ipynb
similarity index 100%
rename from examples/GeoPandas.ipynb
rename to examples/Geopandas.ipynb
diff --git a/examples/plugins_examples.ipynb b/examples/Plugins.ipynb
similarity index 100%
rename from examples/plugins_examples.ipynb
rename to examples/Plugins.ipynb
diff --git a/examples/RectangleMarker_and_PolygonMarker.ipynb b/examples/RectangleMarker_and_PolygonMarker.ipynb
new file mode 100644
index 0000000000..f5b3b5f6f2
--- /dev/null
+++ b/examples/RectangleMarker_and_PolygonMarker.ipynb
@@ -0,0 +1,134 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "0.3.0.dev\n"
+ ]
+ }
+ ],
+ "source": [
+ "import folium\n",
+ "\n",
+ "print(folium.__version__)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### RectangleMarker"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = folium.Map(location=[35.67, 139.78], zoom_start=13)\n",
+ "\n",
+ "folium.features.RectangleMarker(\n",
+ " bounds=[[35.681, 139.766], [35.691, 139.776]],\n",
+ " color='blue',\n",
+ " fill_color='red',\n",
+ " popup='Tokyo, Japan').add_to(m)\n",
+ "\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Polygon"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ ""
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = folium.Map(location=[35.67, 139.78], zoom_start=13)\n",
+ "\n",
+ "locations = [[35.6762, 139.7795],\n",
+ " [35.6718, 139.7831],\n",
+ " [35.6767, 139.7868],\n",
+ " [35.6795, 139.7824],\n",
+ " [35.6787, 139.7791]]\n",
+ "\n",
+ "folium.features.PolygonMarker(\n",
+ " locations,\n",
+ " color='blue',\n",
+ " weight=10,\n",
+ " fill_color='red',\n",
+ " fill_opacity=0.5,\n",
+ " popup='Tokyo, Japan').add_to(m)\n",
+ "\n",
+ "m"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python [default]",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.5.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/examples/test_rotate.ipynb b/examples/Rotate_icon.ipynb
similarity index 100%
rename from examples/test_rotate.ipynb
rename to examples/Rotate_icon.ipynb
diff --git a/examples/test_folium_wms_wmts.ipynb b/examples/WMS_and_WMTS.ipynb
similarity index 100%
rename from examples/test_folium_wms_wmts.ipynb
rename to examples/WMS_and_WMTS.ipynb
diff --git a/folium/features.py b/folium/features.py
index 05b74806b1..5343e3175f 100644
--- a/folium/features.py
+++ b/folium/features.py
@@ -814,8 +814,10 @@ def __init__(self, bounds, color='black', weight=1, fill_color='black',
Example
-------
- >>> RectangleMarker(bounds=[[35.681, 139.766], [35.691, 139.776]],
- color="blue", fill_color="red", popup='Tokyo, Japan')
+ >>> RectangleMarker(
+ ... bounds=[[35.681, 139.766], [35.691, 139.776]],
+ ... color='blue', fill_color='red', popup='Tokyo, Japan'
+ ... )
"""
super(RectangleMarker, self).__init__(bounds, popup=popup)
@@ -840,11 +842,11 @@ def __init__(self, bounds, color='black', weight=1, fill_color='black',
""")
-class Polygon(Marker):
+class PolygonMarker(Marker):
def __init__(self, locations, color='black', weight=1, fill_color='black',
fill_opacity=0.6, popup=None, latlon=True):
"""
- Creates a Polygon object for plotting on a Map.
+ Creates a PolygonMarker object for plotting on a Map.
Parameters
----------
@@ -867,20 +869,20 @@ def __init__(self, locations, color='black', weight=1, fill_color='black',
Examples
--------
- >>> loc = [[35.6762, 139.7795],
- ... [35.6718, 139.7831],
- ... [35.6767, 139.7868],
- ... [35.6795, 139.7824],
- ... [35.6787, 139.7791]]
- >>> Polygon(loc, color="blue", weight=10, fill_color="red",
- ... fill_opacity=0.5, popup="Tokyo, Japan"))
+ >>> locations = [[35.6762, 139.7795],
+ ... [35.6718, 139.7831],
+ ... [35.6767, 139.7868],
+ ... [35.6795, 139.7824],
+ ... [35.6787, 139.7791]]
+ >>> Polygon(locations, color='blue', weight=10, fill_color='red',
+ ... fill_opacity=0.5, popup='Tokyo, Japan'))
"""
- super(Polygon, self).__init__((
+ super(PolygonMarker, self).__init__((
_locations_mirror(locations) if not latlon else
_locations_tolist(locations)), popup=popup
)
- self._name = 'Polygon'
+ self._name = 'PolygonMarker'
self.color = color
self.weight = weight
self.fill_color = fill_color
diff --git a/folium/templates/polygon.js b/folium/templates/polygon.js
index 9f83d5e533..556dd14fc0 100644
--- a/folium/templates/polygon.js
+++ b/folium/templates/polygon.js
@@ -1,4 +1,4 @@
-var {{ Polygon }} = L.polygon({{location}},
+var {{ PolygonMarker }} = L.polygon({{location}},
{
color:'{{ color }}',
fillColor:'{{ fill_color }}',
diff --git a/tests/test_folium.py b/tests/test_folium.py
index 710b8bfb4b..863e6caf94 100644
--- a/tests/test_folium.py
+++ b/tests/test_folium.py
@@ -23,7 +23,7 @@
import folium
from folium.map import Popup, Marker, FitBounds, FeatureGroup
-from folium.features import TopoJson, RectangleMarker, Polygon
+from folium.features import TopoJson, RectangleMarker, PolygonMarker
rootpath = os.path.abspath(os.path.dirname(__file__))
@@ -222,13 +222,13 @@ def test_rectangle_marker(self):
bounds = self.map.get_bounds()
assert bounds == [[45.6, -122.9], [45.7, -122.8]], bounds
- def test_polygon(self):
+ def test_polygon_marker(self):
"""Test polygon additions."""
self.map = folium.Map(location=[45.60, -122.8])
polygon_templ = self.env.get_template('polygon.js')
- # Single Polygon.
+ # Single PolygonMarker.
locations = [[35.6636, 139.7634],
[35.6629, 139.7664],
[35.6663, 139.7706],
@@ -237,9 +237,9 @@ def test_polygon(self):
[35.6720, 139.7606],
[35.6682, 139.7588],
[35.6663, 139.7627]]
- self.map.add_child(Polygon(locations=locations, popup='Hi'))
+ self.map.add_child(PolygonMarker(locations=locations, popup='Hi'))
marker = list(self.map._children.values())[-1]
- polygon_1 = polygon_templ.render({'Polygon': marker.get_name(),
+ polygon_1 = polygon_templ.render({'PolygonMarker': marker.get_name(),
'location': locations,
'color': 'black',
'fill_color': 'black',
@@ -248,7 +248,7 @@ def test_polygon(self):
assert (''.join(polygon_1.split())[:-1] in
''.join(self.map.get_root().render().split()))
- # Second Polygon.
+ # Second PolygonMarker.
locations = [[35.5636, 138.7634],
[35.5629, 138.7664],
[35.5663, 138.7706],
@@ -257,11 +257,11 @@ def test_polygon(self):
[35.5720, 138.7606],
[35.5682, 138.7588],
[35.5663, 138.7627]]
- self.map.add_child(Polygon(locations=locations, color='red',
- fill_color='red', fill_opacity=0.7,
- weight=3, popup='Hi'))
+ self.map.add_child(PolygonMarker(locations=locations, color='red',
+ fill_color='red', fill_opacity=0.7,
+ weight=3, popup='Hi'))
marker = list(self.map._children.values())[-1]
- polygon_2 = polygon_templ.render({'Polygon': marker.get_name(),
+ polygon_2 = polygon_templ.render({'PolygonMarker': marker.get_name(),
'location': locations,
'color': 'red',
'fill_color': 'red',