-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies, externalized OL for IMD and improve examples (#34)
* updated dependencies and externalized ol variable for umd * cleaned-up examples; added ol vanilla js example
- Loading branch information
Showing
11 changed files
with
521 additions
and
467 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
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
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
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,71 @@ | ||
<!doctype html> | ||
<meta charset="utf-8" /> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/ol.css" /> | ||
|
||
<script src="../../dist/openlayers.umd.js" charset="UTF-8"></script> | ||
|
||
<link href="../../dist/style.css" rel="stylesheet" /> | ||
|
||
<!-- | ||
<script src="https://unpkg.com/@maptiler/geocoding-control@latest/openlayers.umd.js"></script> | ||
<link | ||
href="https://unpkg.com/@maptiler/geocoding-control@latest/style.css" | ||
rel="stylesheet" | ||
/> | ||
--> | ||
|
||
<style> | ||
#map { | ||
position: absolute; | ||
inset: 0; | ||
} | ||
|
||
.ol-search { | ||
position: absolute; | ||
top: 0.5em; | ||
right: 0.5em; | ||
} | ||
</style> | ||
|
||
<div id="map"></div> | ||
|
||
<script> | ||
addEventListener("hashchange", (event) => location.reload()); | ||
|
||
const apiKey = | ||
new URLSearchParams(location.hash.slice(1)).get("key") || | ||
prompt("Please provide your MapTiler API key") || | ||
""; | ||
|
||
const scale = devicePixelRatio > 1.5 ? "@2x" : ""; | ||
|
||
new ol.Map({ | ||
target: document.getElementById("map"), | ||
layers: [ | ||
new ol.layer.Tile({ | ||
source: new ol.source.XYZ({ | ||
url: `https://api.maptiler.com/maps/basic-v2/{z}/{x}/{y}${scale}.png?key=${apiKey}`, | ||
tileSize: 512, | ||
attributions: [ | ||
'<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a>', | ||
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>', | ||
], | ||
}), | ||
}), | ||
], | ||
view: new ol.View({ | ||
center: [0, 0], | ||
zoom: 0, | ||
}), | ||
controls: ol.control.defaults.defaults().extend([ | ||
new openlayersMaptilerGeocoder.GeocodingControl({ | ||
apiKey, | ||
enableReverse: "always", | ||
iconsBaseUrl: "/icons/", | ||
}), | ||
]), | ||
}); | ||
</script> |
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
Oops, something went wrong.