Hi all,

right now getDataExtent() only considers the data added LAST (red).
But I need the map to zoom in on ALL data in lgpx (green AND red).

What's my error?

Thanks,
Jan

       lgpx = new OpenLayers.Layer.GML
("green","separated/20090607172151.gpx",{

                    projection: new  OpenLayers.Projection("EPSG:4326"),
                    style: {strokeColor: "green", strokeWidth: 5,
strokeOpacity: 0.8},
                    format: OpenLayers.Format.GPX,});
    map.addLayer(lgpx);

       lgpx = new OpenLayers.Layer.GML
("red","separated/20090607110550.gpx",{

                    projection: new  OpenLayers.Projection("EPSG:4326"),
                    style: {strokeColor: "red", strokeWidth: 5,
strokeOpacity: 0.8},
                    format: OpenLayers.Format.GPX,});
    map.addLayer(lgpx);

                if( ! map.getCenter() ){
            lgpx.events.register('loadend', lgpx,
function(){map.zoomToExtent(lgpx.getDataExtent())});
            map.setCenter(null, null);
            };
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to