GeoRSS Parameters
The GeoRSS object may be configured using any of the following parameters.
URL - When using a remote GeoRSS feed
In the following example we are passing a URL to the GeoRSS object.
liteMap.createMap('atMap', { mapSource: 'Workshop/AllMaps', view:{easting:495553, northing:175654, zoom:2000}, geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss' } });
Astun.JS.IncludeJS('lite',function() { $('atMap').map = new Astun.JS.Map('atMap',{ view:{easting:495553, northing:175654, zoom:2000}, mapSource:'Workshop/AllMaps', geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss' } }); });
XML - When using an embedded GeoRSS feed
You can also pass a GeoRSS feed directly into the map as an xml string; which replaces the URL parameter. This can make it easier for a CMS to embed the map. You accomplish this by escaping the GeoRSS feed and then either storing it in a JavaScript string variable or in a hidden input field.
Using a JavaScript Variable
var xmlString = unescape( '%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%%3Crss%20version%3D%222.0%22 … %3C/rss%3E' ); liteMap.createMap('atMap', { mapSource: 'Workshop/AllMaps', view:{easting:495553, northing:175654, zoom:2000}, geoRSS: { xml: xmlString } });
var xmlString = unescape( '%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%%3Crss%20version%3D%222.0%22 … %3C/rss%3E' ); Astun.JS.IncludeJS('lite',function() { $('atMap').map = new Astun.JS.Map('atMap',{ view:{easting:495553, northing:175654, zoom:2000}, mapSource:'Workshop/AllMaps', geoRSS: { xml: xmlString } }); });
Using a Hidden Input field
<input type=”hidden” name=”xml” id=”xml” value=”%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%%3Crss%20version%3D%222.0%22 … %3C/rss%3E” /> var xmlString = unescape( document.getElementById('xml').value ); liteMap.createMap('atMap', { mapSource: 'Workshop/AllMaps', view:{easting:495553, northing:175654, zoom:2000} geoRSS: { xml: xmlString } });
<input type=”hidden” name=”xml” id=”xml” value=”%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%%3Crss%20version%3D%222.0%22 … %3C/rss%3E” /> var xmlString = unescape( document.getElementById('xml').value ); Astun.JS.IncludeJS('lite',function() { $('atMap').map = new Astun.JS.Map('atMap',{ view:{easting:495553, northing:175654, zoom:2000}, mapSource:'Workshop/AllMaps', geoRSS: { xml: xmlString } }); });
STYLE - for changing the icon style
The style property allows us to change the icon that is used for the markers. e.g.
var newStyle = new OpenLayers.Style({ 'externalGraphic': '/images/marker-blue.png', 'graphicHeight': 25, 'graphicWidth': 21, 'graphicXOffset': -10.5, 'graphicYOffset': -12.5 }); liteMap.createMap('atMap', { mapSource: 'Workshop/AllMaps', layers: 'Primary Schools,Secondary Schools', view:{easting:495553, northing:175654, zoom:2000} geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss', style: 'newStyle' } });
var newStyle = new OpenLayers.Style({ 'externalGraphic': '/images/marker-blue.png', 'graphicHeight': 25, 'graphicWidth': 21, 'graphicXOffset': -10.5, 'graphicYOffset': -12.5 }); Astun.JS.IncludeJS('lite',function() { $('atMap').map = new Astun.JS.Map('atMap',{ view:{easting:495553, northing:175654, zoom:2000}, mapSource:'Workshop/AllMaps', geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss', style: 'newStyle' } }); });
This would produce a map something like this:
POPUPSIZE - for changing the Pop-up Size
You may wish to set the pop-up to a specific size, and if so, you can add the popupSize parameter e.g.
liteMap.createMap('atMap', { mapSource: 'Workshop/AllMaps', layers: 'Primary Schools,Secondary Schools', view:{easting:495553, northing:175654, zoom:2000}, geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss', popupSize: { w: 250, h: 200 } } });
Astun.JS.IncludeJS('lite',function() { $('atMap').map = new Astun.JS.Map('atMap',{ view:{easting:495553, northing:175654, zoom:2000}, mapSource:'Workshop/AllMaps', geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss', popupSize: new OpenLayers.Size(250, 200) } }); });
This will change the popup to be something like this:
POPUPTYPE - for changing the Pop-up Type
There are different types of pop-ups that can be used other than the standard one. These are detailed in the OpenLayers documentation. To set a different pop-up type (FramedCloud), you can set the popupType parameter.
liteMap.createMap('atMap', { mapSource: 'Workshop/AllMaps', layers: 'Primary Schools,Secondary Schools', view:{easting:495553, northing:175654, zoom:2000}, geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss' popupType: 'anchored', } });
Astun.JS.IncludeJS('lite',function() { $('atMap').map = new Astun.JS.Map('atMap',{ view:{easting:495553, northing:175654, zoom:2000}, mapSource:'Workshop/AllMaps', geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss', popupType: OpenLayers.Popup.Anchored } }); });
This will produce a map like this:
CUSTOMPOPUP - for defining a Custom Pop-up
If you need to create a custom pop-up, you can include any HTML required in the Description field and set the customPopup parameter to true. When you enable the custom pop-up, you can also include these tags in the HTML source and they will be automatically replaced with the relevant fields: {title} {link}
liteMap.createMap('atMap', { mapSource: 'Workshop/AllMaps', layers: 'Primary Schools,Secondary Schools', view:{easting:495553, northing:175654, zoom:2000}, geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss', customPopup: true } });
Astun.JS.IncludeJS('lite',function() { $('atMap').map = new Astun.JS.Map('atMap',{ view:{easting:495553, northing:175654, zoom:2000}, mapSource:'Workshop/AllMaps', geoRSS: { url: 'http://www.somesite.co.uk/geoRSSurl.rss', customPopup: true } }); });
E.g. if your description contains the following HTML:
<h2><a href=”{astun:link}”>{astun:title}</a></h2><hr><p>This is the description</p>
You would end up with something like this in the popup:
<h2><a href=”page.html”>This is the title</a></h2><hr><p>This is the description</p>