Hello everybody,
I am student in training course, i have to develop a Web application witch show pictures provided by a geoserver. I don't have a very good knowledge of geoserver, I wonder if you know a method allowing to recover the longitude and latitude of the site of a chart from the geoserver (by wms), in order to be able to post it.
Thank you in advance!
My source code (in this case, I writed the longitude and the lattitude, but I would like change it):
<script type="text/javascript">
var lon = -60;
var lat = 21.13;
var zoom = 8;
var maDiv, layer, dep;
function init(){
maDiv = new OpenLayers.Map('map');
dep = new OpenLayers.Layer.WMS("test", "MyServer/geoserver/wms?",
{layers:"MyChart", transparent: "false", format: "image/png"} );
maDiv.addLayer(dep);
maDiv.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
</script>
Hi,
You could call map.zoomToExtent(), however, I think you will just get the full bounds of the lat lon. I believe layer has a method called getExtent(), so you could call map.zoomToExtent( layer.getExtent() ). However I have never actually tried this.
You will probably get a better answer on the openlayers list.
-Justin
g.ecra@anonymised.com wrote:
Hello everybody,
I am student in training course, i have to develop a Web application witch show pictures provided by a geoserver. I don't have a very good knowledge of geoserver, I wonder if you know a method allowing to recover the longitude and latitude of the site of a chart from the geoserver (by wms), in order to be able to post it. Thank you in advance! My source code (in this case, I writed the longitude and the lattitude, but I would like change it):
<script type="text/javascript">
var lon = -60;
var lat = 21.13;
var zoom = 8;
var maDiv, layer, dep;
function init(){
maDiv = new OpenLayers.Map('map');
dep = new OpenLayers.Layer.WMS("test", "MyServer/geoserver/wms?",
{layers:"MyChart", transparent: "false", format: "image/png"} );
maDiv.addLayer(dep);
maDiv.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}
</script>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org