Skip to content

Commit f426414

Browse files
authored
Merge pull request jupyter-widgets#695 from jupyter-widgets/stable
Update documentation to add geojson point_style attribute (jupyter-widgets#694)
2 parents 655ee3f + afca381 commit f426414

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

docs/source/api_reference/geodata.rst

+33-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ GeoData
22
=======
33

44
``GeoData`` is an ``ipyleaflet`` class that allows you to visualize a `GeoDataFrame
5-
<http://geopandas.org/data_structures.html>`_ on the Map.
5+
<http://geopandas.org/data_structures.html>`_ of polygons, lines, and points on the Map.
66

77

8-
Example
8+
Examples
99
-------
1010

1111
.. jupyter-execute::
@@ -35,6 +35,36 @@ Example
3535

3636
m
3737

38+
Points example:
39+
40+
.. jupyter-execute::
41+
42+
from ipyleaflet import Map, GeoJSON, GeoData
43+
import geopandas, pandas as pd, numpy as np
44+
45+
m = Map(center=(46.91, 7.43), zoom=15)
46+
47+
numpoints = 10
48+
center = (7.43, 46.91)
49+
50+
df = pd.DataFrame(
51+
{'Conc': 1 * np.random.randn(numpoints) + 17,
52+
'Longitude': 0.0004 * np.random.randn(numpoints) + center[0],
53+
'Latitude': 0.0004 * np.random.randn(numpoints) + center[1]})
54+
55+
gdf = geopandas.GeoDataFrame(
56+
df, geometry=geopandas.points_from_xy(df.Longitude, df.Latitude))
57+
58+
geo_data = GeoData(geo_dataframe = gdf,
59+
style={'color': 'black', 'radius':8, 'fillColor': '#3366cc', 'opacity':0.5, 'weight':1.9, 'dashArray':'2', 'fillOpacity':0.6},
60+
hover_style={'fillColor': 'red' , 'fillOpacity': 0.2},
61+
point_style={'radius': 5, 'color': 'red', 'fillOpacity': 0.8, 'fillColor': 'blue', 'weight': 3},
62+
name = 'Release')
63+
64+
m.add_layer(geo_data)
65+
m
66+
67+
3868

3969
Attributes
4070
----------
@@ -45,4 +75,5 @@ Attribute Doc Description
4575
geo_data Data dictionary GeoDataFrame
4676
style Style dictionary
4777
hover_style Hover style dictionary
78+
point_style Point decorations Used to represent point data on the map as CircleMarkers. If absent, points will be represented by Markers.
4879
============ ========================== ===========

0 commit comments

Comments
 (0)