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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:43:21+00:00 2026-06-05T06:43:21+00:00

I want to enable drawing on Google Maps like ( see this example )

  • 0

I want to enable drawing on Google Maps like (see this example)
When user finish with drawings he will click on save button to save his drawings in Database or KML file, anything 🙂 .. I do not know how to the save part? Could anyone help me

  • 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-05T06:43:24+00:00Added an answer on June 5, 2026 at 6:43 am

    Here, http://jsfiddle.net/X66L4/1/ try drawing some circles, click on SAVE, then edit the circles by switching to the hand cursor and SAVE again to see the changes.

    I show an example to save circles’ data, the main idea is to keep a global array for each drawing type (line, polygon, marker, circle), and use a listener on the drawing manager to detect each type being drawn (complete).

      var circles = [];
    
      google.maps.event.addDomListener(drawingManager, 'circlecomplete', 
        function(circle) {
          circles.push(circle);
        });
    

    The reason to save the entire reference to the drawn object is to continue tracking changes. So you will need an array and listener for each type of drawing.

    Then, when you want to save the data (you may wish to do so at every edit), iterate through the arrays and extract the minimum information to rebuild it (center, radius, path, latLng, and so on.)

    <!DOCTYPE html>
    <html>
      <head>
        <style type="text/css">
          html, body, #map_canvas { margin: 0; padding: 0; height: 100% }
        </style>
        <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=drawing"></script>
        <script type="text/javascript">
    var myOptions = {
      center: new google.maps.LatLng(-25,177.5),
      zoom: 3,
      mapTypeId: google.maps.MapTypeId.SATELLITE
    };
    
    
        var map;
    
        function initialize() {
          map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
    var drawingManager = new google.maps.drawing.DrawingManager({
          drawingMode: google.maps.drawing.OverlayType.CIRCLE,
          drawingControl: true,
          drawingControlOptions: {
            position: google.maps.ControlPosition.TOP_CENTER,
            drawingModes: [google.maps.drawing.OverlayType.CIRCLE]
          },
          circleOptions: {
            editable: true
          }
        });
    
          drawingManager.setMap(map);
          var circles = [];
    
          google.maps.event.addDomListener(drawingManager, 'circlecomplete', function(circle) {
            circles.push(circle);
          });
    
          google.maps.event.addDomListener(savebutton, 'click', function() {
            document.getElementById("savedata").value = "";
            for (var i = 0; i < circles.length; i++) {
              var circleCenter = circles[i].getCenter();
              var circleRadius = circles[i].getRadius();
              document.getElementById("savedata").value += "circle((";
              document.getElementById("savedata").value += 
                circleCenter.lat().toFixed(3) + "," + circleCenter.lng().toFixed(3);
              document.getElementById("savedata").value += "), ";
              document.getElementById("savedata").value += circleRadius.toFixed(3) + ")\n";
    
            }
          });
        }
    
        google.maps.event.addDomListener(window, 'load', initialize);
        </script>
      </head>
      <body>
        <button id="savebutton">SAVE</button>
        <textarea id="savedata" rows="8" cols="40"></textarea>
        <div id="map_canvas"></div>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My GUI looks like this and I want to enable to closing button of
I want to enable the user to select a video file from the on-device
i want to disable right click on the webpage but i want enable right
I want to enable GZIP compression for my static file like css styles, javascript
I want to enable an effect on my web app where a user clicks
I want to enable public caching with google app engine. I've got the following
I want enable user to select a photo from a photo library on his
I want to enable something like a one-to-many relation between a text object and
I want to enable an user to be able to communicate with other users
I want to enable auto update script in flex3. i am using below code

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.