SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Google Maps

  1. #1
    SitePoint Zealot barleytwist's Avatar
    Join Date
    Dec 2005
    Location
    Lulworth, Dorset, UK
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Google Maps

    I have successfully included a google map on a website. I copied all the details across to another website, got a new passcode from google but although I can see the browser going to google (in the bottom bar) it does not load the maps themselves (almost as if google is rejecting or ignoring the request). The website is here.

    You can see the CSS working so if it is my site then its likely to be something javascript.

    PS if I look at the javascript in the Firefox add-on it reports lots of errors but I'm no expert there!

    Thanks for your time.
    Last edited by barleytwist; Jun 7, 2007 at 06:57. Reason: more detail

  2. #2
    whagwan? silver trophybronze trophy akritic's Avatar
    Join Date
    Nov 2006
    Posts
    2,780
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    From the google help pages:


    A single Maps API key is valid for a single "directory" on your web server, so if you sign up for the URL http://www.mygooglemapssite.com/mysite, the key you get will be good for all URLs in the http://www.mygooglemapssite.com/mysite/
    I think you need to get a new API key for your new site. Also I could not access your site (4pm GMT). It could be an error in the the geocode co-ordinates.

  3. #3
    SitePoint Zealot barleytwist's Avatar
    Join Date
    Dec 2005
    Location
    Lulworth, Dorset, UK
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by armchaircritic View Post
    From the google help pages:



    I think you need to get a new API key for your new site. Also I could not access your site (4pm GMT). It could be an error in the the geocode co-ordinates.
    I did! And I can reach my site from my link. But http://www.warehammid.dorset.sch.uk/office.html
    just in case.

  4. #4
    whagwan? silver trophybronze trophy akritic's Avatar
    Join Date
    Nov 2006
    Posts
    2,780
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    this is what I see ( I have scripts ENabled )

    Here you should see an interactive map, but you either have scripting disabled or your browser is not supported by Google Maps. Alternatively, This is a link to open a street map.
    You see, when I use google maps, I use the google-generated code. The only difference I see is that you do not have the cdata part in your code. Without this, my map does not show either.

    An example of what I have on my page apart from the initall script and API key from google is
    Code:
        //<![CDATA[
    
        function load() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map"));
            map.setCenter(new GLatLng(18.975, 72.8258333), 13);
          }
    	  var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(18.975, 72.8258333), 13);
        }
    
        //]]>
    When you requested an API key from google, did it not give you something
    similar to this to use?

  5. #5
    SitePoint Zealot barleytwist's Avatar
    Join Date
    Dec 2005
    Location
    Lulworth, Dorset, UK
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Still stumped!

    Ah! but I have another site with the same code (albeit organised as shtml files with a header). And it works for the same browsers. I have carefully edited out other js files just in case they are causing the problem - no luck). The following is my external js file now as your suggestion - no luck: // I did attempt to get another code from google for my ../office.html file but it complained that there was already one (however diff. from my website root one). Anyway I asked for another one for http://www.warehammid.dorset.sch.uk and I got one.

    NOW, I suspect that my code is going to google to get the js files but they are not being returned. The reason why I say that is because the div. in which I put the map (same as on the other site) forms up OK as you have seen. Problem is I would like to say put a breakpoint in to the firefox ad-in but its a bit beyond me. I'm just hacking blind at the moment and a bit wary as the site is live although this is a school so not too critical!

    If you would like to see more code then I can paste it but I suspect you can get to my website code anyway.

    PS Firefox javascript error consol deliver a lot of errors but these may be a red herring for other sites I've gone to.

    Thanks

  6. #6
    whagwan? silver trophybronze trophy akritic's Avatar
    Join Date
    Nov 2006
    Posts
    2,780
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    I think this could be a Javascript issue.. Though I'm no expert.

    It seems you've tried a few revisions to see if it works and have not found anything conflicting with the google map, but I would suggest posting a different question in the Javascript board, there are helpful folks there who can eyeball your code and help you find the problem.

    Tip: don't just post the same question, because I think it will flag as duplicate post. Perhaps you may want to ask if the javascript errors Firefox is saying are present may be conflicting with google maps.

    Another suggestion would be to set up a 'minimal test case'. Have your basic web page, Doctype, header, body tags etc, and just put the map code in and test it.

    Also are you using something like Dreamweaver? May be worth mentioning in your post in the Javascript forum.

    good luck Sorry I couldn't be of more help, but it's way out of my league.

    Andy

  7. #7
    SitePoint Zealot barleytwist's Avatar
    Join Date
    Dec 2005
    Location
    Lulworth, Dorset, UK
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeh, thanks, I have posted a page /testmap and when I go to that I get the google refusal. But I don't know if it means my othr one is Ok or not! Thanks for your time. I will call the post "Help on Google Maps API".

  8. #8
    whagwan? silver trophybronze trophy akritic's Avatar
    Join Date
    Nov 2006
    Posts
    2,780
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Glad to have been some small help. At least you know where the problem is now, and hopefuly you can find an answer to your problem.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •