getImageData() returns all 0 values in data for an OpenLayers3 layer set as Transpare

المشرف العام

Administrator
طاقم الإدارة
Please pardon my ignorance if this seems trivial, but I am very new to using openlayers3 for map rendering.

I am rendering a Tiled layer over the world map layer for the KML data from CGI mapserver 7.0.0. The KML layer tiles come up fine on display but when I click on the layer and call the forEachLayerAtPixel() [ from the onMouseClick()] it seems not to fire the callback associated with it as the data element in getImageData() returns all zeroes for R G B Aplha values.

When I make this layer as transparent=false, the data array gives me non zero values and the layer information comes up.

I am using Safari Browser (8) on Mac OSX for viewing the map and OL layers.

Here is how I declare the KML layer:

$rootScope.kmlLayerSource = new ol.source.TileWMS({ url: someURL, params: {'LAYERS': 'kmltiles', format:'image/png', TRANSPARENT:true}, crossOrigin:'' }); $rootScope.kmlLayer = new ol.layer.Tile({ source: $rootScope.kmlLayerSource }); $rootScope.map.addLayer($rootScope.kmlLayer); But when I change the above to layer def to TRANSPARENT: false, the data array in the getImageData() call returns positive integers.

Am I missing any settings here while creating my layer?



أكثر...
 
أعلى