title: Openlayer-3 : Draw a polyline with GPS coordinates
body: <p>For my company, I must develop a function who draw a path with GPS coordinates. Indeed, my company use GPS to track runners during multiple race.</p>
  
  <p>So, i tried many differents way to draw my polyline, my last version is:</p>
  
  <pre><code>                _public.drawPolyline = function(pool, id, points, color, opacity, weight) {
              try {
                  var l = points.length;
                  var latlngs = [];
                  var j=1;
                  for (var i = 0; i &lt; l; i++) {
                      latlngs[i] = new ol.geom.Point(ol.proj.transform([points[i].longitude, points[i].latitude], 'EPSG:4326', 'EPSG:3857'));
                  };
  
                  var style = new ol.style.Style({
                      stroke: new ol.style.Stroke({
                          color: color,
                          width: weight,
                          opacity: opacity,
                          radius: 6
                      })
                  });
                  //Check if pool exists, else create it
                  if (!_private._polyline.containsKey(pool)) {
                      _private._polyline.put(pool, new jQuery.Hashtable())
                  }
                  var currentPool = _private._polyline.get(pool);
                  //Check if line exists, if yes, update path
                  if (currentPool.containsKey(id)) {
                      var vectorLayer = currentPool.get(id).layer;
                      vectorLayer.setVisible(true);
                  } else {              
                      var linefeature = new ol.source.Vector('Path', {styleMap: style});
                      var comp = new ol.geom.LineString(latlngs);
                      var featurecomp = new ol.Feature({
                          name: "Comp",
                          geometry: comp
                      });
                      var vector = new ol.layer.Vector({
                          title: pool,
                          visible: true,
                          source: linefeature
                      });
                      linefeature.addFeatures(featurecomp);
                      currentPool.put(id, linefeature);
                      currentPool.put(id, { "type": "Path", "url": id, "layer": vector });
                      var vectorLayer = currentPool.get(id).layer;
                      vectorLayer.setVisible(true);
                  }
              } catch (e) {
                  console.log(e.message);
              }
          }
  </code></pre>
  
  <p>So, I wanted to draw a Polyline with a function with differents parameters:
    - pool: an Hashtable storing my polyline
    - id: not important
    - points: Contain an array of objects (
  <code>{"location":[{"id":1854703,"latitude":42.831,"longitude":0.30087,"altitude":0,"hpl":0,"vpl":0,"speed":4,"direction":258,"date":"2012-08-25 03:43:23","device_id":786,"datereceived":"2012-08-25 03:43:23"}</code>).</p>
  
  <p>According to my test server, I have no error in my logs, but, I still don't have a polyline drawed.</p>
  
  <p>If someone could help me with this, it would be great.</p>
  
  <p>Regards, Brz.</p>