summaryrefslogtreecommitdiff
path: root/ishtar_common/static/js/ishtar-map.js
blob: 8fb01f06c733b92ca2da4190a7f72cbdac53f0c2 (plain)
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
/* layers */

var source_osm = function(options){
    return new ol.layer.Tile({
        source: new ol.source.OSM()
    });
};


var map_layers = {
    'osm': source_osm
};

var get_layers = function(layers){
    if (!layers){
        layers = [{'type': 'osm', 'options': null}];
    }
    console.log(layers);
    var ol_layers = [];
    for (idx in layers){
        var layer_attr = layers[idx];
        ol_layers.push(
            map_layers[layer_attr['type']](layer_attr['options'])
        );
    }
    return ol_layers;
};

/* get markers */

var get_markers = function(points){
};


/* display map */

var display_map = function(map_id, points, layers){
    var map = new ol.Map({
        target: map_id,
        layers: get_layers(layers),
        view: new ol.View({
            center: ol.proj.fromLonLat([37.41, 8.82]),
            zoom: 4
        })
    });
    get_markers(points);


}