[OpenLayers-Users] expand on georss layer
Don Martin
donm at alaska.net
Fri Sep 12 20:35:38 EDT 2008
we abandoned georss and created a straight gml layer which solved the issues
listed.
Don Martin wrote:
>
> We've got a georss example working on our site - truck tracking records
> from a sql query rendered as georss.
> We need a couple of other things from this layer if possible -
> 1. color coded markers/icons indicating when the vehicle is next
> scheduled to be available - so different markers for a particular record
> determined by a field in our query (then to xml?).
> 2. clicking on a marker needs to pass an id (that we can tie back to the
> sql table/query) to a textbox on the page but off the map to support
> further processing.
>
> Included below is the working geoss layer call and an uninformed attempt
> at a GML/georss layer (obviously not really getting it).
>
> Would someone kindly direct me to a sample (GML or vector presumably) that
> would support our needs?
>
> working georss layer:
>
> function loadvehicleLayers() {
> carrier_id = document.getElementById('DDvcarrier').value;
> vehicle_ref = document.getElementById('DDvvehicle').value;
> datepass = document.getElementById('selvdateTextBox').value;
>
> listname = "vehicletrack";
> filecall =
> "../component/mapxml.aspx?actv="+listname+"&carv="+carrier_id+"&vehv="+vehicle_ref+"&datev="+datepass
> icon = new OpenLayers.Icon("../images/map/Pushpin.png", new
> OpenLayers.Size(18,18));
> vehiclelay = new OpenLayers.Layer.GeoRSS( 'vehicle', filecall,
> {'icon':icon, 'useFeedTitle':false });
> vehiclelay.events.register("loadend", window, vehicletrac);
>
> function vehicletrac() {
> vehiclelineLayer = new
> OpenLayers.Layer.PointTrack(vehiclelay.name + " track",
> {dataFrom:
> OpenLayers.Layer.PointTrack.dataFrom.SOURCE_NODE});
> vehiclelineLayer.addNodes(vehiclelay.features);
> map.addLayer(vehiclelineLayer);
> vehiclelay.setName(vehiclelay.name + " node");
> var feature, marker;
> for (var i = vehiclelay.features.length-1; i>0; i--) {
> if (vehiclelay.features[i].data.popupContentHTML.indexOf(
> "Untitled") != -1) {
> vehiclelay.removeMarker(vehiclelay.markers[i]);
> }
> }
> map.raiseLayer(vehiclelay, 4);
> map.addLayer(vehiclelay);
> }
>
> georss xml created from sql query:
>
> <?xml version="1.0" encoding="utf-8" ?>
> - <rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
> - <channel>
> - <item>
> <pubDate>6/4/2008 8:00:48 AM</pubDate>
> <geo:lat>61.221620000</geo:lat>
> <geo:long>-149.850155000</geo:long>
> <title>begin point: 08:00:48</title>
> <description>Location: UNITED FRT and TRANS</description>
> </item>
> - <item>
> <pubDate>6/4/2008 8:36:20 AM</pubDate>
> <geo:lat>61.164890000</geo:lat>
> <geo:long>-149.861286000</geo:long>
> <title>BobTail - 08:36:20</title>
> <description>Location: SMURFIT - ANCH RECYCL - vehicle: 86 - driver: Tim
> February</description>
> </item>
> < ... >
>
>
> non-working GML/georss layer attempt:
>
> function loadvehicleLayers() {
>
> carrier_id = document.getElementById('DDvcarrier').value;
> vehicle_ref = document.getElementById('DDvvehicle').value;
> datepass = document.getElementById('selvdateTextBox').value;
> listname = "vehicletrack";
> filecall =
> "../component/mapgeorss.aspx?actv="+listname+"&carv="+carrier_id+"&vehv="+vehicle_ref+"&datev="+datepass
>
> var in_options = {
> //'internalProjection': new
> OpenLayers.Projection("EPSG:900913"),
> //'externalProjection': new
> OpenLayers.Projection("EPSG:4326"),
> 'type':'eventType alertLevel'
> };
>
> var styleMap = new OpenLayers.StyleMap({
> fillOpacity: 1,
> pointRadius: 10
> });
>
> var lookup = {
> dflt: {externalGraphic: "../images/map/vertex[1].png"},
> test1: {externalGraphic: "../images/map/vertex[1].png"},
> test2: {externalGraphic: "../images/map/vertex[1].png"}
> }
>
> styleMap.addUniqueValueRules("default", "type", lookup);
> var georssformat = new OpenLayers.Format.GeoRSS(in_options);
> //OpenLayers.Format.GeoRSS.prototype.xy = true;
> vehiclelay = new OpenLayers.Layer.GML("vehicle node",
> filecall,
> {format: georssformat, styleMap: styleMap});
>
> map.raiseLayer(vehiclelay, 4);
> map.addLayer(vehiclelay);
> }
>
> georss (for GML) xml created from sql query:
>
> <?xml version="1.0" encoding="utf-8" ?>
> - <rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
> - <channel>
> - <item>
> <pubDate>6/4/2008 8:00:48 AM</pubDate>
> <geo:point>61.221620000 -149.850155000</geo:point>
> <title>begin point: 08:00:48</title>
> <description>Location: UNITED FRT and TRANS <br> new rec -
> ../default.aspx new manefest record </description>
> <type>dflt</type>
> </item>
> - <item>
> <pubDate>6/4/2008 8:36:20 AM</pubDate>
> <geo:point>61.164890000 -149.861286000</geo:point>
> <title>BobTail - 08:36:20</title>
> <description>Location: SMURFIT - ANCH RECYCL - vehicle: 86 - driver: Tim
> February <br> new rec - ../default.aspx new manefest record
> </description>
> <type>dflt</type>
> </item>
> - <item>
> < ... >
>
> would appreciate any suggestions.
> Don
>
>
--
View this message in context: http://www.nabble.com/expand-on-georss-layer-tp19080770p19466282.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list