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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:29:43+00:00 2026-06-04T15:29:43+00:00

So I am trying to use the Google Maps feature with the following codes

  • 0

So I am trying to use the Google Maps feature with the following codes and the json data.
But I get Error: location is undefined error. I dont really understand why because I defined in my codes.
I am new to JavaScript, any suggestion to make this code appreciated.

    var data = <%=JSON.stringify(Info, null, 2) & vbNewline%>;

  function initialize() {
        var center = new google.maps.LatLng(48.404840395764175, 2.6845264434814453);

    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 3,
      center: center,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    var markers = [];
    for (var i = 0; i < 100; i++) {
      var location = data[i];
      var latLng = new google.maps.LatLng(location.latitude,
          location.longitude);
      var marker = new google.maps.Marker({
        position: latLng
      });
      markers.push(marker);
    }
    var markerCluster = new MarkerClusterer(map, markers);
  }
  google.maps.event.addDomListener(window, 'load', initialize);


{ "firstname": "", "lastname": "", "location": { "latitude": "48.4048403957642", "longitude": "2.68452644348145" } } { "firstname": "", "lastname": "", "location": { "latitude": "48.4050236871384", "longitude": "2.68512690051361" } } { "firstname": "", "lastname": "", "location": { "latitude": "48.4048403957642", "longitude": "2.68452644348145" } } { "firstname": "", "lastname": "", "location": { "latitude": "48.7570941168018", "longitude": "2.16670989990234" } } { "firstname": "", "lastname": "", "location": { "latitude": "48.404922961092", "longitude": "2.70020564018949" } } { "firstname": "", "lastname": "", "location": { "latitude": "48.8739279353421", "longitude": "2.32875823974609" } } { "firstname": "", "lastname": "", "location": { "latitude": "48.4048403957642", "longitude": "2.68452644348145" } } { "firstname": "", "lastname": "", "location": { "latitude": "41.0349860434783", "longitude": "28.9774059609177" } } 
  • 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-04T15:29:44+00:00Added an answer on June 4, 2026 at 3:29 pm

    You should probably do

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

    instead of

    for (var i = 0; i < 100; i++) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the Google Maps geocoder with Python and JSON, but keep
Am trying to use google.loader.ClientLocation along with the maps api to get the location
I'm trying to use the Google Maps API in a Sinatra app. I get
I am trying to use Google Places in Google Maps API v3, but I
I am trying to use the Google Maps API to get the latitude and
I'm trying to use the MVC objects in Google Maps version 3. What I
I'm trying to use Google Maps API and i'm stuck here: I need an
GOOGLE MAPS API V3 is what i'm trying to use. I have all the
Thank you in advance for all your help. I'm trying to use google maps
I'm trying to use Google geocoder service to get the coordinates of cities input

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.