سؤال

I have an external csv file providing data to my map using omnivore. I am trying to use L.mapbox.marker.icon styles to change the default "pin-drop" styling, but it continues to use the default styling (blue with white-dot center).

A portion of the code I'm using is below.

Is there something wrong with the way I'm trying to style this?

var points = omnivore.csv('datelist.csv', {
    icon: L.mapbox.marker.icon({
        'marker-symbol': 'airport',
        'marker-color': '59245f'
    })
}).on('ready', function() {
    map.fitBounds(points.getBounds());
    var markers = L.markerClusterGroup({
        showCoverageOnHover: false,
        maxClusterRadius: 50
    });
    markers.addLayer(points);
    map.addLayer(markers);
    points.eachLayer(eachLayer);
});
هل كانت مفيدة؟

المحلول

The second option to omnivore.csv is options for the parser, not for the layer. You would move your style definition into the ready block and use .setIcon to change the marker icons.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top