@@ -2,10 +2,10 @@ GeoData
2
2
=======
3
3
4
4
``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.
6
6
7
7
8
- Example
8
+ Examples
9
9
-------
10
10
11
11
.. jupyter-execute ::
@@ -35,6 +35,36 @@ Example
35
35
36
36
m
37
37
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
+
38
68
39
69
Attributes
40
70
----------
@@ -45,4 +75,5 @@ Attribute Doc Description
45
75
geo_data Data dictionary GeoDataFrame
46
76
style Style dictionary
47
77
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.
48
79
============ ========================== ===========
0 commit comments