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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:00:39+00:00 2026-06-10T20:00:39+00:00

I have a collection of locations on a google map object, stored in a

  • 0

I have a collection of locations on a google map object, stored in a Backbone collection:

var Location = Backbone.Model.extend({
    defaults: {
        latitute: "",
        longitude: "",
        visited: false;
    },
});

var LocationCollection = Backbone.Collection.extend({
    model: Location,
    url: 'api/locations'
});

As each point is clicked on the map, the location model property ‘visited’ is set to true.

The original collection of locations comes from the database (based on the bounds of the map), which does not store any ‘visited’ information, simply a list of locations within range.

When the user changes the bounds of the Google map, by moving around, zooming in/out etc, I need to retrieve a brand new list of locations within the new parameters, then somehow assimilate this list with the existing collection, adding new locations, but retaining the visited properties for existing ones?

I hope this isn’t too vague, but where to start?? Is there a way with jQuery to map complex objects from one collection to another? Or would it make more sense to split the collections, sending visited information back to the server and combine them there? Or will the Backbone collection remember ‘visited’ values and only update those in the collection with new properties?

Sorry, I thought I knew this stuff, but I have never ever done anything like this.

  • 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-10T20:00:41+00:00Added an answer on June 10, 2026 at 8:00 pm

    It’s possible. Basically, I’m assuming the following. The user has a bunch of locations. They click and the location attribute changes to visited = true;

    When they zoom out, you fetch() new models that are now in view but you also want don’t want those old locations to reset to visited = false; Server will basically calculate the dimensions of the view and provide a bunch of location models.

    If this is what you want, all you need to do is make a fetch() call with the options: add:true.

    collection.fetch({
        add: true
    });
    

    When you pass the add:true option to your fetch() call, it won’t reset the collection (thereby wiping your visited data). Instead, it will only add models that don’t already exist in the collection. So if you already have locations.id = 1, 2, 3 and your server returns locations.id = 1, 2, 3, 4, 5, 6 … only 4, 5, 6 will be added to your already existing collection. The visited = true (or false) data of 1, 2, 3 should remain intact.

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

Sidebar

Related Questions

Can I pass a collection of locations to HitTest(object, location). I have a line
I have a json object collection of geo locations that I build in the
Lets say I have collection of documents with specified longitude and latitude. type is
I'm planning to have collection of items stored in a TCollection. Each item will
I have got a collection. The coll has strings: Location=Theater=2, Name=regal, Area=Area1 and so
The Goal Say I have a collection/folder of documents in Google Docs/Drive, and I
I have to pin my organization branch location on the map so that I
I'm using GoogleMap Control have a collection of markers with Geo locations. I can
I have the model Post: class Post < ActiveRecord::Base has_one :location, :dependent => :destroy
I have a large collection of pictures with GPS locations, encoded as lat/lon coordinates,

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.