how to blink a line on a map which is formed by lat lon points through linestring from database the points(lat,lon) comes which is stored in form of MultiLineString. similarly like how a point blinking on a map same way the line should blink on map. (or)

I need to show on a map line blinking below code is displaying a line on the map but it should be made line blinking not all but particular some lines.

code :-

var mainfed = new OpenLayers.Layer.Vector("Mainfed");

$.get('http://'localhost:90'/them/date-feeder.php',function(data) { //getting the data from DB through php

   var records = data.split(',<br>'); //recognize the lat,lon through splitting the  records

 for(var idx=0;idx<records.length;idx++)
    var myarr = records[idx].split(",");
    var points = new Array()
    for(i = 0; i < myarr.length; i++)
        var lon = parseFloat(myarr[i++]);
        var lat = parseFloat(myarr[i]);

                      points.push(new OpenLayers.Geometry.Point(lon,lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()) );
         var line = new OpenLayers.Geometry.LineString(points);
         var style = {
         'class': 'lineblink',
          strokeColor: 'red', 
          strokeOpacity: 5,
          strokeWidth: 2
 var lineFeature = new OpenLayers.Feature.Vector(line, null, style); 
    mainfed.addFeatures([lineFeature]); // forming a line through points            
map.addControl(new OpenLayers.Control.DrawFeature(mainfed, OpenLayers.Handler.Path)); 

You can try using rules to select the needed lines, and then use symbolizer: {display:'none' } to hide matching lines, and "normal" symbolizer to show it on again.

and then using javascript timing (http://www.w3schools.com/js/js_timing.asp) that switches Rule objects that turn lines on and off.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.