[OpenLayers-Users] getDataExtent() only working on part of data of layer

Jan Martin janmartin3 at googlemail.com
Thu Jun 11 11:20:50 EDT 2009


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);
            };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090611/e1e742a9/attachment.html


More information about the Users mailing list