forked from mapbox/leaflet-image
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WMS test, fix WMS. Fixes mapbox#70
- Loading branch information
Showing
7 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<head> | ||
<script>L_PREFER_CANVAS = true;</script> | ||
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.4.0/mapbox.js'></script> | ||
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.4.0/mapbox.css' rel='stylesheet' /> | ||
<link href='./shared/style.css' rel='stylesheet' /> | ||
</head> | ||
<body> | ||
<div id='snapshot'></div> | ||
<div id='map'></div> | ||
<script src='../../leaflet-image.js'></script> | ||
<script> | ||
var snapshot = document.getElementById('snapshot'); | ||
var map = L.map('map') | ||
.setView([38.88995, -77.00906], 8); | ||
|
||
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | ||
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | ||
}).addTo(map); | ||
|
||
var precipitation = L.tileLayer.wms('http://nowcoast.noaa.gov/arcgis/services/nowcoast/analysis_meteohydro_sfc_qpe_time/MapServer/WmsServer', { | ||
format: 'image/png', | ||
transparent: true, | ||
layers: '5' | ||
}).addTo(map); | ||
|
||
setTimeout(function() { | ||
leafletImage(map, doImage); | ||
}, 2000); | ||
|
||
function doImage(err, canvas) { | ||
var img = document.createElement('img'); | ||
var dimensions = map.getSize(); | ||
img.width = dimensions.x; | ||
img.height = dimensions.y; | ||
img.src = canvas.toDataURL(); | ||
snapshot.innerHTML = ''; | ||
snapshot.appendChild(img); | ||
} | ||
</script> | ||
</body> | ||
</html> |
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