Missing Leaflet icon with Html2canvas

860 views
Skip to first unread message

Patrick_74

unread,
Aug 25, 2015, 6:02:43 AM8/25/15
to Leaflet

Hello. I am using Html2canvas to capture images from a map viewer and Leaflet to add custom icon marker. The origin of the marker is at the top-left corner so when it is added to the map, the geographic coordinates of the point is in the origin point of the marker:

I have edited .leaflet-marker-icon in leaflet.css :
.leaflet-marker-icon{ position: absolute; left: 0px; top: -20px; }
and  
 setTimeout(function () {      
 html2canvas
($('#map'), {
                    onrendered
: function (canvas) {
                       
var mj2 = canvas.toDataURL('image/png');                      
                       
var image2 = new Image();
                        image2
.src = mj2;
                        document
.getElementsByName("mpp")[0].value = mj2;               
                   
},
                    noCache
: true,
                    allowTaint
: false,
                    logging
: true,
                    useCORS
: true,
                    proxy
: 'html2canvasproxy.php'
                 
})
           
}, 4000);

but this is the final result when i move up the marker icon:


It is possible to move up the container of the icon?

Thanks in advance


Reply all
Reply to author
Forward
0 new messages