Google maps php/js help needed.

Thread Solved
Reply

Join Date: May 2004
Posts: 102
Reputation: kained is an unknown quantity at this point 
Solved Threads: 0
kained kained is offline Offline
Junior Poster

Google maps php/js help needed.

 
0
  #1
Mar 19th, 2008
I am making a website to show Londoners where the nearest toilet to them is. I am having problems getting the data into the google maps application. It was working yesterday and now it isn't. Im confused to say the least any help would be much appreciated.

  1. var markers = [
  2. {
  3. 'latitude': 51.51383,
  4. 'longitude': -00.15246,
  5. 'name': 'Balderton street, W1'
  6. },
  7. {
  8. 'latitude': 51.51504,
  9. 'longitude': -00.15039,
  10. 'name': 'Barrett Street, W1'
  11. },
  12. {
  13. 'latitude': 51.51015,
  14. 'longitude': -0.18692,
  15. 'name': 'Bayswater Road, W2'
  16. },
  17. {
  18. 'latitude': 51.52113,
  19. 'longitude': -00.20921,
  20. 'name': 'Bevington Road, W10 '
  21. },
  22.  
  23.  
  24. {
  25. 'latitude': 51.51626,
  26. 'longitude': -00.18732,
  27. 'name': 'Bishops Bridge Road, W2'
  28. },
  29. {
  30. 'latitude': 51.49681,
  31. 'longitude': -00.14168,
  32. 'name': 'Bressenden Place, SW1'
  33. },
  34.  
  35. {
  36. 'latitude': 51.51360,
  37. 'longitude': -00.13581,
  38. 'name': 'Broadwick Street,
  39. W1 '
  40. },
  41. {
  42. 'latitude': 51.50966,
  43. 'longitude': -0.08036,
  44. 'name': 'Byward Street,EC3'
  45. },
  46. {
  47. 'latitude': 51.53890,
  48. 'longitude': -00.14287,
  49. 'name': 'Camden High Street 176, NW1'
  50. },
  51. {
  52. 'latitude': 51.46475,
  53. 'longitude': -00.16845,
  54. 'name': 'Clapham Junction/Station Approach, SW11 '
  55. },
  56. {
  57. 'latitude': 51.51149,
  58. 'longitude': -00.12346,
  59. 'name': 'Covent Garden, next to St Pauls church, WC1 '
  60. },
  61.  
  62. ];
I am using a js script to control the map.

  1. var centerLatitude = 51.604372; //longittude and latitude coordinates and zoom geocodes
  2. var centerLongitude = -0.159052;
  3. var startZoom = 13;
  4. var description = 'London';
  5.  
  6. function addMarker(latitude, longitude, description) {
  7. var marker = new GMarker(new GLatLng(latitude, longitude));
  8.  
  9. GEvent.addListener(marker, 'click',
  10. function() {
  11. marker.openInfoWindowHtml(description);
  12. }
  13. );
  14.  
  15. map.addOverlay(marker);
  16. }
  17.  
  18. function init() {
  19. if (GBrowserIsCompatible()) {
  20. map = new GMap2(document.getElementById("map"));
  21. map.addControl(new GSmallMapControl());
  22. map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom);
  23.  
  24. for(id in markers) {
  25. addMarker(markers[id].latitude, markers[id].longitude, markers[id].name);
  26. }
  27. }
  28. }
  29.  
  30. window.onload = init;
  31. window.onunload = GUnload;

the map is currently located here. http://intweb.tech.bcuc.ac.uk/~20318...ject/index.php

any help woul;d be much appreciated or if you need more to help me lemme know. This is nowhere near finished so am not bothered by lack of funcationality or anything like that im just trying to get the markers onto the map at the moment.

dave
Last edited by kained; Mar 19th, 2008 at 8:20 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,121
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 471
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Google maps php/js help needed.

 
0
  #2
Mar 19th, 2008
If you found solution whould you mind to share with others?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 102
Reputation: kained is an unknown quantity at this point 
Solved Threads: 0
kained kained is offline Offline
Junior Poster

Re: Google maps php/js help needed.

 
0
  #3
Mar 19th, 2008
Fair enough. It was a silly little thing. line 39 of the php code. Just moved it up to line 38 and all was well.
  1. 'name': 'Broadwick Street,
  2. W1 '
It needed to be on one line rather then two, which is ridiculous!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC