1/* 2 INITIATE google gmaps on web page 3 version: 0.2 4*/ 5 6 7var geocoder; 8var test =3; 9 10function getGeocoder(){ 11 return geocoder; 12} 13 14function initialize(map_canvas_id, address,mapformat, zoom_level, location_type, scrollwheel, styles, iconURL) { 15 var map; 16 geocoder = new google.maps.Geocoder(); 17 18 var latlng = new google.maps.LatLng(45.524732, -122.677031); 19 20 if(scrollwheel==false ){ 21 var myOptions = { 22 center: latlng, 23 mapTypeId:mapformat, 24 zoom: zoom_level, 25 scrollwheel: false, 26 styles: styles, 27 zoomControl:true, 28 draggable:false 29 } 30 }else{ 31 var myOptions = { 32 center: latlng, 33 mapTypeId:mapformat, 34 zoom: zoom_level, 35 styles: styles, 36 zoomControl:true 37 } 38 } 39 40 41 var map_canvas = document.getElementById(map_canvas_id); 42 map = new google.maps.Map(map_canvas, myOptions); 43 44 45 // address from latlng 46 if(location_type=='latlng'){ 47 var latlngStr = address.split(",",2); 48 var lat = parseFloat(latlngStr[0]); 49 var lng = parseFloat(latlngStr[1]); 50 var latlng = new google.maps.LatLng(lat, lng); 51 52 geocoder.geocode({'latLng': latlng}, function(results, status) { 53 if (status == google.maps.GeocoderStatus.OK) { 54 55 var marker = new google.maps.Marker({ 56 map: map, 57 position: latlng, 58 icon: iconURL 59 }); 60 //map.setCenter(results[0].geometry.location); 61 map.setCenter(marker.getPosition()); 62 //console.log(results[0].geometry.location); 63 } else { 64 document.getElementById(map_canvas_id).style.display='none'; 65 } 66 }); 67 68 }else if(address==''){ 69 //console.log('t'); 70 }else{ 71 geocoder.geocode( { 'address': address}, function(results, status) { 72 if (status == google.maps.GeocoderStatus.OK) { 73 //console.log('map '+results[0].geometry.location); 74 map.setCenter(results[0].geometry.location); 75 var marker = new google.maps.Marker({ 76 map: map, 77 position: results[0].geometry.location, 78 icon: iconURL 79 }); 80 81 } else { 82 document.getElementById(map_canvas_id).style.display='none'; 83 } 84 }); 85 } 86 87 88} 89 90
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.