troubleshooting Question

Setting a Central Location in Google Maps

Avatar of APD Toronto
APD TorontoFlag for Canada asked on
2 Comments1 Solution23 ViewsLast Modified:
Hi Experts,

I am just starting out with Google Maps API, and every example that I see starts off with a static central location, like Toronto that I have below.

My question is, do I really need a central location, because I dont know where that center will be. Toronto is in Ontario, but the user may want to see stores in BC. I am still working towards preparing the longitude/latitude, but I just thinking about my next step.

function get_map(){

    var toronto = {lat: 43.6560531, lng: -79.3869317};
    map = new google.maps.Map(document.getElementById('results_map'), {
      zoom: 12,
      center: toronto
    geocoder = new google.maps.Geocoder();

Open in new window

Thank you
APD Toronto
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros