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

  • Home
  • SEARCH
  • 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 8986265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:30:37+00:00 2026-06-15T21:30:37+00:00

I have only recently begun to play around with html, javascript, webapps etc and

  • 0

I have only recently begun to play around with html, javascript, webapps etc and I decided to try write my own Prey standalone webserver.

I am using Twitter Bootstrap for the UI, and jQuery for javascript stuff. My reports page lists all the reports and allows the user to select one to view on the map. The page then gets the data as JSON from the server which all works fine. However when I call map.setCenter(new google.maps.LatLng(data['lat'], data['lng'])) the map just turns grey instead of moving to that location.

I have tried this in chrome and firefox, and I get the same problem. Strangely, there are no errors in the chrome console-debugger-thing nor in firebug. I can see maybe 10 similar issues under “Similar Questions”; however none of those solutions (eg. CSS) have helped.

Here’s the website (it’s a sandbox on dotCloud, so it might be very slow): http://prey-geniass.dotcloud.com/devices/l6wyd/reports.xml

  • 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-15T21:30:39+00:00Added an answer on June 15, 2026 at 9:30 pm

    So I noticed you store the map object as window['map'] (funny how everybody seems to do that… makes debugging easier when I don’t have to dive into the source 🙂 ).

    I tried to set the centre myself using a known set of coordinates:

    map.setCenter(new google.maps.LatLng('51.0453246', '-114.0581012'));
    

    This worked fine, so the actual code is working fine. I tested some cases for incorrect values… null and 0 would put me somewhere in the ocean, but undefined for both lat and lng would turn the map grey. Perhaps the values you are passing in are incorrect, and end up being undefined?

    Looking at the second alert that comes, the relevant properties are latitude and longitude, although you seem to be passing in data['lat'] and data['lng']. Would this be the reason?

    This should fix it:

    //update map
    marker = new google.maps.Marker({
        position: new google.maps.LatLng(data['latitude'], data['longitude']),
        title:"Last Known Position"
    });
    marker.setMap(map);
    map.setCenter(new google.maps.LatLng(data['latitude'], data['longitude']))
    // google.maps.event.trigger(map, 'resize');
    

    Please note that I commented out your ‘resize’ trigger (which I assume you probably added in an effort to resolve this problem? I remember suggesting that to another user here :)). It is not required in your case.

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

Sidebar

Related Questions

I have recently begun to use the EF v4 Code Only library for some
I have only recently begun programming in Python (with previous Ruby experience). I am
I have only recently been introduced to curl and am working on a certain
I have only recently started using CakePHP and have been unable to get validation
I have only started learning python recently. I would still be considered a beginner.
I have only started learning Python recently. Let me explain what I am trying
I have an iPhone app, which is running only in landscape mode, but recently
I have only recently started programming significantly, and being completely self-taught, I unfortunately don't
I've recently begun a fairly small 2D project using SFML and TinyXML and have
Project Euler I have recently begun to solve some of the Project Euler riddles.

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.