Wykonanie tiltu mapy w Gmap

<title>Tilt</title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var map;
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(52.217283,20.972372),
zoom: 18,
mapTypeId: google.maps.MapTypeId.SATELLITE,
heading: 90,
tilt: 45
};
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="map_canvas" style="width:600px; height:500px"></div>

Wyrysowanie koła w Gmap

Rysowanie koła. Należy odpowiednio wypełnić właściwości obiektu google.maps.CircleOptions

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<title>Koło</title>
<script type="text/javascript"
 src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map; var position = new google.maps.LatLng(52.217283,20.972372);
function initialize() {
var mapOptions = {
center: position,
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var circleOptions =
{
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35,
map: map,
center: position,
radius: 25000
};
var cityCircle = new google.maps.Circle(circleOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map_canvas" style="width:800px; height:500px"></div>
</body>
</html>

Zmiana rozmiaru mapy

map = new GMap2(document.getElementById(„mapcan”));
…..
map.getContainer().style.width = 500+’px’;
map.getContainer().style.height = 500+’px’;
map.checkResize();

Kod należy umieścić w funkcji JS.
Wywołanie funkcji powoduje zmiane rozmiaru mapy.

Dodanie przesuwalnego markera

var color = „red”;
var f = new GIcon();
f.image = „
http://labs.google.com/ridefinder/images/mm_20_” + color
  + „.png”;
f.shadow = „
http://labs.google.com/ridefinder/images/mm_20_shadow.png„;
f.iconSize = new GSize(12,20);
f.shadowSize = new GSize(22,20);
f.iconAnchor = new GPoint(6,20);
f.infoWindowAnchor = new GPoint(6,1);
f.infoShadowAnchor = new GPoint(13,13);

newMarker = new GMarker(point,
 {icon: f, draggable: true}
);

Zablokowanie przesuwania mapy

var map = new GMap2(document.getElementById(„map_sm”));
map.setCenter(new GLatLng(52.21202468872070, 20.82314300537109), 13);
map.addOverlay(new GMarker(new GLatLng(52.21202468872070, 20.82314300537109)));
map.disableDragging();

Wyświetlenie punktów z dymkami

var dane = new Array();
dane[0] = {lat: 52.224355732689, lng: 21.253480911255, dymek: ‚<span class=”dymek”><b>opis</b></span>’}

var cnt = dane.length;
for(i=0; i<cnt; i++) {
    var d = dane[i];
    var marker = new GMarker(new GPoint(d.lng, d.lat));
    map.addOverlay(marker);
    marker.openInfoWindowHtml(d.dymek);
}

Wyświetlanie komunikatów w oknie debugera GMap

Wyświetlanie komunikatów w oknie debugera GMap:

GLog.write("New position of insert = "+ point.lat() + ","+point.lng() + ","+pixel.x + ","+pixel.y + ", p1: " + point1.x + ", " + point1.y + ",o: " + offset.x + ", " + offset.y + ",r: "+(offset.x - point1.x) +","+(-offset.y + point1.y) + ",h: "+ map.getSize().height);

Zmiana domyślengo kursora myszy

var map = new GMap2(document.getElementById(„map”));.

Zmiana domyślengo kursora myszy podczas przeciągania mapy 

var map = new GMap2(document.getElementById(„map”), {draggableCursor: ‚crosshair’, draggingCursor: ‚pointer’});