• miquelpontes

    (@miquelpontesgmailcom)


    Hello,

    I’m using two kinds of indicators for representing wildlife sightings on a map by using Flexible Map. I use layers (coming from KML files referenced on the main KML file I load into the map) to mark general areas, and spot custom markers to display punctual sightings on given coordinates. Here is a sample of the KML file I load into Flexible Map:

    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="https://www.opengis.net/kml/2.2" xmlns:atom="https://www.w3.org/2005/Atom">
    <Document>
    <Style id="enric"><IconStyle><Icon><href>https://opistobranquis.info/wp-content/uploads/kms/grn-circle-lv.png</href></Icon></IconStyle></Style>
    <NetworkLink id='atlanticocuba'><name><![CDATA[Cuba (Atlántico)]]></name><Link><href>https://opistobranquis.info/wp-content/uploads/mare/atlanticocuba.kml</href></Link></NetworkLink>
    <NetworkLink id='caboverde'><name><![CDATA[Cabo Verde]]></name><Link><href>https://opistobranquis.info/wp-content/uploads/mare/caboverde.kml</href></Link></NetworkLink>
    <NetworkLink id='marmediterraneo'><name><![CDATA[Mar Mediterráneo]]></name><Link><href>https://opistobranquis.info/wp-content/uploads/mare/marmediterraneo.kmz</href></Link></NetworkLink>
    <Placemark><description><![CDATA[<em>Elysia timida</em> (Risso, 1818)<br>Observed at El Medellot (Illes Medes)<br>Seguiment Medes GROC 2011  06-08-2011]]></description><styleUrl>#enric</styleUrl><Point><coordinates>3.221741,42.05146,0</coordinates></Point></Placemark>
    <Placemark><description><![CDATA[<em>Elysia timida</em> (Risso, 1818)<br>Observed at Aiguafreda (Begur)<br>Enric Madrenas OPK-2013  22-03-2013]]></description><styleUrl>#enric</styleUrl><Point><coordinates>3.229251,41.96399,0</coordinates></Point></Placemark>
    <Placemark><description><![CDATA[<em>Elysia timida</em> (Risso, 1818)<br>Observed at Sa Tuna (Begur)<br>Enric Madrenas OPK-2013  24-03-2013]]></description><styleUrl>#enric</styleUrl><Point><coordinates>3.230925,41.960926,0</coordinates></Point></Placemark>
    <Placemark><description><![CDATA[<em>Elysia timida</em> (Risso, 1818)<br>Observed at Depuradora (L'Escala)<br>Enric Madrenas OPK-2013  25-03-2013]]></description><styleUrl>#enric</styleUrl><Point><coordinates>3.16844,42.114986,0</coordinates></Point></Placemark>
    </Document>
    </kml>

    When layers are loaded alone, if you click on any layer an overlay appears showing information for the general area, ok. When markers are loaded alone, when you click on any marker an overlay appears showing information for the sighting, ok. However, as I intend to display both layers and markers together, when I load layers and markers, in those areas where they overlap, only the layers’ overlay is displayed, even when I click on a spot marker (as if the layer has precedence over markers).

    Is there a way to give precedence to the spot markers over the layers? This way, when I click on a spot I would like to see the spot overlay, and when I click a general area, I see the area overlay…

    There is a full sample here: https://opistobranquis.info/en/guia/sacoglossa/elysia-timida/

    Any ideas are welcome. Thank you in advance.

    https://www.ads-software.com/plugins/wp-flexible-map/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author webaware

    (@webaware)

    G’day Miquel,

    I reckon you’ll get the best chance of an answer if you ask that over on the GIS Stack Exchange:

    https://gis.stackexchange.com/

    There are a bunch of questions, many answered, about KML in Google Maps API.

    https://gis.stackexchange.com/search?q=%5Bgoogle-maps-api%5D+kml

    cheers,
    Ross

    Thread Starter miquelpontes

    (@miquelpontesgmailcom)

    Thanks for the quick answer Ross.

    I have checked those forums you recommended and found some illustrative cases, however without proper answers I can use.

    I found a close explanation for the API layering design here (https://stackoverflow.com/questions/15627325/google-maps-polygon-and-marker-z-index) but no solution as the problem stated is not the same. It seems that Google Maps API uses several layers known as MapPanes in a fixed Z order:

    6: floatPane (infowindow)
    5: overlayMouseTarget (mouse events)
    4: floatShadow (infowindow shadow)
    3: overlayImage (marker images)
    2: overlayShadow (marker shadows)
    1: overlayLayer (polygons, polylines, ground overlays, tile layer overlays)
    0: mapPane (lowest pane above the map tiles)

    Then a similar problem is described here: https://stackoverflow.com/questions/25170110/richmarker-not-clickable-when-overlapped-by-polygon that suggests a correction to the offending code and includes a working sample here: https://jsfiddle.net/Hergott/1o15npd6/

    It seems that every API layer must manage the interactive events (mouse hover, click, etc.) on its own, and this is exactly what is wrong in my case: I click on the marker (which is on layer 3, greater than the polygon layer 1) but the “click” event is not managed by the marker layer, but by the polygon layer.

    Apparently this is not a problem of the Maps API but the implemented code using that API. I’m not a PHP programmer so I’m helpless in this.

    Any ideas to focus the problem?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Layers overlapping markers on maps’ is closed to new replies.