Text-only labeling with no icon

277 views
Skip to first unread message

Etienne Desgagné

unread,
Apr 30, 2013, 2:07:18 PM4/30/13
to leafl...@googlegroups.com
Hello,

    I'm looking for a way to show text on Leaflet map using marker or anything else without showing any icon. I want to show text only and be able to style and rotate it... Any suggestion?

Thanks a lot

Etienne

Stefano C.

unread,
Apr 30, 2013, 8:11:03 PM4/30/13
to leafl...@googlegroups.com
The easiest way, using L.DivIcon:

var icon = new L.DivIcon({
className: 'label',
iconSize: new L.Point(40, 20),
iconAnchor: new L.Point(20, 20),
popupAnchor: new L.Point(0, -20),
html: '<div class="content-label">'+ text +'</div>'
});

View this demo:

Arnie Shore

unread,
Apr 30, 2013, 8:27:18 PM4/30/13
to leafl...@googlegroups.com
Super-nice! Thank you.

AS
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Leaflet" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leaflet-js+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
Reply all
Reply to author
Forward
0 new messages