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 4625732
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:18:54+00:00 2026-05-22T03:18:54+00:00

I am using the following code ,here I am showing addresses of properties.xml with

  • 0

I am using the following code ,here I am showing addresses of
properties.xml with markers on google map. It gives me no error but also displaying nothing on google map.

Can anybody tell me where is the problem in my code?

properties.xml file:

<properties>
<property>
<type>apartment</type>
<address>538 Little Lonsdale Street,Melbourne,VIC </address>
</property>
<property>
<type>apartment</type>
<address>196 Little Lonsdale Street,Melbourne,VIC</address>
</property>
<property>
<type>apartment</type>
<address>5/5 Close Ave,Dandenong,VIC </address>
</property>
</properties>

html file:

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head> 
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>property</title> 
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAB1CHU9LrppxpqwUwaxkvTBRIez7zTAJDrX7CdEV86wzEyVzTHBQKDxL9qiopaHZkOJ8F2t0RQW9W8A"
      type="text/javascript"></script>
<script type="text/javascript" src="map.js"></script> 
</head>

<body onload="load()" onunload="GUnload()">

<div id="map" style="width: 500px; height: 400px"></div>

</body>
</html>

map.js file:

    var map;
    var geocoder;
    var xml;
    var property;
    var address;

   function load()
   {

      map = new GMap2(document.getElementById("map"));        
     map.setCenter(new GLatLng(-24.994167,134.866944), 4);

      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());
      geocoder = new GClientGeocoder();

      GDownloadUrl("../../data/properties.xml", function(data) {
          xml = GXml.parse(data);
          property = xml.documentElement.getElementsByTagName("property");
          for (var i = 0; i < property.length; i++) {
            address = property[i].getElementsByTagName("address");
            address = address.firstChild.nodeValue;

           geocoder.getLocations(address, addToMap);}
        });   
   }


   function addToMap(response)
   {

      place = response.Placemark[0];

      point = new GLatLng(place.Point.coordinates[1],
                          place.Point.coordinates[0]);

      marker = new GMarker(point);
      map.addOverlay(marker);


   }
  • 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-22T03:18:54+00:00Added an answer on May 22, 2026 at 3:18 am

    I tried your code and got the maps displaying on first load but there was a JS error. It was this particular line:

    address = address.firstChild.nodeValue;
    

    Should be this to get the text inside <address>:

    address = address[0].childNodes[0].nodeValue;
    

    Here is a portion of the map when it worked:

    Here is a portion of the map that I saw when it worked

    Just to mention that I couldn’t see any markers at first so I replaced:

    map.setCenter(new GLatLng(37.997022, -122.6), 11);
    

    with:

    map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
    

    Not sure if that’s what you’re expecting but that’s how it turned out.

    *UPDATE*
    To create a marker you can use this function

    function createMarker(point, address)
    {
       var marker = new GMarker(point);
       GEvent.addListener(marker, "click", function() {
       map.openInfoWindowHtml(point, address);
       });
       return marker;
    }
    

    Apply the createMarker to map.addOverlay:

    map.addOverlay(createMarker(point, response.name));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the following code-snippet I'm using in my Google Spreadsheet onEdit() function: else
I am using the following code to display splash screen, but it is showing
Following the the code linked from here: Trap click event on dock icon using
I am using following code for showing a MessageBox with ok and cancel button.
I'm using following code to add rounded corners to my UIImage, but the problem
Hi I am using the following code from this site: http://java.sun.com/developer/technicalArticles/ALT/Reflection/ But when I
friends, right now i am showing list of map overlays on google map using
I am currently showing softkeyboard using the following code InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
Using following code I try to get updated list of checkbuttons' corresponding text values,
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>

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.