Ragazzi mi è arrivata la comunicazione di google che la versione v2 verrà disattivata e sarà disponibile la v3 soltanto che non riesco a capire perchè non mi funziona non esce la mappa
Vecchia Versione :
codice:
<script src="http://maps.google.com/maps?file=api&v=2&key=<%=GetKeyGoogleMap%>" type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
if (GBrowserIsCompatible()) {
var publisher_id = "ca-pub-000000000000000";
var adsManagerOptions = {
maxAdsOnMap : 2,
style: G_ADSMANAGER_STYLE_ADUNIT,
// The channel field is optional - replace this field with a channel number
// for Google AdSense tracking
channel: ''
};
function createLengthMarker(point) {
var marker = new GMarker(point);
var value = polyline.getLength();
value = value / 1000;
var message = "testo : <%=variabile%>
";
GEvent.addListener(marker,"click", function() {
var myHtml = message;
map.openInfoWindowHtml(point, myHtml);
});
return marker;
}
var map = new GMap2(document.getElementById("map_canvas"));
adsManager = new GAdsManager(map, publisher_id, adsManagerOptions);
adsManager.enable();
map.setCenter(new GLatLng(<%=variabile%>), 3);
map.setUIToDefault();
var polyOptions = {geodesic:true};
var polyline = new GPolyline([
new GLatLng(<%=variabile%>),
new GLatLng(<%=variabile%>)
], "#ff0000", 10, 1, polyOptions);
map.addOverlay(polyline);
map.addOverlay(createLengthMarker(new GLatLng(<%=variabile%>)));
}
}
</script>
Nuova Versione riscritta :
codice:
<script src="http://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=<%=Key%>&language=it" type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
var publisher_id = "ca-pub-00000";
var adsManagerOptions = {
maxAdsOnMap : 2,
style: G_ADSMANAGER_STYLE_ADUNIT,
// The channel field is optional - replace this field with a channel number
// for Google AdSense tracking
channel: ''
};
function createLengthMarker(point) {
var marker = new GMarker(point);
var value = polyline.getLength();
value = value / 1000;
var message = "testo : <%=var%>
";
GEvent.addListener(marker,"click", function() {
var myHtml = message;
map.openInfoWindowHtml(point, myHtml);
});
return marker;
}
var map = new google.maps.Map(document.getElementById("map_canvas"));
adsManager = new GAdsManager(map, publisher_id, adsManagerOptions);
adsManager.enable();
map.setCenter(new GLatLng(<%=var%>), 3);
map.setUIToDefault();
var polyOptions = {geodesic:true};
var polyline = new GPolyline([
new GLatLng(<%=var%>),
new GLatLng(<%=var%>)
], "#ff0000", 10, 1, polyOptions);
map.addOverlay(polyline);
map.addOverlay(createLengthMarker(new GLatLng(<%=var%>)));
}
</script>