Guest User

Google maps api

a guest
Jun 28th, 2010
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <script type="text/javascript">
  2. //<![CDATA[
  3.  
  4.  
  5. var map;
  6. var url = "mypath";
  7. var image = 'beachflag.png';
  8.  
  9.  
  10. function initialize() {
  11. // the central point of the map in lat and long
  12. var latlng = new google.maps.LatLng(54.5, -3);
  13. //options to set
  14. var myOptions = {
  15. <!--- Affects how far the map is zoomed in by default --->
  16. zoom: 5,
  17. center: latlng,
  18. // there are four map types to select from and set as a default, ROADMAP,SATELLITE,HYBRID,TERRAIN
  19. mapTypeId: google.maps.MapTypeId.TERRAIN
  20. };
  21. var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  22. };
  23.  
  24.  
  25. function showClear() {
  26. if (document.getElementById("clear").checked == true) {
  27. var res = new Ajax.Request(
  28. url, {
  29. method: "get", // Set the method of sending the variables
  30. parameters : {
  31. method: 'getClearLayer',
  32. returnformat: 'json'
  33. },
  34. // When the call has returned a value
  35. onComplete: outputMarkers
  36. }
  37. );
  38. }
  39. };
  40.  
  41.  
  42. function outputMarkers(transport) {
  43. results = transport.responseText.evalJSON();
  44. // if some results have been returned
  45. if (results.DATA.length > 0) {
  46. // Plot the markers
  47. for (i=0; i<=results.DATA.length; i++) {
  48. var marker = new google.maps.Marker({
  49. position: results.DATA[i][2],
  50. map: map,
  51. title:"New marker"
  52. });
  53. marker.setMap(map);
  54. }
  55. }
  56. };
  57. //]]>
  58. </script>
Add Comment
Please, Sign In to add comment