map.pug
2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
extends layout
block content
script.
function relocate_home()
{
location.href = "/map/" + nome.value;
}
#map
script(type='text/javascript').
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
southWest = L.latLng(#{bndSW}),
northEast = L.latLng(#{bndNE}),
bounds = L.latLngBounds(southWest, northEast),
osmAttrib = '',
osm = L.tileLayer(osmUrl,
{attribution: osmAttrib}),
map = L.map('map', {
center: new L.LatLng(#{lat},#{lng}),
zoom: #{fator_zoom},
maxBounds: bounds
});
map.attributionControl.setPrefix('');
wmsLayer= L.tileLayer.wms("#{geoserverWMS}", {
layers: "#{waterLayers}",
format: 'image/png',
transparent: true,
maxZoom: 23
}),
drawnItems = L.featureGroup().addTo(map);
// places the logomark
L.Control.Watermark = L.Control.extend({
onAdd: function(map) {
var img = L.DomUtil.create('img');
//- img.src = "http://www.saesascs.sp.gov.br/wp-content/themes/portaldae/img/logo-saesa.png";
img.src = 'https://nexusbr.com/images/logo.png';
img.style.width = '130px';
return img;
},
onRemove: function(map) {
// Nothing to do here
}
});
L.control.watermark = function(opts) {
return new L.Control.Watermark(opts);
}
L.control.watermark({ position: 'bottomright' }).addTo(map);
// places the layer control to on and off
L.control.layers({
"OSM": osm.addTo(map),
"Google": L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}', {
attribution: 'google'
})
},
{'Redes': wmsLayer, 'Ocorrências': drawnItems},
{ position: 'topright', collapsed: false }
).addTo(map);
// places the marker that was found
var marker = L.marker([#{lat},#{lng}]).addTo(map);
marker.bindPopup("<b>#{codigo}</b><br>#{consumidor}").openPopup();