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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:32:57+00:00 2026-05-25T14:32:57+00:00

I am working on a Google Map here: http://crocdoc.ifas.ufl.edu/projects/chameleonmapdev/ I have the data for

  • 0

I am working on a Google Map here: http://crocdoc.ifas.ufl.edu/projects/chameleonmapdev/

I have the data for the markers set up in this format:

var nights = ['July1211', 'July1411'];
var waypoint_data = {
    July1211: [
        //Lat, long, j/a (juvenile/adult)
        [25.429363, -80.508326, j],
        [25.429332, -80.508216, j]
    ],

    July1411: [
        [25.42936, -80.51023, j], 
        [25.42936, -80.51036, j]

    ]
};

And the function that builds the points looks like this:

function buildPoints() {
    //var marker_container = new Object;

        for ( i = 0; i < nights.length ; i++ ) {

            //Loop for each data point that night
            for ( h = 0; h < waypoint_data[nights[i]].length; h++) {
                var marker = new google.maps.Marker({
                    position: new google.maps.LatLng(waypoint_data[nights[i]][h][0], waypoint_data[nights[i]][h][1]),
                    icon: waypoint_data[nights[i]][h][2],
                    shape: pointshape,
                    map: map
                });

                //Push waypoints into date-specific object key
                //marker_container[nights[i]].push(marker);

            }

        }

    }   

I would like to push the markers for each date (night[i]) into a different object key so that I can hide/show a specific night’s markers. I’ve tried doing this with the two marker_container lines I’ve commented out, but they just break my loop, and in Firebug, I get an error about marker_container[nights[i]] being undefined. nights[i] is a string, so I thought this syntax would work. Any hints are greatly appreciated, and I’m very open to suggestions for other, better ways to code 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-05-25T14:32:57+00:00Added an answer on May 25, 2026 at 2:32 pm

    You can’t use push on an Object, only on array. I think this is what you want to do:

    function buildPoints() {
        var marker_container = new Object();
    
            for ( i = 0; i < nights.length ; i++ ) {
                marker_container[nights[i]] = new Array();
    
                //Loop for each data point that night
                for ( h = 0; h < waypoint_data[nights[i]].length; h++) {
                    var marker = new google.maps.Marker({
                        position: new google.maps.LatLng(waypoint_data[nights[i]][h][0], waypoint_data[nights[i]][h][1]),
                        icon: waypoint_data[nights[i]][h][2],
                        shape: pointshape,
                        map: map
                    });
    
                    //Push waypoints into date-specific object key
                    marker_container[nights[i]].push(marker);
    
                }
    
            }
    
        }   
    

    simple proof of concept jsfiddle

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

Sidebar

Related Questions

I am working with google map. According to requirements i need to set different
I have a Google Map that suddenly stopped working for no apparent reason (I
Original code: (can be seen working here: http://sandbox.hokuten.net/jqrpg/ ) /* google.setOnLoadCallback(function() { */ $(function()
I currently have a Google Map Activity which is apparently working well but doesn't
Here im giving my code for google map view, this is not working if
I am working with Google App Engine and Python. I have a model with
I just started working using Google Maps API yesterday, and trying to set up
I'm working on a Google AppEngine project and I've changed my data format, so
I'm working on an advanced map application in Google Maps API V3. I'm using
I'm working on a map that has multiple markers on it. These markers use

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.