mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-24 00:47:57 -05:00
28 lines
1.0 KiB
HTML
28 lines
1.0 KiB
HTML
|
<!-- template for the WFS3 API leaflet map -->
|
||
|
<div class="col-md-6">
|
||
|
<div id="mapid" class="small"></div>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
jQuery( document ).ready(function( $ ) {
|
||
|
var map = L.map('mapid').setView([0, 0], 13);
|
||
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||
|
}).addTo(map)
|
||
|
$.get( "{{ metadata.geojsonUrl }}", function( data ) {
|
||
|
var jl = L.geoJSON( data, {
|
||
|
onEachFeature: function (feature, layer) {
|
||
|
layer.bindPopup('<h1>'+feature.id +'</h1>');
|
||
|
}
|
||
|
}).addTo(map);
|
||
|
map.setView(jl.getBounds().getCenter());
|
||
|
if ( jl.getBounds().getEast() != jl.getBounds().getWest() && jl.getBounds().getNorth() != jl.getBounds().getSouth() )
|
||
|
{
|
||
|
map.fitBounds(jl.getBounds());
|
||
|
}
|
||
|
jl.on('featureOver', featureOver);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
</script>
|
||
|
</div>
|