Skip to content

Commit

Permalink
Map Layers now loaded from single common object
Browse files Browse the repository at this point in the history
  • Loading branch information
jaycrossler committed May 27, 2014
1 parent 6e22901 commit 39a94b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
5 changes: 4 additions & 1 deletion geoq/core/static/core/js/leaflet_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ leaflet_helper.layer_conversion = function (lyr) {
opacity: lyr.opacity,
zIndex: lyr.zIndex,
visibile: lyr.shown,
url: lyr.url
url: lyr.url,
name: lyr.name,
details: lyr.details
};

var layerParams = lyr.layerParams || {};
var layerOptions;
var outputLayer = undefined;
Expand Down
16 changes: 3 additions & 13 deletions geoq/core/static/core/js/leafletcontrols/leaflet.layer_tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,21 +385,11 @@ leaflet_layer_control.addLayerControl = function (map, options) {
if (!name && layer.options) name = layer.options.name;
log.info("Creating a map layer", name, " URL: ", layer.url);

//TODO: Move this to generic layer loading script
if (layer.type == "WMS"){

var newLayer = L.tileLayer.wms(layer.url, {
layers: layer.layer,
format: layer.format || 'image/png',
transparent: layer.transparent,
attribution: layer.attribution,
name: layer.name,
details: layer
});
var newLayer = leaflet_helper.layer_conversion(layer);
if (newLayer) {
aoi_feature_edit.map.addLayer(newLayer);

leaflet_layer_control.setLayerOpacity(newLayer,1);

//TODO: Rethink if this should become a sub-item of the object
layer_obj.data = newLayer;

//Replace the old object list with the new layer
Expand Down

0 comments on commit 39a94b6

Please sign in to comment.