nicowesse / geoxml3

Automatically exported from code.google.com/p/geoxml3
0 stars 0 forks source link

KMZ branch createPlacemark does not always return a google.maps.Marker #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The KMZ branch createPlacemark breaks expected/documented behavior of a 
returned google.maps.Marker when multiple markers are created. 

Even iterating the geoXmlDoc.placemarks array upon "afterParse" callback, also 
will not provide created google.maps.Marker.

There is no dependable way to access the actual google.maps.Marker (for adding 
additional event listeners on the marker) on the KMZ branch.

Original issue reported on code.google.com by edan0...@gmail.com on 27 Jul 2012 at 3:40

GoogleCodeExporter commented 9 years ago
correction - referring to the createMarker parser method

Original comment by edan0...@gmail.com on 27 Jul 2012 at 3:53

GoogleCodeExporter commented 9 years ago
Can you provide an example of the problem you are seeing?

Here is my test case that shows it working with the polys branch:
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_stylemap_marker.html?f
ilename=http://www.geocodezip.com/geoxml3_test/rollover_kml.xml

This version uses the kmz branch:
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_stylemap_marker.html?f
ilename=http://www.geocodezip.com/geoxml3_test/rollover_kml.xml

Original comment by geocodezip on 27 Jul 2012 at 6:28

GoogleCodeExporter commented 9 years ago
The above example is indeed excellent for demonstrating reproduction of the 
issue in the kmz branch. The polys branch works as expected, however in the kmz 
branch it is broken, as marker creation appears to be queued and async (not 
ready with marker objects to add event listeners to upon the 'afterParse' 
callback).

Original comment by edan0...@gmail.com on 27 Jul 2012 at 7:03

GoogleCodeExporter commented 9 years ago
Reproducible for me in IE9, but not Chrome 20.0.1132.57 (it is a 
race-condition, so really cannot depend on the afterParse to have all 
google.Maps.Marker objects).

Returning from createMarker below mid-way through the method on some scenarios 
means that calling this method directly cannot reliably return the object:

  var createMarker = function (placemark, doc) {
    // create a Marker to the map from a placemark KML object
    var icon = placemark.style.icon;

    if ( !icon.marker && icon.img ) {
      // yay, single point of failure is holding up multiple markers...
      icon.markerBacklog = icon.markerBacklog || [];
      icon.markerBacklog.push([placemark, doc]);
      return; //<----
    }

Original comment by edan0...@gmail.com on 27 Jul 2012 at 7:22

GoogleCodeExporter commented 9 years ago

Original comment by geocodezip on 27 Jul 2012 at 8:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Although the first doesn't seem to work for me in Firefox or the first time in 
IE.  Not sure if that is the change to geoxml3 or the page.

Original comment by geocodezip on 27 Oct 2012 at 11:04

GoogleCodeExporter commented 9 years ago
Seems to be a problem with the StyleMap elements.

Original comment by geocodezip on 28 Oct 2012 at 5:56

GoogleCodeExporter commented 9 years ago
Comment 6 by project member geocodezip, Yesterday (19 hours ago)
I have a test version of a fix for this (it won't stay here forever):
http://www.geocodezip.com/geoxml3_test/geoxml3.js

Feedback appreciated.

Test pages
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_stylemap_marker_TEST_l
ocal.html

http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_stylemap_marker_TEST_l
ocal.html?lat=-42.343313&lng=171.224489&zoom=11&type=m&filename=http://www.geoco
dezip.com/geoxml3_test/nzhistory_net_nzmap_locations_kml.xml?

Original comment by geocodezip on 28 Oct 2012 at 5:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It seems to have to do with the <scale> tag rather than the <StyleMap>

http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_stylemap_marker_TEST_l
ocal.html?filename=http://www.geocodezip.com/geoxml3_test/rollover_kml_noscale.x
ml

Original comment by geocodezip on 28 Oct 2012 at 7:26

GoogleCodeExporter commented 9 years ago
Issue 104 has been merged into this issue.

Original comment by geocodezip on 8 Jan 2015 at 11:17