leaflet with mapkitmutant and apple mapkit domToImage generates an all-grey image
This works as expected with openstreet, google maps and bing maps. The onscreen display is okay, just the domToImage output is all grey.
To add the map to leaflet:
} else if ( ml.name === 'Apple Maps') {
if ( this.appleMapsApiKey !== 'n/a' ) {
ml.layer = (L as any).mapkitMutant ({
type: 'hybrid', // valid 'type' are 'standard', 'satellite' and 'hybrid'
authorizationCallback: function(done) {
console.log ( 'Apple Maps Authorization Callback with ' + outerThis.appleMapsApiKey );
done ( outerThis.appleMapsApiKey );
},
language: 'en',
debugRectangle: false,
attribution: '© ' + ml.name
});
}
To create the .png from the map:
const node = document.getElementById('map');
if ( node != null ) {
const container = this.map.getContainer();
const options = {
width: container.clientWidth,
height: container.clientHeight
};
try {
console.log ( 'swlGetMapViewDomToImageInt dimensions are: ' + JSON.stringify ( options ) );
const dataUrl = await domToImage.toPng(node, options);
if ( dataUrl != null ) {
this.swlDataUrl = dataUrl;
console.log ( 'swlGetMapViewDomToImageInt url is' + dataUrl );
}
return this.swlDataUrl;
} catch (error) {
console.error('ERROR: swlGetMapViewDomToImageInt error ' + error);
}
} else {
console.error ( 'ERROR: swlGetMapViewDomToImageInt - no document node with id "map"' );
}