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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:39:51+00:00 2026-05-17T16:39:51+00:00

Is there any way to create a sidebar from a KML file when using

  • 0

Is there any way to create a “sidebar” from a KML file when using the Google Maps API?

I’m loading the markers on the map using something like this:

var myMarkerLayer = new google.maps.KmlLayer('http://example.com/WestCoast.kml');

This works great so far, but how can I grab that data and loop through the points?

I would like to avoid using a third party library, if possible- although jQuery is OK.

  • 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-17T16:39:52+00:00Added an answer on May 17, 2026 at 4:39 pm

    KML is just an XML document so you can just process it using jQuery to extract the data you need. You can store the coordinates and placenames in a local array and use this data for any purpose you want eg. you can use it to navigate to a point on the map when a person clicks on a place name on a sidebar.

    Below is an example on how to process the KML file and implement the navigation based on the data in the file..One word of caution I would not do this with large KML files as it doubles the load time (browser has to load the file to process the features)…

    <script type="text/javascript" src= "http://maps.google.com/maps/api/js?sensor=false">
    </script>
    <script src="../js/jquery-1.4.2.min.js">
    </script>
    <script>
        var map;
        var nav = [];
        $(document).ready(function(){
            //initialise a map
            init();
    
            $.get("kml.xml", function(data){
    
                html = "";
    
                //loop through placemarks tags
                $(data).find("Placemark").each(function(index, value){
                    //get coordinates and place name
                    coords = $(this).find("coordinates").text();
                    place = $(this).find("name").text();
                    //store as JSON
                    c = coords.split(",")
                    nav.push({
                        "place": place,
                        "lat": c[0],
                        "lng": c[1]
                    })
                    //output as a navigation
                    html += "<li>" + place + "</li>";
                })
                //output as a navigation
                $(".navigation").append(html);
    
                //bind clicks on your navigation to scroll to a placemark
    
                $(".navigation li").bind("click", function(){
    
                    panToPoint = new google.maps.LatLng(nav[$(this).index()].lng, nav[$(this).index()].lat)
    
                    map.panTo(panToPoint);
                })
    
            });
    
            function init(){
    
    
                var latlng = new google.maps.LatLng(-43.552965, 172.47315);
                var myOptions = {
                    zoom: 10,
                    center: latlng,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                };
                map = new google.maps.Map(document.getElementById("map"), myOptions);
    
    
    
            }
    
    
        })
    </script>
    <html>
        <body>
            <div id="map" style="width:600px;height: 600px;">
            </div>
            <ul class="navigation">
            </ul>
        </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any easy way to create an acronym from a string? First_name Middle_name
Is there any feasible way of using generics to create a Math library that
Is there any way to create a virtual drive in (My) Computer and manipulate
Is there any way to create the query parameters for doing a GET request
Is there any way to create C# 3.0 anonymous object via Reflection at runtime
Is there any way to manually create fold points in code in Eclipse? I
Is there any easy way to create a class that uses IFormatProvider that writes
Is there any way in JavaScript to create a "weak reference" to another object?
Is there any way that I can programmatically create (and I guess access) hidden
If I create an application on my Mac, is there any way I can

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.