Hi,<br><br>I'm adding a GML file in my map with the object OpenLayers.Layer.GML. I'm trying to zoom to this layer extent at map's loading. I can do this if I know de bounding box coordinates with a postgis query.<br>
<br>My PHP code :<br><br> var bounds = new OpenLayers.Bounds();<br> bounds.extend((new OpenLayers.LonLat(<?=$xmin?>,<?=$ymin?>)).transform(wgs84, map.getProjectionObject()));<br> bounds.extend((new OpenLayers.LonLat(<?=$xmax?>,<?=$ymax?>)).transform(wgs84, map.getProjectionObject()));<br>
bounds.toBBOX();<br> map.zoomToExtent(bounds);<br><br>But this requires a server call and I want my map to use only datas in the GML file and not to have to connect to a database.<br><br>I have seen that GML files includes bounded box informations like :<br>
<br> <gml:boundedBy><br> <gml:Box><br> <gml:coord><gml:X>1.473839004763629</gml:X><gml:Y>43.43941299999661</gml:Y></gml:coord><br> <gml:coord><gml:X>1.647671004707115</gml:X><gml:Y>43.58098800002078</gml:Y></gml:coord><br>
</gml:Box><br> </gml:boundedBy> <br><br>Is it possible the get the gml extent to be able to automaticaly zoom on it at loading ?<br><br>Thanks,<br>Christophe<br>