[OpenLayers-Users] Routing Layer

Linda Rawson linda.rawson at gmail.com
Fri Sep 7 11:15:15 EDT 2007


Chris,

You remember that POI stuff we discussed?  That is sort of the thing that I
have to do.  Basically I read the data and create a vector layer with the
lines and then I create a marker layer.  They are tied together with a
change that Eric made proposed in the next release.  The layerswitched event
is what he customized.
// ***** Routes *****

markerRouteLayer = new OpenLayers.Layer.Markers("Routes");

vectorRouteLayer = new OpenLayers.Layer.Vector("RouteLines");

markerRouteLayer.events.register('layerswitched', vectorRouteLayer,
function(e) {

vectorRouteLayer.setVisibility(markerRouteLayer.getVisibility());

});

vectorRouteLayer.displayInLayerSwitcher = false;

GetRouteItems(PassID);

map.addLayer(vectorRouteLayer);

map.addLayer(markerRouteLayer);
----------------------------------------------------------- Ajax Calls or in
my case .Net Webservice stuff


var startIconUrl = imageDirectory + "startpoint.gif";

var endIconUrl = imageDirectory + "endpoint.gif";

for(i = 0; i < result.length; i++) {

var pointList = [];

for (j = 0; j < result[i].LatitudeList.length; j++) {

var newPoint = new OpenLayers.Geometry.Point(result[i].LongitudeList[j],
result[i].LatitudeList[j]);

pointList.push(newPoint);

if (result[i].RouteIconList[j] != "") {

markerRouteLayer.addMarker(getMyMarker(imageDirectory + "wpicons/" +
result[i].RouteIconList[j], result[i].LatitudeList[j],
result[i].LongitudeList[j]));

}

}

//add trail markers

markerRouteLayer.addMarker(getMyMarker(startIconUrl,
result[i].LatitudeList[0], result[i].LongitudeList[0]));

markerRouteLayer.addMarker(getMyMarker(endIconUrl,
result[i].LatitudeList[j-1], result[i].LongitudeList[j-1]));

//add trail line

var lineFeature = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.LineString(pointList),"","");

vectorRouteLayer.addFeatures(lineFeature);

}
Hope this helps....
Linda Rawson



On 9/6/07, Chris Hardin <chrislhardin at gmail.com> wrote:
>
> Does anyone know a good way to generate a routing overlay with
> mapserver? I want to send to coordinates to the server and generate a
> route to overlay on the map.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070907/fa70dd9e/attachment.html


More information about the Users mailing list