Огромное спасибо, melky.
Если кому интересно, то сделал так:
var map;
function initialize() {
var city= new google.maps.LatLng(0.000000 ,00.000000);
var mapOptions = {
zoom: 13,
center: city,
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var marker = new google.maps.Marker({
position: city,
draggable:true,
icon:image,
map: map,
animation: google.maps.Animation.DROP,
});
google.maps.event.addListener(map, "click", function(event) {
position_x = event.latLng.lat();
position_y = event.latLng.lng();
marker.setPosition(event.latLng);
$('#map_coordinates').empty().append(position_x+' '+position_y);
});
google.maps.event.addListener(marker,"dragend", function(event) {
position_x = marker.getPosition().lat();
position_y = marker.getPosition().lng();
$('#map_coordinates').empty().append(position_x+' '+position_y);
});
// gdsgsdgdsgsg
}
var image = 'http://google-maps-icons.googlecode.com/files/beach-nudist.png';
// Add a marker to the map and push to the array.
function addMarker(location) {
var marker = new google.maps.Marker({
position: location,
draggable:true,
icon:image,
map: map,
});
markers.push(marker);
$('#map_coordinates').empty().append(location.e+' '+location.d);
}
// Sets the map on all markers in the array.
function setAllMap(map) {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(map);
}
}
// Removes the markers from the map, but keeps them in the array.
function clearMarkers() {
setAllMap(null);
}
// Shows any markers currently in the array.
function showMarkers() {
setAllMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);