-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
topojson.js
47 lines (43 loc) · 1.07 KB
/
topojson.js
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
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.TileLayer');
goog.require('ol.layer.Vector');
goog.require('ol.parser.TopoJSON');
goog.require('ol.source.TileJSON');
goog.require('ol.source.Vector');
goog.require('ol.style.Polygon');
goog.require('ol.style.Rule');
goog.require('ol.style.Style');
var raster = new ol.layer.TileLayer({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.world-dark.jsonp'
})
});
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
url: 'data/topojson/world-110m.json',
parser: new ol.parser.TopoJSON()
}),
style: new ol.style.Style({rules: [
new ol.style.Rule({
symbolizers: [
new ol.style.Polygon({
strokeColor: '#FFF',
fillColor: '#BADA55',
strokeWidth: 1.5,
opacity: 0.5
})
]
})
]})
});
var map = new ol.Map({
layers: [raster, vector],
renderer: ol.RendererHint.CANVAS,
target: 'map',
view: new ol.View2D({
center: [0, 0],
zoom: 1
})
});