Платформа ЦРНП "Мирокод" для разработки проектов
https://git.mirocod.ru
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.0 KiB
60 lines
2.0 KiB
{{template "base/head" .}} |
|
<div class="page-content explore repositories"> |
|
{{template "map/navbar" .}} |
|
<link rel="stylesheet" href="/assets/lib/leaflet/dist/leaflet.css" crossorigin="" /> |
|
<script src="/assets/lib/leaflet/dist/leaflet.js"></script> |
|
<script src="/assets/lib/leaflet.markercluster/dist/leaflet.markercluster.js"></script> |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
|
<link rel="stylesheet" href="/assets/lib/leaflet.markercluster/example/screen.css" /> |
|
|
|
<link rel="stylesheet" href="/assets/lib/leaflet.markercluster/dist/MarkerCluster.css" /> |
|
<link rel="stylesheet" href="/assets/lib/leaflet.markercluster/dist/MarkerCluster.Default.css" /> |
|
|
|
|
|
<script> |
|
//An extract of address points from the LINZ bulk extract: http://www.linz.govt.nz/survey-titles/landonline-data/landonline-bde |
|
//Should be this data set: http://data.linz.govt.nz/#/layer/779-nz-street-address-electoral/ |
|
|
|
var addressPoints = [ |
|
|
|
{{range .Users}} |
|
{{if .LocationCoordinate}} |
|
[parseFloat({{.LocationCoordinate}}.split(',')[0]) , parseFloat({{.LocationCoordinate}}.split(',')[1]), "<a href='{{.HomeLink}}'>{{avatar .}} {{.FullName}}</a> <li> <div class=\"render-content markup\"> {{.Description | Str2html}} </div> </li>"], |
|
{{end}} |
|
{{else}} |
|
|
|
{{end}} |
|
]; |
|
|
|
</script> |
|
|
|
|
|
<div id="map"></div> |
|
<script type="text/javascript"> |
|
|
|
var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
|
maxZoom: 16, |
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Points © 2012 LINZ' |
|
}), |
|
latlng = L.latLng(55.4, 37.3); |
|
|
|
var map = L.map('map', {center: latlng, zoom: 5, layers: [tiles]}); |
|
|
|
var markers = L.markerClusterGroup({ chunkedLoading: true }); |
|
|
|
for (var i = 0; i < addressPoints.length; i++) { |
|
var a = addressPoints[i]; |
|
var title = a[2]; |
|
var marker = L.marker(L.latLng(a[0], a[1]), { title: title }); |
|
marker.bindPopup(title); |
|
markers.addLayer(marker); |
|
} |
|
|
|
map.addLayer(markers); |
|
|
|
</script> |
|
|
|
</div> |
|
{{template "base/footer" .}}
|
|
|