Advertisement
Guest User

Untitled

a guest
Dec 7th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.ajax({
  2.   url: "/ajax/getPositions",
  3.   dataType: 'json',
  4.   success: function(result) {
  5.  
  6.     for (var reportID in result) {
  7.         //Store the object at hand.
  8.         var data = result[reportID];
  9.        
  10.  
  11.         //Get all the positions and print them onto the vesselpoisition layer.
  12.         var positions = data.positions;
  13.  
  14.         var listOfPoints = new Array();
  15.         for (var index in positions) {
  16.             var positionData = positions[index];
  17.             var point= wkt.read(positionData.st_astext);
  18.  
  19.             listOfPoints.push(point.geometry);
  20.         }
  21.        
  22.         var pointmap = new OpenLayers.Geometry.LineString(listOfPoints);
  23.  
  24.         vesselPosition.addFeatures(new OpenLayers.Feature.Vector(pointmap));
  25.  
  26.     };
  27.   }
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement