No the geocoding is made before and lat & long are sent through my xml.
Could it be a map loading issue ? The addOverlay function would try to 
add markers on a non-completely loaded map ?

Here is my code :

$(document).ready(function () {
    if (GBrowserIsCompatible()) {
        var markerGroups = [];
        var pictosFleuveRhone = [];
       
        var center = new GLatLng(44.824708282300236, 5.25146484375);
        var zoom_level = 8;
       
        var map = new GMap2(document.getElementById("map_canvas"));
        map.addMapType(G_PHYSICAL_MAP);
        map.setCenter(center, zoom_level, G_PHYSICAL_MAP);
   
        var customUI = map.getDefaultUI();
        customUI.zoom.scrollwheel = true;
        map.setUI(customUI);

        GDownloadUrl("/gmapdata/list/245/listCategories/categories", 
function(data){
            var xml = GXml.parse(data);
            var categories = 
xml.documentElement.getElementsByTagName("categorie");
           
            for (var i = 0; i < categories.length; i++) {
                var cat_id=categories[i].getAttribute("id");
                markerGroups[cat_id] = [];
                $("a#"+cat_id).click(toggleGroup);
               
                pictosFleuveRhone[cat_id] = new GIcon();
                pictosFleuveRhone[cat_id].image = 
categories[i].getAttribute("picto");
                pictosFleuveRhone[cat_id].iconSize = new GSize(20, 20);
                pictosFleuveRhone[cat_id].iconAnchor = new GPoint(16, 16);
                pictosFleuveRhone[cat_id].infoWindowAnchor = new 
GPoint(5, 1);
                pictosFleuveRhone[cat_id].shadow = '';
                pictosFleuveRhone[cat_id].shadowSize = new GSize(22, 20);
               
            }
        });
       
        GDownloadUrl("/gmapdata/list/197/listLocation/mapitem", 
function(data){
            var xml = GXml.parse(data);
            var markers = 
xml.documentElement.getElementsByTagName("marker");
            for (var i = 0; i < markers.length; i++) {
                var name = markers[i].getAttribute("name");
                var detail = markers[i].getAttribute("detail");
                var label = i;
                var type = markers[i].getAttribute("type_id");
                var point = new 
GLatLng(parseFloat(markers[i].getAttribute("lat")), 
parseFloat(markers[i].getAttribute("lng")));
                var marker = createMarker(point, name, label, type, detail);
                map.addOverlay(marker);
            }
        });
       
        function createMarker(point, name, label, type, detail) {
           
            var marker = new LabeledMarker(point, {icon: 
pictosFleuveRhone[type]});
            markerGroups[type].push(marker);
            var html = "<strong>" + name + "</strong> <br/>"+detail;
            GEvent.addListener(marker, 'click', function() {
                marker.openInfoWindowHtml(html);
            });
            return marker;  
        }
   
        function showMapCenter() {
            var center = map.getCenter();
            alert(center.toString());
        }
       
        function toggleGroup() {
            var btn=$(this);
            var type=btn.attr('id');
            var css_class=btn.attr('class');
           
            if (css_class == 'actif') {
                btn.removeAttr('class');
            } else {
                btn.addClass('actif');
            }
           
            for (var i = 0; i < markerGroups[type].length; i++) {
                var marker = markerGroups[type][i];
                if (marker.isHidden()) {
                    marker.show();
                } else {
                    marker.hide();
                }
            }
        }  
    }
});



Mike Williams wrote:
> Are you perhaps attempting to re-geocode the locations every time 
> someone opens the page? If so, just stop doing that. Store the lat/lng 
> information in the XML.
>
> If that's not what you're doing, post a link to a page that exhibits the 
> problem.
>
>   


-- 
Cordialement,

Open Wide logo <http://www.openwide.fr>         
*Franck Grenier*
Développeur Web
TMA

        
*Open Wide (Lyon)*
97, rue Racine
69100 LYON-VILLEURBANNE
[email protected] <mailto:[email protected]>

--

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.


<<inline: icoOpenWide.gif>>

Reply via email to