TransWikia.com

Mapping multiple circle markers in a single layer with ipyleaflet and jupyter

Geographic Information Systems Asked by user1650538 on July 9, 2021

How do I show multiple circle markers with ipyleaflet in jupyter? I want to add them all as one layer (not individual layers) and I do not want to use the MarkerCluster class. The documenation only references adding a single marker per layer – I tried: (using locations instead of location as referenced by the docs)

marker = CircleMarker(locations=[(172.7, -42.8),(172.7,-42.7)],
                          radius = 10,
                          color = "red",
                          fill_color = "red"
                         )

But that just got me one red circle in the middle of the map. I can create a whole a list of circle makers and put them into a MarkerCluster but I don’t really want to use this feature. I just want small circles/points at the co-ordinates, in one layer.

df1 = map_df.set_geometry([Point(feature.coords[:][0][:2]) for feature in map_df['geometry']])
marker_list = []
for feature in df1['geometry']:
    marker = CircleMarker(location=(feature.coords[0][1],feature.coords[0][0]),
                         radius = 1,
                          color = "red",
                          fill_color = "red"
                         )
    marker_list.append(marker)

marker_cluster = MarkerCluster(
    markers=(marker_list),
    name = 'first point'
)

I also tried plotting the geodataframe but I could not see how to specify a cirle marker? It uses the default blue pin which is not useful when I have a number of points to map.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP