1
votes

I'm am trying to use a maps engine layer in google maps api v3 and am running into issues with events and opacity (accepted enhancement) for raster layers.

The issue is that raster type data does not allow any events as far as I can tell.

var layer2 = new google.maps.visualization.MapsEngineLayer({
    layerId: '15658084116283052074-13711557424617485464',
    map: map,
    clickable: true,
    suppressInfoWindows: false
});

google.maps.event.addListener(layer2, 'click', function (event) {
    alert('click');
});

Demo (jsbin) with vector maps engine layer and raster layer here. Is there something I'm missing or is it simply not implemented?

Documentation:Maps Engine Layers

Edit: I would like to get the pixel value of the raster.

1
Never used that, but the doc says click is fired when a feature in the layer is clicked. As I understand it, it's not when the layer itself is clicked (?). - MrUpsidown
what is the 'feature' in a raster or image layer? the tile, pixel? - jpoehnelt

1 Answers

0
votes

The click event in a DMEL is fired when a feature is clicked. In Maps Engine, a feature is the same as defined in GeoJSON. That is: a single geometry, or table row in your data set.

As raster layers are not attached to a tabular data source, they don't contain individual features like points and shapes.

Raster layers are much like the base layer in the map however, so you can grab a click event at the map level. e.g.

google.maps.event.addListener(map, 'click', function (event) {
  alert(event.latLng);
});

I'm not sure what your intention is beyond just a lat/lng pair though. If you wish to interrogate pixel data you may be better off putting the raw data into a table.