Hello
I have some problems with Google Map. I'm working with Ruby On Rails
(2.0). I'have written som functions for creating the maps in my web
application in the application.js file. The points to display are in a
Javascript Object array. This array is created dynamically in a script
tag (<script></script>).
When this array contains about more than 15 points, I don't have any
markers on my map.
There is the code :
in application.js
var map;
function addMarker(latitude,longitude,description){
var marker = new GMarker(new GLatLng(latitude,longitude));
GEvent.addListener(marker,'click',
function(){
marker.openInfoWindowHtml(description);
}
);
return marker;
}
function setCenterToPoint(longitude,latitude,description){
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(latitude,longitude),10);
map.addControl(new GSmallMapControl());
map.setMapType(G_SATELLITE_MAP);
for(i=0;i<markers.length();i++){
var marker = new GMarker(new GLatLng(markers[i].latitude,markers
[i].longitude));
GEvent.addListener(marker,'click',function(){
marker.openInfoWindowHtml(markers[i].html);
});
map.addOverlay(marker);
}
map.openInfoWindowHtml(new GLatLng
(latitude,longitude),description);
}
function init(){
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(34,15),5);
map.setMapType(G_SATELLITE_MAP);
var markerManager = new GMarkerManager(map);
for (i=0; i<markers.length();i++){
var marker = new GMarker(new GLatLng(markers[i].latitude,markers
[i].longitude));
GEvent.addListener(marker,'click',function(){
marker.openInfoWindowHtml(markers[i].html);
});
map.addOverlay(marker);
}
}
in the script tag :
<script type="text/javascript">
var markers = [];
<% @populations.each do|pop| %>
markers.push({'latitude': <%= pop.geo_coordinate.lat %>,
'longitude': <%= pop.geo_coordinate.long %>,
'html':'<div>Population : <%= pop.name %><br>Species :
<%= pop.espece.name %> </div>'});
<% end %>
init();
</script>
I have sometimes 306 markers to display. Is it normal (my code is
wrong) ?
I also try with the GMarkerManager class, and it's the same result.
[EMAIL PROTECTED] a écrit :
> On Nov 18, 3:49�pm, cjackson <[EMAIL PROTECTED]> wrote:
> > Is there a limit to the number of markers that can appear on a map at
> > a time? �Thanks for the help!
>
> Not by the API. The browser will limit usability after a few hundred,
> IE is much worse performance than other browsers (so if you expect the
> general public, be sure to test with IE6).
>
> -- Larry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---