A. Vaicenavicius
A. Vaicenavicius

Reputation: 97

Folium: Circle Marker from GeoJson

I would like to represent points from geojson file on a map as circle markers, not as simple markers, which are shown by default.

The following command would add simple markers:

folium.GeoJson(geojson_file).add_to(map)

How should I change them to circle markers. I don't want to do a for loop for each point as it is takes a very long time.

Upvotes: 4

Views: 4251

Answers (1)

Svinjica
Svinjica

Reputation: 2519

You can try something like this (using example from Leaflet API) More on that topic here http://leafletjs.com/reference.html#geojson

   function style (feature, latlng) {
     return L.circleMarker(latlng, {
                    radius: 8,
                    fillColor: "#ff7800",
                    color: "#000",
                    weight: 1,
                    opacity: 1,
                    fillOpacity: 0.8
                });
   };

   geoJsonLayer = L.geoJson(geojson_file,{
      pointToLayer: style  
  }).addTo(map);

Upvotes: 2

Related Questions