Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaflet awesome markers support #258

Closed
zolotyx opened this issue Jan 26, 2014 · 17 comments
Closed

Leaflet awesome markers support #258

zolotyx opened this issue Jan 26, 2014 · 17 comments

Comments

@zolotyx
Copy link

zolotyx commented Jan 26, 2014

Leaflet awesome markers do not work, even in given example.
http://tombatossals.github.io/angular-leaflet-directive/examples/markers-update-example.html

In this example many other features do not work (popup message, draggable can not be turned off)

@tombatossals
Copy link
Owner

Hi, you're right, that old example is not working as expected.

I will solve that in a few days, it will not be a harder one, but I would like to restyle the example.

Thanks for reporting

tombatossals added a commit that referenced this issue Jan 26, 2014
…ed example markers-update.

Thanks to @zolotyx for notify the problem here:
#258
@tombatossals
Copy link
Owner

I finally managed to solve this, it was an easy one. I have reworked the example to make it working again, you can see the new version here:

http://tombatossals.github.io/angular-leaflet-directive/examples/markers-update-example.html

About the AwesomeMarkers management, I have to document this a little but now you must declare an icon as an AwesomeMarker like this:

$scope.markers.first = {
    lat: 51.505,
    lng: -0.09,
    focus: true,
    draggable: false,
    message: "Hi there!",
    icon: {
        type: "awesomeMarker",
        icon: "cofee",
        markerColor: "red"
    }
}

@zolotyx
Copy link
Author

zolotyx commented Jan 27, 2014

Thank You for solving this issue, but i found that icon of awesome marker does not display (may be I'm doing something wrong) and changing marker message to ""(empty) work some kind of buggy in Your example.

@mchambaud
Copy link

@zolotyx the demo uses icon cofee which is invalid. I tried with other ones and it works fine.

@tombatossals
Copy link
Owner

Hi, I have updated the demo, now it works better:

http://tombatossals.github.io/angular-leaflet-directive/examples/markers-update-example.html

@rriemann
Copy link

I spend quite a view time to find this thread. Would you please add the example above to the examples page http://tombatossals.github.io/angular-leaflet-directive/#!/examples/simple-map ?

@kpennell
Copy link

@tombatossals Is there a way to use Awesome markers while using geojson to bring the markers in? I don't see anyway to style the icons when they come via geojson.

@kpennell
Copy link

Probably a bit too late but I recently released this to help people use geojson and font awesome markers together. Hope it helps.

@nweis
Copy link

nweis commented Jan 15, 2015

We still have an issue displaying font-awesome icons. It seems to me that the className and prefix is not set by the icon type in the angular-leaflet-directive. I've modified leaflet.awesome-markes.js to use 'fa' as default prefix instead of 'glyphicon' to make it work.

@kpennell
Copy link

kpennell commented Mar 4, 2015

@nweis Can you please share how you did this? I'm getting a class not found error and pretty sure it's tied to this.

@nweis
Copy link

nweis commented Mar 19, 2015

Sure - I've modified leaflet.awesome-markers.js as follows:

L.AwesomeMarkers.Icon = L.Icon.extend({
    options: {
        iconSize: [35, 45],
        iconAnchor: [17, 42],
        popupAnchor: [1, -32],
        shadowAnchor: [10, 12],
        shadowSize: [36, 16],
        className: 'awesome-marker',
        prefix: 'fa', // changed from 'glyphicon' to 'fa' by nweis
        spinClass: 'fa-spin',
        extraClasses: '',
        icon: 'home',
        markerColor: 'blue',
        iconColor: 'white'
    },

@kpennell
Copy link

Thanks!

On Thu, Mar 19, 2015 at 7:16 AM, nweis notifications@github.com wrote:

Sure - I've modified leaflet.awesome-markers.js as follows:

L.AwesomeMarkers.Icon = L.Icon.extend({
options: {
iconSize: [35, 45],
iconAnchor: [17, 42],
popupAnchor: [1, -32],
shadowAnchor: [10, 12],
shadowSize: [36, 16],
className: 'awesome-marker',
prefix: 'fa', // changed from 'glyphicon' to 'fa' by nweis
spinClass: 'fa-spin',
extraClasses: '',
icon: 'home',
markerColor: 'blue',
iconColor: 'white'
},


Reply to this email directly or view it on GitHub
#258 (comment)
.

@nweis
Copy link

nweis commented Mar 20, 2015

Glad to help. :)

@orenww
Copy link

orenww commented Apr 14, 2015

Which color format should I use?
I try to set the value "#00ff00" and it doesn't work
but when I set the value "green" it work well.

I get the color value from the server and I don't have the color name so I can't to set the color.
any solution?

let marker = {
lat: lat,
lng:lon,
message:msg,
icon: {
type: 'awesomeMarker',
prefix:'fa',
icon: iconName,
markerColor: iconColor
}
}

@tombatossals
Copy link
Owner

@fdlk
Copy link

fdlk commented Jun 22, 2015

@tombatossals I think you need to add the prefix fa or else it'll depend on and use bootstrap glyphicons.

@axelgunn
Copy link

axelgunn commented May 25, 2017

I'm having difficulties resizing the marker. This is the code I have. Any idea.. someone
var map = L.map('map',
{
crs: customCRS,
zoomSnap: 0,
zoomDelta: 0.5,
wheelPxPerZoomLevel: 100
}),
realtime = L.realtime(undefined, {
//getFeatureId: function (f) { return f.properties.id; },
start: false,
pointToLayer: function (feature, latlng) {
var smallIcon = new L.AwesomeMarkers.Icon({
icon: feature.properties.icon,
prefix: "fa",
markerColor: feature.properties.color
});

return L.marker(latlng,
{
icon: smallIcon
});
},
onEachFeature: onEachFeature
}).addTo(map);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants