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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:03:16+00:00 2026-05-30T19:03:16+00:00

This demo creates markers at random points on map: http://gmap3.net/examples/pan-to-markers.html Whats the smallest modification

  • 0

This demo creates markers at random points on map:
http://gmap3.net/examples/pan-to-markers.html

Whats the smallest modification I can make to the demo code so I can specify the longitude and latitude of the points instead of having them random?

NOTE The exact code I have is slightly different to the demo in the link:

    $('#test1').gmap3(
      { action: 'init',
        center:{
            lat:44.797916, 
            lng:-93.278046
        },
        onces: {
          bounds_changed: function(){
            $(this).gmap3({
              action:'getBounds', 
              callback: function (bounds){
                if (!bounds) return;
                var southWest = bounds.getSouthWest(),
                    northEast = bounds.getNorthEast(),
                    lngSpan = northEast.lng() - southWest.lng(),
                    latSpan = northEast.lat() - southWest.lat(),
                    i;
                for (i = 0; i < 10; i++) {
                  add($(this), i, southWest.lat() + latSpan * Math.random(), southWest.lng() + lngSpan * Math.random());
                }
              }
            });
          }
        }
      }
    );

  });

Here is the code im actually using. I know its hacky but this is just for a demo.
http://smartpeopletalkfast.co.uk/gmap/demo/overlay.html

  • 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-30T19:03:17+00:00Added an answer on May 30, 2026 at 7:03 pm

    If you want to create your own set of points, you’d want to do something along the following lines:

    // create a set of lat/lng points. Replace x/y with your own lat/lngs
    var points = [
        [x, y],
        [x, y],
        [x, y],
        [x, y],
        [x, y],
        [x, y],
        [x, y]
    ];
    
    $('#test').gmap3(
    { action: 'init',
      center:[44.797916,-93.278046],
      onces: {
        bounds_changed: function(){
          $(this).gmap3({
            action:'getBounds', 
            callback: function (bounds){
              if (!bounds) return;
                var southWest = bounds.getSouthWest();
                var northEast = bounds.getNorthEast();
                var lngSpan = northEast.lng() - southWest.lng();
                var latSpan = northEast.lat() - southWest.lat();
                for (var i = 0; i < points.length; i++) {
                 // instead use the points you previously defined
                 add($(this), i, points[i][0], points[i][1]);
              }
            }
          });
        }
      }
    }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran the code to create the generically related objects from this demo: http://www.djangoproject.com/documentation/models/generic_relations/
I am trying to implement this demo on my local machine. http://bit.ly/4g4o1r I have
http://demo.thethemefoundry.com/traction/#post-183 Which wordpress plugin is this, to have post image on the left side
I've been interested in this demo: http://jakearchibald.com/scratch/alphavid/ I also saw this question on here:
I am reading points from a DB as JSON to create map markers and
i am trying to do a page like this - http://www.wickham43.supanet.com/tutorial/headerfooterfixexample.html but i want
I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so
see this demo from jquery ui you have to hold down the Ctrl key
Please have a look at this demo page that I cooked up a while
Hoping that using something like this demo it is possible to drag items within

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.