1
var georssLayers = new Array();
2
{{for layer in georss_layers:}}
3
{{name = re.sub('\W', '_', layer)}}
4
iconURL = "{{=URL(r=request, c='default', f='download', args=georss_layers[layer].marker)}}";
5
icon_img.src = iconURL;
6
width = icon_img.width;
7
height = icon_img.height;
9
height = ((max_w / width) * height);
13
width = ((max_h / height) * width);
16
style_marker.graphicWidth = width;
17
style_marker.graphicHeight = height;
18
style_marker.graphicXOffset = -(width / 2);
19
style_marker.graphicYOffset = -height;
20
style_marker.externalGraphic = iconURL;
21
var georssLayer{{=name}} = new OpenLayers.Layer.GML( "{{=layer}}", "{{=georss_layers[layer].url}}", {
22
strategies: [ new OpenLayers.Strategy.Cluster({distance: {{=cluster_distance}}, threshold: {{=cluster_threshold}}}) ],
23
format: OpenLayers.Format.GeoRSS, style: style_marker,
25
// adds the thumbnail attribute to the feature
26
createFeatureFromItem: function(item) {
27
var feature = OpenLayers.Format.GeoRSS.prototype.createFeatureFromItem.apply(this, arguments);
28
//feature.attributes.thumbnail =
29
// this.getElementsByTagNameNS(
30
// item, "*", "thumbnail")[0].getAttribute("url");
34
{{if georss_layers[layer].projection == 4326:}}
35
projection: proj4326});
37
projection: new OpenLayers.Projection('EPSG:{{=georss_layers[layer].projection}}')});
39
{{if georss_layers[layer].visibility:}}
40
georssLayer{{=name}}.setVisibility(true);
42
georssLayer{{=name}}.setVisibility(false);
44
map.addLayer(georssLayer{{=name}});
45
georssLayers.push(georssLayer{{=name}});
46
georssLayer{{=name}}.events.on({ "featureselected": onGeorssFeatureSelect, "featureunselected": onFeatureUnselect });
49
allLayers = allLayers.concat(georssLayers);
51
function onGeorssFeatureSelect(event) {
52
var feature = event.feature;
53
var selectedFeature = feature;
54
if (undefined == feature.attributes.description) {
55
var popup = new OpenLayers.Popup.FramedCloud("chicken",
56
feature.geometry.getBounds().getCenterLonLat(),
57
new OpenLayers.Size(200,200),
58
"<h2>" + feature.attributes.title + "</h2>",
59
null, true, onPopupClose);
61
var popup = new OpenLayers.Popup.FramedCloud("chicken",
62
feature.geometry.getBounds().getCenterLonLat(),
63
new OpenLayers.Size(200,200),
64
"<h2>" + feature.attributes.title + "</h2>" + feature.attributes.description,
65
null, true, onPopupClose);
67
feature.popup = popup;
68
popup.feature = feature;