summaryrefslogtreecommitdiff
path: root/ishtar_common/static/js/ishtar-map.js
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/static/js/ishtar-map.js')
-rw-r--r--ishtar_common/static/js/ishtar-map.js59
1 files changed, 48 insertions, 11 deletions
diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js
index 3a0b4bd35..8fb01f06c 100644
--- a/ishtar_common/static/js/ishtar-map.js
+++ b/ishtar_common/static/js/ishtar-map.js
@@ -1,13 +1,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);
+
+
+}
-var map = new ol.Map({
- target: 'map',
- layers: [
- new ol.layer.Tile({
- source: new ol.source.OSM()
- })],
- view: new ol.View({
- center: ol.proj.fromLonLat([37.41, 8.82]),
- zoom: 4
- })
-});