forked from SharpMap/SharpMap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript_ll.js
More file actions
64 lines (58 loc) · 2.06 KB
/
script_ll.js
File metadata and controls
64 lines (58 loc) · 2.06 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
64
$(document).ready(function () {
var lon = -73.9529, lat = 40.7723, zoom = 10,
map = new L.Map('map'), center, url, cloudmade;
map.on('load', function (e) {
var bounds, jsurl, options, layer;
bounds = e.target.getBounds();
jsurl = [
'/json.ashx?MAP_TYPE=DEF&BBOX=',
bounds._southWest.lat, ',',
bounds._southWest.lng, ',',
bounds._northEast.lat, ',',
bounds._northEast.lng
].join('');
options = {
radius: 8,
fillColor: "#FF7800",
color: "#000000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
};
layer = new L.GeoJSON(null, {
pointToLayer: function (f) {
var raw = f.geometry.coordinates;
var ll = new L.LatLng(raw[1], raw[0]);
return new L.CircleMarker(ll, options);
},
style: function (f) {
var geom = f.geometry, type = geom.type;
if (type === 'Polygon' || type === 'MultiPolygon') {
return {
color: 'rgb(0,0,180)',
weight: 4,
opacity: 0.6
};
} else if (type === 'LineString' || type === 'MultiLineString') {
return {
color: 'rgb(180,0,0)',
weight: 1,
opacity: 0.9
};
}
}
});
$.getJSON(jsurl, function (evt) {
layer.addData(evt.features);
map.addLayer(layer);
});
});
center = new L.LatLng(lat, lon);
map.setView(center, zoom);
url = ['http://{s}tile.cloudmade.com', '/1a235b638b614b458deeb77c7dae4f80', '/998/256/{z}/{x}/{y}.png'].join('');
cloudmade = new L.TileLayer(url, {
maxZoom: 18,
subdomains: ['a.', 'b.', 'c.', '']
});
map.addLayer(cloudmade);
});