Search code examples
google-mapsgoogle-maps-api-3google-maps-markersinfowindowgeoxml3

Google maps api v3: infowindow contents are misplaced


I am using geoxml3 to parse a kml file of points. On click of the marker an info window opens with some description. The problem is that the information is being displayed misplaced and also two links are added in the info window which I want to remove.

Any ideas how I can remove the links and also put the information placed correctly?

This is a screen shot of the info window:

enter code here

The following is the code I am using:

function initialize() { 
    directionsDisplay = new google.maps.DirectionsRenderer();

    var mapOptions = {
        center: new google.maps.LatLng(35.898737028438, 14.5133403246687),
        zoom: 17,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
    directionsDisplay.setMap(map);

    elevator = new google.maps.ElevationService();

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

    google.maps.event.addListener(map, 'click', getElevation);

}

function displayKml() {
    initialize();
    parser = new geoXML3.parser({
        map: map,
        processStyles: true,
        createMarker: addMyMarker,
        createOverlay: addMyOverlay
    });          
    parser.parse("Uploads/" + document.getElementById('<%= text2.ClientID %>').value); 
}

function addMyMarker(placemark) {
   parser.createMarker(placemark);
}

function addMyOverlay(groundOverlay) {
   parser.createOverlay(groundOverlay);
}

The kml file structure is as follows:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name>route</name>
    <Placemark>
      <name>210</name>
      <description>St james cavalier,Exhibitions centre</description>
      <Point>
        <coordinates>14.5107742,35.8955498</coordinates>
      </Point>
    </Placemark>
  </Document>
</kml>

Solution

  • Your sample KML works fine with my test pages:

    polys branch: http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/SO_IT_info_kmlPt.xml

    kmz branch: http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmztest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/SO_IT_info_kmlPt.xml

    Must be your css (which you haven't provided) or something else in your environment.