title: OpenLayers 3 get WKT Polygon string
body: <p>I have an openlayers 3 map where I can draw Polygon.</p>
  
  <p>I would have returned the WKT String that rapresent the drawed polygon.</p>
  
  <p>How Can I do it?</p>
  
  <p>JSFiddle Code <a href="http://jsfiddle.net/michelejs/3zawt33b/7/" rel="nofollow">http://jsfiddle.net/michelejs/3zawt33b/7/</a></p>
  
  <p>Here my map:</p>
  
  <pre><code>map = new ol.Map({
              target: 'map',
              layers: [raster,vector],
              view: new ol.View({
                center: ol.proj.fromLonLat([11.249367, 43.774298]),
                zoom: 15
              })
          });
  </code></pre>
  
  <p>Here the intaractions that help me to draw the polygon:</p>
  
  <pre><code>function addInteraction() {
  
          var ct = 0;
          draw = new ol.interaction.Draw({
              source: source,
              type: 'Polygon',
              geometryFunction: function (c, g) {
                  if (goog.isDef(g)) {
                      g.setCoordinates(c);
                  } else {
                      g = new ol.geom.Polygon(c);
                  }
                  if (c[0].length &gt; ct) {
                      console.log('click coord : ' + c[0][c[0].length - 1]);
                      var coord = c[0][c[0].length - 1];
                      $('div#coordinate').html( $('div#coordinate').html() + "&lt;p&gt;" + ( Number(coord[0]).toFixed(2) ) + " - " + ( Number(coord[1]).toFixed(2) ) + "&lt;/p&gt;" );
                  coordinates.push(coord);
                      ct = c[0].length;
                  } else {
                      console.log('move coord : ' + c[0][c[0].length - 1]);
  
                  }
  
                  return g;
              }
          });
          draw.on('drawend',  function(e) {
              isin = e;
              checkIfIn();
              lastFeature = e.feature;
  
            //write WKT Polygon Code in div#getAsWK
          })
  
          draw.on('drawstart', function (e) {
              source.clear();
          });
  
  
          map.addInteraction(draw);
  
      }
     map.addInteraction(draw);
  </code></pre>