[GIS] OpenLayers 3: Need help in print tool

javascriptopenlayersprinting

I am developing a print map function in an OpenLayers 3 application it includes some functionality such as if its polygon then area of that polygon will be display OR if its line length will be display.

At present only line or polygon is displaying but its popup like feature length or feature area its not displaying

Please check attached screenshots.

After clicking on print button only map get printed as follows

But I want print of this with area only that feature is displaying

Best Answer

I have solved my overlays printing problem. I getting image of overlays numbers within map.

I have attached screenshot. Different geometries with different measurements

The code is as follows.

 var measure_source =  new ol.source.Vector({
       format: new ol.format.GeoJSON()
    })

var getText = function(feature) {
var text=measure_count[measure_dynamic_count];
measure_dynamic_count++;
 return text;
 };


var createTextStyle = function(feature) 
    {
     return new ol.style.Text({
      textAlign: 'center',
      font: 'Arial',
      fill: new ol.style.Fill({color: '#aa3300'}),
       stroke: new ol.style.Stroke({color: '#ffffff', width: 5}),
       //size:16px,
      text: getText(feature)

 });
 };


 function StyleFunction(feature) {
    return new ol.style.Style({
      stroke: new ol.style.Stroke({
        color: '#ffcc33',
        width: 3
      }),
      fill: new ol.style.Fill({
        color: 'rgba(0, 0, 255, 0.1)'
      }),
      text: createTextStyle(feature)
    });
  } 


var measure_vector = new ol.layer.Vector({
    source: measure_source,
    style: StyleFunction

 });