Revision 92178800
Added by Andreas Kohlbecker over 3 years ago
modules/cdm_dataportal/js/map/openlayers_map.js | ||
---|---|---|
345 | 345 |
success: function(data){ |
346 | 346 |
var layers = createDataLayer(data, "AREA"); |
347 | 347 |
addLayers(layers); |
348 |
// layerDataLoaded(); will be called after reading the projection from the WFS for the data layer |
|
348 |
// layerDataLoaded(); will be called after reading the projection from the WFS |
|
349 |
// for the data layer, see readProjection() |
|
349 | 350 |
}, |
350 | 351 |
error: function(jqXHR, textStatus, errorThrown){ |
351 | 352 |
reportAjaxError("Distribution Layer: " +textStatus, mapServiceRequest, errorThrown); |
... | ... | |
693 | 694 |
layers.forEach(function(layer){ |
694 | 695 |
// layer.setVisibility(false); |
695 | 696 |
}); |
696 |
|
|
697 | 697 |
map.addLayers(layers); |
698 | 698 |
}; |
699 | 699 |
|
700 | 700 |
/** |
701 | 701 |
* add a distribution or occurrence layer |
702 | 702 |
* |
703 |
* @param mapResponseObj
|
|
704 |
* The reponse object returned by the edit map service
|
|
703 |
* @param mapResponseArray
|
|
704 |
* The map service returns the mapResponseObj in an array with one element.
|
|
705 | 705 |
* @param dataType |
706 | 706 |
* either "AREA" or "POINT" |
707 | 707 |
*/ |
708 |
var createDataLayer = function(mapResponseObj, dataType){
|
|
708 |
var createDataLayer = function(mapResponseArray, dataType){
|
|
709 | 709 |
|
710 | 710 |
console.log("createDataLayer() : creating data layer of type " + dataType); |
711 | 711 |
|
712 |
dataLayerOptions = makeWMSLayerOptions(); |
|
712 |
var dataLayerOptions = makeWMSLayerOptions();
|
|
713 | 713 |
dataLayerOptions.displayOutsideMaxExtent = true; // move into makeWMSLayerOptions? |
714 | 714 |
|
715 | 715 |
var layers = []; |
716 | 716 |
// add additional layers, get them from the mapResponseObj |
717 |
if(mapResponseObj !== undefined){ |
|
717 |
if(mapResponseArray !== undefined){ |
|
718 |
var mapResponseObj = mapResponseArray[0]; |
|
718 | 719 |
if(dataType === "POINT" && mapResponseObj.points_sld !== undefined){ |
719 | 720 |
var pointLayer; |
720 | 721 |
// it is a response for an point map |
... | ... | |
860 | 861 |
projection = layerProjections[layer.name]; |
861 | 862 |
} |
862 | 863 |
|
863 |
|
|
864 | 864 |
if(projection) { |
865 | 865 |
callback(projection); |
866 | 866 |
} else { |
Also available in: Unified diff
ref #9224 adapting openlayers map from jsonp to json ajax