Skip to content

Commit

Permalink
add terrain demo mapboxgl v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sfggeogis committed Feb 18, 2021
1 parent 66cae97 commit e90a7d9
Show file tree
Hide file tree
Showing 85 changed files with 22,754 additions and 22,606 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"liveServer.settings.port": 5501
{
"liveServer.settings.port": 5501
}
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2018 OpenICGC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2018 OpenICGC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OpenICGC.github.io
OpenICGC samples and resources

https://openicgc.github.io/
# OpenICGC.github.io
OpenICGC samples and resources

https://openicgc.github.io/
336 changes: 168 additions & 168 deletions icgc-basemap-map.html
Original file line number Diff line number Diff line change
@@ -1,168 +1,168 @@
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-46332195-9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-46332195-9');
</script>

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});const f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MGS4TSP');</script>
<!-- End Google Tag Manager -->

<meta charset='utf-8' />
<title>Vector-Tiles ICGC</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

<link href='https://cdn.skypack.dev/maplibre-gl/dist/mapbox-gl.css' rel='stylesheet' />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<style>
body {
margin: 0;
padding: 0;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%
}

#menu {
position: absolute;
z-index: 1000;
background: #fff;
padding: 10px;
font-family: 'Open Sans', sans-serif;
top: 5px;
left: 5px;
border-radius: 7px;
-webkit-box-shadow: 5px 5px 5px -5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 5px 5px 5px -5px rgba(0, 0, 0, 0.75);
box-shadow: 5px 5px 5px -5px rgba(0, 0, 0, 0.75);
}

#div_pitch {
position: absolute;
right: 10px;
top: 142px;
width: 30px;
z-index: 100;
}

.sliderClass {
position: absolute;
left: 10px;
top: 79px;
width: 130px;
z-index: 100;
display: none;
background-color: white;
padding: 10px;
border-radius: 4px;
font-size: 0.85em;
opacity: 0.9;

}
</style>

</head>

<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MGS4TSP"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div id='menu'>
<input id='icgc' type='radio' name='rtoggle' value='icgc' checked='checked'>
<label for='icgc'>icgc</label>
<input id='osm-bright' type='radio' name='rtoggle' value='osm-bright'>
<label for='osm-bright'>osm-bright</label>
<input id='positron' type='radio' name='rtoggle' value='positron'>
<label for='positron'>positron</label>
<input id='fulldark' type='radio' name='rtoggle' value='fulldark'>
<label for='fulldark'>fulldark</label>
<input id='night' type='radio' name='rtoggle' value='night'>
<label for='night'>night</label>
<input id='hibrid' type='radio' name='rtoggle' value='hibrid'>
<label for='hibrid'>hibrid</label>

</div>
<div id='div_pitch' class="mapboxgl-ctrl-group mapboxgl-ctrl">
<button id="bt_pitch" title="Perspectiva" class="mapboxgl-ctrl-icon glyphicon glyphicon-road"></button>
</div>

<div id="map"></div>
<script type="module">
import {Map, NavigationControl,GeolocateControl,AttributionControl} from 'https://cdn.skypack.dev/maplibre-gl';
const map = new Map({
container: 'map',
style: 'https://geoserveis.icgc.cat/contextmaps/icgc.json',
center: [2.16859, 41.3954],
zoom: 13,
maxZoom: 14,
hash: true,
pitch: 45,
attributionControl: false
});


map.on('load', function () {

map.addControl(new NavigationControl());
map.addControl(new AttributionControl({
compact: true
}));
map.addControl(new GeolocateControl({
positionOptions: {
enableHighAccuracy: true,
watchPosition: true
}
}));

});


const layerList = document.getElementById('menu');
const inputs = layerList.getElementsByTagName('input');
const button = document.getElementById('bt_pitch');


function switchLayer(layer) {
const layerId = layer.target.id;


map.setStyle('https://geoserveis.icgc.cat/contextmaps/' + layerId + '.json');




}

