Closed harold-s closed 10 years ago
upgrade to 2.1.2, should work directly :)
btw, watch out:
handler.buildMap({ internal: {id: 'map_compte', streetViewControl: false}}
should be:
handler.buildMap({ internal: {id: 'map_compte'}, provider: {streetViewControl: false}}
Hello,
Thanks for Streetview !
I have upgraded to 2.1.2 in my project :
bundle show | grep gmap
But I still have the problem.
Ok I didnt understand your issue before. I've tried your code:
handler = Gmaps.build('Google');
handler.buildMap({ internal: {id: 'map'}}, function(){
markers = handler.addMarkers([
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"},
{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}
]);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
});
and get:
So sorry but I cant reproduce.
Thanks !
I have minified the code with the bug :
I have linked underscore-min.js to their website
I have put gmaps_google.js on pastebin (http://pastebin.com/raw.php?i=ae1qhTTF)
Here's what I get :
Here is the HTML :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="http://maps.google.com/maps/api/js?v=3.13&sensor=false&libraries=geometry" type="text/javascript"></script>
<script src='http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js' type='text/javascript'></script>
<script src="http://www.google.com/jsapi"></script>
</head>
<body>
<script src="http://pastebin.com/raw.php?i=ae1qhTTF"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<div id="map_compte" class='gmap' style='width: 100%; height: 300px;'></div>
<script>
//<![CDATA[
handler = Gmaps.build('Google');
handler.buildMap({ internal: {id: 'map_compte'}, provider: {streetViewControl: false}}, function(){
markers = handler.addMarkers([{"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}, {"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}, {"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}, {"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}, {"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}, {"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}, {"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}, {"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}, {"lat":45.5531,"lng":3.74324,"marker_title":"pin","infowindow":"pin"}]);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
});
//]]>
</script>
</body>
</html>
Replace:
<script src="http://pastebin.com/raw.php?i=ae1qhTTF"></script>
With:
<script src="http://apneadiving.github.io/js/gmaps4rails.js" type='text/javascript'></script>
(its the 2.1.2 version)
Thanks it works !
I had a few versions of the old javascript hiding and conflicting with the new one.
Thanks a lot !
Hello,
I cannot reproduce the problem on a simple Google map so I guess the problem comes from Google-Maps-for-Rails.
I have over 5000 coordinates in my database and if I display them all on one map, it works flawlessly except for one point that moves aound after each refresh. It's longitude seems to be OK each time but the latitude is wrong.
The coordinates of the point are : lat:45.5531, lng: 3.74324
If I display this point 11 times on the same map, I get 11 different points with different latitudes.
Here is the code I use to display this map :
Could you help me please ?
Thanks a lot !!!