Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mplleaflet/leaflet_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ def draw_path(self, data, coordinates, pathcodes, style,
minx=corner[0],
miny=corner[1],
)

try:
label = mplobj.get_label()
except:
label = None

properties = {'html': svg,
'label': label,
'anchor_x': -corner[0],
'anchor_y': -corner[1]}
else:
Expand Down
6 changes: 5 additions & 1 deletion mplleaflet/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
iconAnchor: [feature.properties.anchor_x,
feature.properties.anchor_y],
className: 'empty'}); // What can I do about empty?
return L.marker(latlng, {icon: icon});
var marker = L.marker(latlng, {icon: icon});
if (feature.properties.label) {
marker.bindPopup('<pre>' + feature.properties.label + '</pre>');
}
return marker;
}
});
gj.addTo(map);
Expand Down