Jump to content
Fórum Script Brasil
  • 0

Xml de Imagens para google Maps não aparece no Internet Explorer


chsestrem

Question

Bom dia amigos do Forum,

Estou usando um script para personalizar os icones do Google Maps que são carregadas a partir de um arquivo XML de uma pasta local.

O script funciona normalmente no Firefox, mas no Internet Explorer 8 eles não aparecem.

alguém pode me ajudar como contornar este problema? Pois precisava rodar este script dentro do Internet Explorer.

Segue abaixo o HTML com o script e o arquivo XML onde a tag Icon tem o endereço local das Imagens.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
    <title>Irving City Parks</title>
    &lt;script src="http://maps.google.com/maps?file=api&v=3 type="text/javascript"></script>
    &lt;script type="text/javascript">
    //<![CDATA[
       function load(){
      var map = new GMap(document.getElementById("map"));
    var point = new GPoint(-26.907751, -48.655928);
      map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
      map.centerAndZoom(point, 5);
    var baseIcon = new GIcon();
      baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
      baseIcon.iconSize = new GSize(10,10);
      baseIcon.shadowSize = new GSize(9,2);
      baseIcon.iconAnchor = new GPoint(9,2);
      baseIcon.infoWindowAnchor = new GPoint(9, 2);
      baseIcon.infoShadowAnchor = new GPoint(18, 25);
    function createMarker(point, iconname) {
        var icon = new GIcon(baseIcon);
        icon.image = iconname.getAttribute("image");
        var marker = new GMarker(point, icon);
        return marker;
      }

            
    var request = GXmlHttp.create();
    request.open("GET", "file:///C:/Documents%20and%20Settings/Usuario/Desktop/htmls/projetofinal/parks.xml", false);
    request.onreadystatechange = function() {
      if (request.readyState == 4) {
                          
            var xmlDoc = request.responseXML;
                          
           var points = xmlDoc.documentElement.getElementsByTagName("point");
        var icons = xmlDoc.documentElement.getElementsByTagName("icon");

            for (var i = 0; i < points.length; i++) {
              var point = new GPoint(parseFloat(points[i].getAttribute("lng")),
                             parseFloat(points[i].getAttribute("lat")));
     
    var marker = createMarker(point, icons[i]);
    map.addOverlay(marker);
            }
      }
}
request.send(null);

}
    //]]>
    </script>
  </head>
  <body onload= "load()" >
    <div id="map"  style="width: 800px; height:500px;"></div>
   
  </body>
</html>
Estrutura do XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<parks>
    <park>
       <point lat="-26.9177026" lng="-48.6907045"/> 
       <icon image="file:///C:/Icones/call_blue.png" class="local"/>
    </park>
    <park>
       <point lat="-26.9187415" lng="-48.6904606"/> 
       <icon image="file:///C:/Icones/call_green.png" class="local"/>
    </park>
     <park>
       <point lat="-26.9165416" lng="-48.6933915"/> 
       <icon image="file:///C:/Icones/call_orange.png" class="local"/>
    </park>
</parks>

Se alguém puder ajudar, desde já agradeço.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152k
    • Total Posts
      651.5k
×
×
  • Create New...