Hello everybody ! I'm trying to use OpenLayers on my own WMS Server. At the beginning, I was using OpenLayers without any TileCache. Everything was works quite well. Here you can see what was the result:
http://demo3.kheops-tech.com:8080/site_jmap/montreal.html and here is a sample of source code: <script type="text/javascript"> <!-- function init(){ var minx = 264875.53709076217; var miny = 5028255.887191531;; var maxx = 311635.1585273513; var maxy = 5065756.947977615; var map = new OpenLayers.Map( $('map'), {maxExtent: new OpenLayers.Bounds(minx,miny,maxx,maxy), maxResolution: "auto", projection: "EPSG:32188"}); map.addLayers( [new OpenLayers.Layer.WMS( "Montreal","../mtlwms/wms?", {layers: "", format: "image/gif"}, {isBaseLayer: "true", maxResolution: 'auto'}) ]); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.zoomToMaxExtent(); } // --> </script> As you can see, I was using a different projection than default, I was with EPSG:32188. Then we decided to use TileCache for improving the first version. Because we were using a TomCat server; we started by using TileCacheAsJavaServlet. This is a Servlet implementation of TileCache 1.4 with jython. TileCache is unchanged. With is downloadable here: http://www.resc.rdg.ac.uk/twiki/bin/view/Resc/TileCacheAsJavaServlet We first installed it and tried with a WMS showing world map from our WMS server. After a few fixes of our WMS implementation on our server, this works well. So our WMS server is compatible with TileCache. Next, I tried to use TileCache with the first layer that I used before, here I had my first problems. My first mistake was to not specify bbox on my tilecache.cfg and also to not specify maxExtend and maxResolution for my Openlayers html file 'index.html' [montreal] type=WMSLayer url=http://demo3.kheops-tech.com:8080/mtlwms/wms? extension=png srs=EPSG:32188 layers=Topographie <script defer="defer" type="text/javascript"> var map = new OpenLayers.Map( $('map'), {projection: "EPSG:32188"}); var wms = new OpenLayers.Layer.WMS( "JMAP WMS", "http://localhost:8080/TileCache", {layers: 'montreal', format: "image/png"}); map.addLayer(wms); map.zoomToMaxExtent(); </script> Here TileCache worked well, it loads Tiles from my WMS Server, but they were white because they were not on place were we can see datas. You can try this code, the WMS server is online ;) So my next try is about specifing bbs on tilecache.cfg and maxResolution and maxExtend on index.html Now I have [montreal] type=WMSLayer url=http://demo3.kheops-tech.com:8080/mtlwms/wms? extension=png bbox=264875.54,5028255.89,311635.16,5065756.95 srs=EPSG:32188 layers=Topographie Here I have questions, are the bbox values in the same unit as my projection ? That is to say EPSG:32188 ? And I have as index.html -> <html> <head> <script src="OpenLayers-2.3.js"></script> </head> <body> <div style="width:100%; height:100%" id="map"></div> <script defer="defer" type="text/javascript"> var min_x = 264875.54; var min_y = 5028255.89; var max_x = 311635.16; var max_y = 5065756.95; var map = new OpenLayers.Map( $('map'), {maxExtent: new OpenLayers.Bounds(min_x,min_y,max_x,max_y), maxResolution: 91.327 ,projection: "EPSG:32188"}); var wms = new OpenLayers.Layer.WMS( "wms", "http://localhost:8080/TileCache", {layers: 'montreal', format: "image/png"}); map.addLayer(wms); if (!map.getCenter()) map.zoomToMaxExtent(); </script> </body> </html> When I'm tring to see a Tile i've got error at: http://localhost:8080/TileCache/?LAYERS=montreal&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A32188&BBOX=276565.396%2C5051635.602%2C288255.252%2C5063325.458&WIDTH=256&HEIGHT=256 Exception: couldn't calculate tile index for layer montreal from ([276565.396, 5051635.602, 288255.252, 5063325.458]) I don't understand there are not the values that I specified :( I have got also a question about the maxResolution we told me on IRC that it is in map unit/pixel. So I calculate my maxResolution like this: (max_x - min_x) / ( 2 * each_tile_size) = (311635.16 - 264875.54) / (2 * 256) This means, I think, map is shown in two tiles. The bounds where found from the BoundingBox element from the GetCapabilities XML File. You can check this XML file from: http://demo3.kheops-tech.com:8080/mtlwms/wms?SERVICE=WMS&VERSION=1.3.0&request=GetCapabilities My aim is just to use our WMS Layer with TileCache. Thanks a lot for your help, Kevin Emamirad _______________________________________________ Dev mailing list [email protected] http://openlayers.org/mailman/listinfo/dev
