Reputation: 1150
i'm trying to put an marker in the position ( -23.426056, -47.599556 ) in the Simple Map Example (http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html) and the marker never stay in the right place. In Google Maps I always get two markers, a red one(that marks the street) and the green one(an arrow that marks the right th exact place) like in this photo http://s4.postimg.org/6ahyt0rm5/ibagen.gif
how can i solve this?
Upvotes: 1
Views: 623
Reputation: 161324
If you know where the marker belongs (the coordinates), don't use the geocoder, just put the marker where you want it. Like this example from the Google Maps API v3 documentation Note that the example in you post is using the Google Maps API v2, whih was deprecated May 19, 2010; and reaches end of life May 19, 2013. New development using that version is discouraged.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Marker Simple</title>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(-23.426056, -47.599556);
var mapOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
</script>
</head>
<body onload="initialize()">
<div id="map-canvas" style="height:400px; width:500px;"></div>
</body>
</html>
Upvotes: 1