-
-
Save epok07/40e7b5b0560a90e4de18d15c15be4b11 to your computer and use it in GitHub Desktop.
Adding Leaflet-image to Leaflet-angular-directive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L_PREFER_CANVAS = true; | |
leafletData.getMap().then(function(map) { | |
leafletImage(map, function(err, canvas) { | |
var img = document.createElement('img'); | |
var dimensions = map.getSize(); | |
img.width = dimensions.x; | |
img.height = dimensions.y; | |
img.src = canvas.toDataURL(); | |
var data = { | |
map: img.src, | |
period: $scope.period.value, | |
map_width: img.width, | |
map_height: img.height | |
// Here you can add this image to any element you want, or send it to the server for saving. | |
}; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment