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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:35:04+00:00 2026-05-20T15:35:04+00:00

I’m trying to extract the name and satelite coordinations from a XML file and

  • 0

I’m trying to extract the name and satelite coordinations from a XML file and then plug them into a Google map overview with markers but I’m having difficulties.

I already have the php code where I extract my elements I need but to go from there to actually plugging them into google maps is where I run my head against the wall.

I have this code I’ve found and try out:

<script src="http://maps.google.com/maps?file=api&v=2&key=my_google_api_key" type="text/javascript"></script>
 <script type="text/javascript">
 //<![CDATA[
 var map = null;
 var geocoder = null;
 function load() {
 if (GBrowserIsCompatible()) {
 map = new GMap2(document.getElementById("map"));
 map.addControl(new GSmallMapControl());

geocoder = new GClientGeocoder();

// my XML file
GDownloadUrl("maste.xml", function(data) {
var xml = GXml.parse(data);
//MasteIBrug is the tag around each child
var markers = xml.documentElement.getElementsByTagName("MasteIBrug");
for (var i = 0; i < markers.length; i++) {
//Positionsvejnavn is my first attribute in the XML file
 var name = markers[i].getAttribute("Positionsvejnavn");
//Geografisk_placering is my second attribute in the XML file
 var coordination  = markers[i].getAttribute("Geografisk_placering");
 showCoor(coordination,name);
}
});

}
}

function showCoor(coordination, name) {
if (geocoder) {
geocoder.getLatLng(
name+","+coordination,
function(point) {
if (!point) {
 alert(coordination + " not found");
} else {
map.setCenter(point, 13);
var marker = createMarker(point, name, coordination);
map.addOverlay(marker);
}
});

}

}

function createMarker(point, name, coordination) {
var marker = new GMarker(point);
var html = "<b>" + name + "</b> <br/>" + coordination;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});

return marker;
}

//]]>

</script>

</head>

<body onload="load()" onunload="GUnload()">
<div>
<div id="map" style="width: 1000px; height: 600px"></div>
</div>
</body>

This is my first time playing around with the Google maps API so I might have something wrong or using a wrong code to create but I can’t really seem to get any further.

Any help or advice would be very much appreciated.

  • 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-20T15:35:05+00:00Added an answer on May 20, 2026 at 3:35 pm

    If you are willing to use a library for this, jquery-ui-map can help you a lot. It supports creating Google Maps markers from JSON, HTML, etc. I’ve just worked with it on a project and it helped me a lot.

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

Sidebar

Related Questions

I'm trying to extract the domain name from a string in C#. You don't
I am trying to extract the field 'name' or 'named-expr' from the following object:
I'm trying to extract a page name and query string from a URL which
I'm trying to extract a string from a text file using 2 delimiters. One
I am trying to extract the content from a gpx file. The problem is
Im trying to extract a line from wget's result but having trouble with it.
I am trying to extract a table of values from an excel (2003) spreadsheet
I'm trying to extract all matches from a EBML definition, which is something like
I'm trying to parse a html page and extract 2 values from a table
I am trying to write a Java class to extract a large zip file

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.