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 17 //console.log('init'); 18 19 // map styles 20 if(styles === undefined){ 21 if( typeof gmapstyles !== 'undefined' && gmapstyles != 'default'){ 22 styles = JSON.parse(gmapstyles); 23 } 24 } 25 26 geocoder = new google.maps.Geocoder(); 27 28 //var latlng = new google.maps.LatLng(45.524732, -122.677031); 29 30 var latlng = 0; 31 32 if(scrollwheel==false ){ 33 var myOptions = { 34 //center: latlng, 35 mapTypeId:mapformat, 36 zoom: zoom_level, 37 scrollwheel: false, 38 styles: styles, 39 zoomControl:true, 40 draggable:false 41 } 42 }else{ 43 var myOptions = { 44 //center: latlng, 45 mapTypeId:mapformat, 46 zoom: zoom_level, 47 styles: styles, 48 zoomControl:true, 49 scrollwheel: true, 50 } 51 } 52 53 //console.log(myOptions); 54 55 var map_canvas = document.getElementById(map_canvas_id); 56 map = new google.maps.Map(map_canvas, myOptions); 57 58 59 // address from latlng 60 if(location_type=='latlng'){ 61 var latlngStr = address.split(",",2); 62 var lat = parseFloat(latlngStr[0]); 63 var lng = parseFloat(latlngStr[1]); 64 var latlng = new google.maps.LatLng(lat, lng); 65 66 geocoder.geocode({'latLng': latlng}, function(results, status) { 67 if (status == google.maps.GeocoderStatus.OK) { 68 69 var marker = new google.maps.Marker({ 70 map: map, 71 position: latlng, 72 icon: iconURL 73 }); 74 //map.setCenter(results[0].geometry.location); 75 map.setCenter(marker.getPosition()); 76 //console.log(results[0].geometry.location); 77 } else { 78 document.getElementById(map_canvas_id).style.display='none'; 79 } 80 }); 81 82 //console.log(lat); 83 84 }else if(address==''){ 85 //console.log('t'); 86 }else{ 87 geocoder.geocode( { 'address': address}, function(results, status) { 88 if (status == google.maps.GeocoderStatus.OK) { 89 //console.log('map '+results[0].geometry.location); 90 map.setCenter(results[0].geometry.location); 91 var marker = new google.maps.Marker({ 92 map: map, 93 position: results[0].geometry.location, 94 icon: iconURL 95 }); 96 97 } else { 98 document.getElementById(map_canvas_id).style.display='none'; 99 } 100 }); 101 } 102}
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.