ol-ext/examples/misc/map.geojsonx.html
2024-06-26 16:24:06 +02:00

106 lines
2.8 KiB
HTML

<DOCTYPE html>
<html>
<head>
<!--
Copyright (c) 2015-2019 Jean-Marc VIGLINO,
released under CeCILL-B (french BSD like) licence: http://www.cecill.info/
-->
<title>GeoJSONX format</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Perspective ol map" />
<meta name="keywords" content="openlayers, layer, 3D, perspective, animation" />
<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
<!-- Openlayers -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@latest/ol.css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ol@latest/dist/ol.js"></script>
<!-- ol-ext -->
<link rel="stylesheet" href="../../dist/ol-ext.css" />
<script type="text/javascript" src="../../dist/ol-ext.js"></script>
<!-- Pointer events polyfill for old browsers, see https://caniuse.com/#feat=pointer -->
<script src="https://unpkg.com/elm-pep"></script>
<link rel="stylesheet" href="../style.css" />
<style>
#map {
width: 800px;
height: 600px;
z-index: 0;
}
.isloading {
opacity: .5;
}
</style>
</head>
<body >
<a href="https://github.com/Viglino/ol-ext" class="icss-github-corner"><i></i></a>
<a href="../../index.html">
<h1>GeoJSONX format</h1>
</a>
<div class="info">
<p>
<span class="experimental">Experimental</span>
</p>
</div>
<!-- DIV pour la carte -->
<div id="map"></div>
<div class="options">
</div>
<script type="text/javascript">
var layer = new ol.layer.Tile({ name:"OSM", source: new ol.source.OSM() });
// The map
var map = new ol.Map({
target: 'map',
view: new ol.View ({
zoom: 6,
center: [413609, 5881092]// [-245575, 5986863], //[-244777, 5989809]
}),
interactions: ol.interaction.defaults(),
layers: [ layer ]
});
map.addControl(new ol.control.LayerSwitcher());
map.addControl(new ol.control.Permalink({ visible: false }));
// Select interaction
var select = new ol.interaction.Select({
hitTolerance: 3,
condition: ol.events.condition.singleClick
});
map.addInteraction(select);
// Popup on select
var popup = new ol.Overlay.PopupFeature({
className: 'default anim',
select: select
});
map.addOverlay (popup);
// Add feature on drop
var dd = new ol.interaction.DropFile();
map.addInteraction(dd);
dd.on('loadstart', function () {
$('body').addClass('isloading');
});
dd.on('loadend', function (e) {
var layer = new ol.layer.VectorImage({
title: e.file.name,
source: new ol.source.Vector()
})
layer.getSource().addFeatures(e.features);
map.addLayer(layer);
$('body').removeClass('isloading');
window.feat = e.features;
window.layer = layer;
});
</script>
</body>
</html>