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

  • SEARCH
  • Home
  • 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 7957417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:14:48+00:00 2026-06-04T04:14:48+00:00

I have a google map component in my application that allows the user to

  • 0

I have a google map component in my application that allows the user to draw polygons, lines, and marker. Now I want to implement a button that allows the user to export a kml file of the stuff that he/she draw in the map.

Any suggestion for the best approach to do so.

Your comments and contribution is highly 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-06-04T04:14:49+00:00Added an answer on June 4, 2026 at 4:14 am

    I’ll summarize my idea as storing coordinates as the user draws, then when the “Output KML” button is clicked, format the saved coordinate data and place it in a textarea to be copied (unless there’s a way to prompt as a download?).

    Here’s how I save data when the user completes a drawing element:

    http://jsfiddle.net/8bwG2/

    (I don’t know a good way of detecting edits.)

    First, add event listeners for each drawing type (line, polygon, marker), to fire when it is complete. You need a separate event listener for each type. Here’s one for Polylines, and each listener will return the type of drawing element that was just completed.

        google.maps.event.addDomListener(drawingManager, 'polylinecomplete', function(line) {
            path = line.getPath();
            document.getElementById("action").value += "#polyline\n";
            for(var i = 0; i < path.length; i++) {
              document.getElementById("action").value += path.getAt(i) + "\n";
            }
        });
    

    I am placing the coordinates straight into a shared textarea but they should instead go into an array of arrays variable, with one variable for polygons, one for polylines and one for markers.

    When reading from these internal variables, convert the Google Maps LatLngs to KML format long,lat,altitude. You will have to get creative with each element’s name and description.

    Finally, when the KML is requested, loop through the markers, line, and polygon variable to generate KML formatted elements, such as Point-coordinates, LineString, and Polygon-outerBoundaryIs

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

Sidebar

Related Questions

Right now I have google map code that will set a single marker on
I have a google map that used to work here: http://www.comehike.com/outdoors/birds/birds.php Now I see
I have a google map that has a marker which is dragged. When I
I have a google map that takes and put coordinates from input fields .
I have a Google Map on the webpage with markers on it that has
i have google Maps and when the user touch any point in the map
I have an app that saves google map markers, I basically save the lat
I have an application based on google map, in which I need to use
I have google map infowindow,i want to set border radius to infowindow. so how
I want to have google map on my page and I hope it 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.