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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:20:19+00:00 2026-05-12T14:20:19+00:00

i am using GoogleMaps and i have 2 or more markers and they are

  • 0

i am using GoogleMaps and i have 2 or more markers and they are draggable.
I want to snap 2 markers if they are near and merge them into 1.
is this possible ?

Can someone give me pointers .. how i can realize that ?

  • 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-12T14:20:19+00:00Added an answer on May 12, 2026 at 2:20 pm

    You need to handle the drag event on the GMarker object. The trick is what do you do when you detect that you are near enough to another marker to snap them together. I played around a little with this and thought maybe hiding the currently dragged marker might be a good way to go.

    GEvent.addListener(marker, "drag", function(point) {
    
        // iterate over your points and for each otherPoint...
        if (near (point, otherPoint))
        {
            // hide this marker
            marker.hide ();
    
            // move nearby marker to indicate merge?
    
            // then delete the dragged marker on the dragend (if it was merged)
        }
    }
    

    Not an entirely elegant solution, but it might suit your purposes.

    Edit: I wondered if you were looking for the code to check nearby points, so I updated my example to do that:

    function near (point1, point2)
    {
        sw = new GLatLng(point2.lat() - 0.005, point2.lng() - 0.005);
        ne = new GLatLng(point2.lat() + 0.005, point2.lng() + 0.005);
        var bounds = new GLatLngBounds(sw, ne);
        if (bounds.contains (point1))
            return true;
    
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a whole bunch of CALayers, creating a tile-based image not unlike GoogleMaps
Update II I Figured this out. When using google maps api, the model must
I am trying to add a bunch of map markers to a map using
I'm developing sites using Wordpress and I want to use the lates version of
I am using Jquery to get googlemap data and load it into a div.
As far as I can tell I shouldn't be using ÅÄÖ (somthing like they
I have a bit of a puzzle on my hands. I'm Using Google Maps
I'm using the JQuery Draggable plugin . I'm trying to create an Image Editing
has anyone had any experience using BING maps on the iphone/ipad? We have an
I have a large high-resolution image that I am using for an overlay using

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.