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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:53:21+00:00 2026-05-25T11:53:21+00:00

I’m building the options for the gMap plugin dynamically and need to know how

  • 0

I’m building the options for the gMap plugin dynamically and need to know how to check to see if one of the markers already exists.

This is how it is being built in javascript:

success: function(data) {
  var markers = { controls: true, scrollwheel: true, markers: [], zoom: 8 };
  $.each(data["events"], function(id, event) {
    // .. do other stuff with the data
    if(showmap) {
      // add location to maps list prevent multiples
      //
      // How do I check to see if it already exists?
      //
      // event[] is a JSON Object, BTW
      //
      //if((markers.indexOf(event['LocLatitude']) == -1) && (markers.indexOf(event['LocLongitude']) == -1)) {
      marker1 = { latitude: event['LocLatitude'],
                  longitude:event['LocLongitude'],
                  html: '"'+event['LocName']+'<br />'+event['LocAddress']+'<br />'+event['LocCity']+', '+event['LocState']+'"',
                  icon:{image: "/images/gmap_pin_orange.png",
                        iconsize: [26, 46],
                        iconanchor: [12,46],
                        infowindowanchor: [12, 0]
                       }
                };
      markers.markers.push(marker1);
      //} // if((markers.indexOf(event['LocLatitude']) == -1)
    } // if(showmap)
  } // $.each(data["events"]
}, // success:

The commented code above shows how I was doing it when I was building it as a string, that technique no longer works.
I need to know how to check to see if the marker being added already exists in markers.markers before it is pushed.

  • 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-25T11:53:22+00:00Added an answer on May 25, 2026 at 11:53 am

    Here, I’m iterating through the markers and checking the ones I want, the return false breaks me out of the $.each, return true continues.

    marker_exists = false;
    $.each( markers.markers, function(i, n){
      if(markers.markers[i].latitude == event['LocLatitude'] && markers.markers[i].longitude == event['LocLongitude']) {
        if(markers.latitude == "") {
          markers.latitude = event['LocLatitude'];
          markers.longitude = event['LocLongitude'];
        }
        marker_exists = true;
        return false;
      } else {
        return true;
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT

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.