function canviaPerspectiva() {
const pitch = parseInt(map.getPitch());
pitch == 60 ? pitch = 0 : pitch = pitch + 30;
map.easeTo({
'pitch': pitch
})
};

for (let i = 0; i < inputs.length; i++) {
inputs[i].onclick = switchLayer;
}

button.onclick = canviaPerspectiva;
</script>
</body>

</html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-46332195-9"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-46332195-9');
</script>

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});const f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MGS4TSP');</script>
<!-- End Google Tag Manager -->

<meta charset='utf-8' />
<title>Vector-Tiles ICGC</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />

<link href='https://cdn.skypack.dev/maplibre-gl/dist/mapbox-gl.css' rel='stylesheet' />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<style>
body {
margin: 0;
padding: 0;
}

#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%
}

#menu {
position: absolute;
z-index: 1000;
background: #fff;
padding: 10px;
font-family: 'Open Sans', sans-serif;
top: 5px;
left: 5px;
border-radius: 7px;
-webkit-box-shadow: 5px 5px 5px -5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 5px 5px 5px -5px rgba(0, 0, 0, 0.75);
box-shadow: 5px 5px 5px -5px rgba(0, 0, 0, 0.75);
}

#div_pitch {
position: absolute;
right: 10px;
top: 142px;
width: 30px;
z-index: 100;
}

.sliderClass {
position: absolute;
left: 10px;
top: 79px;
width: 130px;
z-index: 100;
display: none;
background-color: white;
padding: 10px;
border-radius: 4px;
font-size: 0.85em;
opacity: 0.9;

}
</style>

</head>

<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MGS4TSP"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div id='menu'>
<input id='icgc' type='radio' name='rtoggle' value='icgc' checked='checked'>
<label for='icgc'>icgc</label>
<input id='osm-bright' type='radio' name='rtoggle' value='osm-bright'>
<label for='osm-bright'>osm-bright</label>
<input id='positron' type='radio' name='rtoggle' value='positron'>
<label for='positron'>positron</label>
<input id='fulldark' type='radio' name='rtoggle' value='fulldark'>
<label for='fulldark'>fulldark</label>
<input id='night' type='radio' name='rtoggle' value='night'>
<label for='night'>night</label>
<input id='hibrid' type='radio' name='rtoggle' value='hibrid'>
<label for='hibrid'>hibrid</label>

</div>
<div id='div_pitch' class="mapboxgl-ctrl-group mapboxgl-ctrl">
<button id="bt_pitch" title="Perspectiva" class="mapboxgl-ctrl-icon glyphicon glyphicon-road"></button>
</div>

<div id="map"></div>
<script type="module">
import {Map, NavigationControl,GeolocateControl,AttributionControl} from 'https://cdn.skypack.dev/maplibre-gl';
const map = new Map({
container: 'map',
style: 'https://geoserveis.icgc.cat/contextmaps/icgc.json',
center: [2.16859, 41.3954],
zoom: 13,
maxZoom: 14,
hash: true,
pitch: 45,
attributionControl: false
});


map.on('load', function () {

map.addControl(new NavigationControl());
map.addControl(new AttributionControl({
compact: true
}));
map.addControl(new GeolocateControl({
positionOptions: {
enableHighAccuracy: true,
watchPosition: true
}
}));

});


const layerList = document.getElementById('menu');
const inputs = layerList.getElementsByTagName('input');
const button = document.getElementById('bt_pitch');


function switchLayer(layer) {
const layerId = layer.target.id;


map.setStyle('https://geoserveis.icgc.cat/contextmaps/' + layerId + '.json');




}

function canviaPerspectiva() {
const pitch = parseInt(map.getPitch());
pitch == 60 ? pitch = 0 : pitch = pitch + 30;
map.easeTo({
'pitch': pitch
})
};

for (let i = 0; i < inputs.length; i++) {
inputs[i].onclick = switchLayer;
}

button.onclick = canviaPerspectiva;
</script>
</body>

</html>
Loading

0 comments on commit e90a7d9

Please sign in to comment.