Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7693057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:59:44+00:00 2026-05-31T20:59:44+00:00

I have a map that reads an XML file; it’s all very simple and

  • 0

I have a map that reads an XML file; it’s all very simple and copied from here:
http://geochalkboard.wordpress.com/2009/03/30/reading-xml-files-with-the-google-maps-api/

My version is here:
http://www.cloudfund.me/maps/mashup.html and the data file it’s reading is here:
converted.xml in the same directory.

I don’t get any points at all, when I run it. I put some console logging in to see if I could see anything, but as far as that’s concerned, it just runs through without a hitch. The file loads ok, and I can watch the code loop through all the rows (208 in this example) without any problems.

The only warning I’m getting is the ‘Resource interpreted as other passed as undefined’ one; having had a look at some of the other threads, I can’t see anything that helps – no empty src links, etc. As far as I can tell, this shouldn’t stop it marking the points, either.

Here’s the real kicker – in trying to trace this error, I set up an exact replica of the original code on my own server, and got an error about null fields, which I added some conditional code to to sort; this version works on my server. This is austin.html in the same directory (sorry, can’t do more than two links in my first posts!)

So – my code is this:

<title>Test </title>


<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=AIzaSyDgybFoyn3i5j_6d7ul7p2dPNQ5b1xOWnk"
        type="text/javascript">console.log("Loaded Maps API");</script>

            <script src="http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js">console.log("MarkerManager");</script>


<script type="text/javascript">
console.log("Into Main Script");
function initialize() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(51.39906378, -2.449545605), 13);
    map.setUIToDefault();
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.addMapType(G_PHYSICAL_MAP);
    map.setMapType(G_PHYSICAL_MAP);
    console.log("Reached end of map initialising");
    addMarkersFromXML();
    console.log("MarkersfromXML")
  }
}

function addMarkersFromXML(){
   var batch = [];
   mgr = new MarkerManager(map); 

   var request = GXmlHttp.create();
   console.log("About to open converted.xml")
   request.open('GET', 'converted.xml', true);
   console.log("Opened Converted.xml")
   request.onreadystatechange = function() {
  if (request.readyState == 4 && request.status == 200) 
{
    var xmlDoc = request.responseXML;
    var xmlrows = xmlDoc.documentElement.getElementsByTagName("row");

    for (var i = 0; i < xmlrows.length; i++) {
        var xmlrow = xmlrows[i];
        console.log("Running through row number",i)
        var xmlcellLongitude = xmlrow.getElementsByTagName("longitude")[0];
        console.log(xmlcellLongitude);
        var xmlcellLatitude = xmlrow.getElementsByTagName("latitude")[0];
        var point = new GLatLng(parseFloat(xmlcellLatitude.firstChild.data),parseFloat(xmlcellLongitude.firstChild.data));

        //get the PAO
        var xmlcellAssetName = xmlrow.getElementsByTagName("pao")[0];
        console.log(xmlcellAssetName);
        var celltextAssetName = xmlcellAssetName.firstChild.data;

        //get the area
        var xmlcellArea = xmlrow.getElementsByTagName("area")[0];
        console.log(xmlcellArea);
        var celltextArea = xmlcellArea.firstChild.data;

        //get the land type
        var xmlcellLandType = xmlrow.getElementsByTagName("landtype")[0];
        console.log(xmlcellLandType);
        var celltextLandType = xmlcellLandType.firstChild.data;

        //get the Planning Permissions
        var xmlcellPlanning = xmlrow.getElementsByTagName("planning")[0];
        console.log(xmlcellPlanning);
        var celltextPlanning = xmlcellPlanning.firstChild.data;

        var htmlString = "Asset Name: " + celltextAssetName + "<br>" + "Size: " + celltextArea + "<br>" + "Land Type: " + celltextLandType + "<br>" + "Planning Permissions: " + celltextPlanning;
        //var htmlString = 'yes'
        var marker = createMarker(point,htmlString);
        batch.push(marker);

    }

    mgr.addMarkers(batch,50);
    mgr.refresh();

  }
    }
request.send(null);

  }

 function createMarker(point,html) {
       var marker = new GMarker(point);
       GEvent.addListener(marker, "click", function() {
         marker.openInfoWindowHtml(html);
       });
       return marker;
 }
  </script>
 </head>
  <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 1100px; height: 700px"></div>
  </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:59:46+00:00Added an answer on May 31, 2026 at 8:59 pm

    Think you have a typo. In your code, you’re pulling an incomplete URL for the API:

    <script src="//maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=AIzaSyDgybFoyn3i5j_6d7ul7p2dPNQ5b1xOWnk"

    That errant // seems to be throwing the code off.

    Though, to be perfectly honest, the originating example (and austin.html) doesn’t exactly work as one would imagine it should. The points do get rendered, but no effective clustering takes place when you zoom out. Suspect that the 2.0 branch of the API got moved to a newer version and created a bit of an incompatibility.

    Recommend that you rewrite this in API version 3. There is a cluster manager that works for it quite well.

    See http://tools.voanews2.com/nuclear_reactors/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script that reads an XML file and modifies it with
I have some problems making a google map that loads XML file that have
I have an XML File with Elements that look like the following: <level> <name>Name
I have a piece of java code which reads strings from a file and
Ok, I have a question that I know is very opinionated (based on all
I'm writing a program that reads from a list of files. The each file
Okay, I have a function which reads a xml file and creates controls using
I have an xml file that contains a structure.. In this structure, I have
I am working on creating a Java class to map an XML file that
I have a map that represents a DB object. I want to get 'well

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.