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.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js
index f1fbca3e1..a8e1a4fa5 100644
--- a/ishtar_common/static/js/ishtar-map.js
+++ b/ishtar_common/static/js/ishtar-map.js
@@ -2,6 +2,8 @@
var default_pointer = "../media/images/default-pointer.png";
+var view_projection = 'EPSG:3857';
+
var source_osm = function(options){
return new ol.layer.Tile({
source: new ol.source.OSM()
@@ -63,24 +65,31 @@ var get_style = function(feature){
/* display map */
+var vector_source;
+var vector_layer;
+var map_layers;
+var map;
+var geojson_format = new ol.format.GeoJSON(
+ {dataProjection:'EPSG:4326', featureProjection: view_projection});
+
var display_map = function(map_id, points, layers){
- console.log((new ol.format.GeoJSON()).readFeatures(points));
- var vector_source = new ol.source.Vector({
- features: (new ol.format.GeoJSON()).readFeatures(points)
+ vector_source = new ol.source.Vector({
+ features: geojson_format.readFeatures(points)
});
- var vector_layer = new ol.layer.Vector({
+ vector_layer = new ol.layer.Vector({
source: vector_source,
style: get_style
});
- var map_layers = get_layers(layers);
+ map_layers = get_layers(layers);
map_layers.push(vector_layer);
- var map = new ol.Map({
+ map = new ol.Map({
target: map_id,
layers: map_layers,
view: new ol.View({
+ projection: view_projection,
center: ol.proj.fromLonLat([37.41, 8.82]),
zoom: 4
})