#1 Fri 10 April 2009 23:16
- keiser1080
- Participant occasionnel
- Date d'inscription: 8 May 2008
- Messages: 13
[mapserver/openlayer/tilecache] tilecache.cfg
saluuut,
j'ai un import d'une carte openstreetmap dans un base postgresql.
j'affiche une carte via mapserver et openlayer.
jusqu'à la pas de problème, à part de gros probleme de performance 15 à 20 secondes pour afficher ma carte.
J'ai donc installer tilecache j'ai tester l'exemple fourni ça marche en modepython sans problème.
mais j'arrive pas à interfacer mapserver openlayer avec tilecache.
Pouvez vous m'aider à addapter mon tilecache.cfg et mon fichier html ???
voici mon fichier html original (qui marche sans tilecache)
Code:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> body { width:100%; height:100%; border: 0px; margin: 0px; padding: 0px; font:sans-serif; font-size:small; } #map { width: 800px; height: 600px; border: 1px solid black; padding: 0px; margin:0px auto; margin-top:30px; position:relative; } </style> <script src="http://www.openlayers.org/api/OpenLayers.js"></script> <script type="text/javascript"> var lon = 16831422; var lat=-4012608; var zoom = 3; var map, layer; function init(){ map = new OpenLayers.Map( 'map' ); var wms = new OpenLayers.Layer.WMS( "WMS", "http://192.168.1.13/cgi-bin/mapserv?", {map: '/var/www/osm2.map', layers: 'default', format: 'aggpng24', transparent: 'off'}, {maxExtent: new OpenLayers.Bounds(11548635,-5889094,18604187,-597430), scales: [5000,10000,25000,50000,100000,250000,500000, 1000000,2500000,5000000,10000000,25000000,50000000,100000000], units: 'm', projection:new OpenLayers.Projection("EPSG:900913"), gutter:0, ratio:1, wrapDateLine: true, isBaselayer:true, singleTile:true, transitionEffect:'resize'} ); map.addLayers([wms]); if(!map.getCenter()) map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); map.addControl(new OpenLayers.Control.Scale('scale')); map.addControl(new OpenLayers.Control.Permalink('permalink')); map.addControl(new OpenLayers.Control.MousePosition()); } </script> </head> <body onload="init()"> <div id="map"> </div> <div id="controls"> <span id="scale" style="float:left"></span> <a href="#" id="permalink" style="float:right">lien direct</a> </div> </body> </html>
et voici mon fichier tilecache.cfg addapter par rapport à mapserver
Code:
[default] type=WMS url=http://127.0.0.1/cgi-bin/mapserv? map=/var/www/osm2.map bbox=11548635,-5889094,18604187,-597430 layers=default srs=epsg:900913 extent_type=loose maxResolutions=0.0013309327968750034 levels=10 extension=png debug=on
Dernière modification par keiser1080 (Fri 10 April 2009 23:17)
Hors ligne
#2 Mon 13 April 2009 01:00
- keiser1080
- Participant occasionnel
- Date d'inscription: 8 May 2008
- Messages: 13
Re: [mapserver/openlayer/tilecache] tilecache.cfg
saluuut,
j'ai fait plusieurs tests mais j'arrive toujours pas à utiliser tilecache avec mapserver et openlayer
j'ai l'erreur suivante
Code:
An error occurred: can't find resolution index for 110.242996. Available resolutions are: [3527.7777777777778, 1763.8888888888889, 881.94444444444446, 352.77777777777777, 176.38888888888889]
mon fichier tilecache
Code:
[default] #type=WMS #url=http://192.168.1.13/cgi-bin/mapserv?map=/var/www/osm2.map type=MapServerLayer mapfile=/map=/var/www/map .map size=256,256 bbox=1695791.5,-495508.15625,1719513.25,-471564.09375 extent_type=loose extension=png layers=landuse_layer1,landuse_layer2,landuse_layer3,landuse_layer4,landuse_layer5,landuse_layer6,railways,highways-far,highways-close,pedestrian_hack,aeroways,tram,building,sports,bridges,oneways,villes resolutions=3527.7777777777777777777777777778,1763.8888888888888888888888888889,881.94444444444444444444444444444,352.77777777777777777777777777778,176.38888888888888888888888888889 #resolutions=93.531494140625,46.7657470703125,23.38287353515625,11.691436767578125,5.8457183837890625,2.9228591918945312,1.4614295959472656,0.73071479797363281,0.36535739898681641 #resolutions=93.531494140625, 46.7657470703125, 23.38287353515625, 11.691436767578125, 5.8457183837890625 levels=5 srs=EPSG:900913
l'url de test
Code:
http://192.168.1.13/tilecache-2.10/tilecache.py?LAYERS=default&FORMAT=aggpng24&TRANSPARENT=off&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&BBOX=1690110.8965088848,-495791.4838683364,1718333.1034911152,-474624.8286316636&WIDTH=800&HEIGHT=600%
pour les resolution j'ai fait le calcul suivant
Code:
256/72*2.54*100000/256=3527.7777777777777777777777777778 256/72*2.54*50000/256= 1763.8888888888888888888888888889 256/72*2.54*25000/256= 881.94444444444444444444444444444 256/72*2.54*10000/256= 352.77777777777777777777777777778 256/72*2.54*5000/256= 176.38888888888888888888888888889
un bout de mon fichier map
Code:
MAP OUTPUTFORMAT NAME agg DRIVER AGG/PNG IMAGEMODE RGB FORMATOPTION "INTERLACE=false" MIMETYPE "image/png" END FONTSET "fonts.lst" IMAGETYPE agg MAXSIZE 4000 #SIZE 800 800 SIZE 256 256 EXTENT 1695791.5 -495508.15625 1719513.25 -471564.09375 UNITS meters IMAGECOLOR "#F5F5F5" WEB METADATA wms_srs "epsg:900913" labelcache_map_edge_buffer "-10" wms_title "osm france" END END CONFIG "PROJ_LIB" "/usr/share/proj" CONFIG "MS_ERRORFILE" "stderr" PROJECTION "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs" END
je comprend pas l'erreur.
pouvez vous m'aider?
Dernière modification par keiser1080 (Mon 13 April 2009 01:02)
Hors ligne
#3 Mon 13 April 2009 04:17
- keiser1080
- Participant occasionnel
- Date d'inscription: 8 May 2008
- Messages: 13
Re: [mapserver/openlayer/tilecache] tilecache.cfg
j'ai modifier mes fichiers mais j'ai tjrs la meme erreur
erreur
Code:
An error occurred: can't find resolution index for 110.242996. Available resolutions are: [35.277758727788061, 17.638879363894031, 8.8194396819470153, 4.4097198409735077, 2.2048599204867538]
map file
Code:
MAP OUTPUTFORMAT NAME agg DRIVER AGG/PNG IMAGEMODE RGB FORMATOPTION "INTERLACE=false" MIMETYPE "image/png" END FONTSET "fonts.lst" IMAGETYPE agg MAXSIZE 4000 #SIZE 800 800 #SIZE 256 256 SIZE 800 600 EXTENT 1695791.5 -495508.15625 1719513.25 -471564.09375 UNITS meters IMAGECOLOR "#F5F5F5" WEB METADATA wms_srs "epsg:900913" labelcache_map_edge_buffer "-10" wms_title "osm france" END END
tilecache.cfg
Code:
[default] type=MapServerLayer mapfile=/map=/var/www/ma.map size=256,256 bbox=1695791.5,-495508.15625,1719513.25,-471564.09375 extent_type=loose extension=png layers=landuse_layer1,landuse_layer2,landuse_layer3,landuse_layer4,landuse_layer5,landuse_layer6,railways,highways-far,highways-close,pedestrian_hack,aeroways,tram,building,sports,bridges,oneways,villes maxResolution=35.277758727788064772222800777465 levels=5 srs=EPSG:900913
javascript
Code:
<script type="text/javascript"> var lon = 1704222; var lat= -485208.15625; var zoom = 5; var map, layer; function init(){ map = new OpenLayers.Map( 'map' ); var wms = new OpenLayers.Layer.WMS( "WMS", "http://192.168.1.13/tilecache-2.10/tilecache.py?", { layers: 'default', format: 'aggpng24', transparent: 'off'}, {maxExtent: new OpenLayers.Bounds(1695791.5,-495508.15625,1719513.25,-471564.09375), scales: [5000,10000,25000,50000,100000], units: 'm', projection:new OpenLayers.Projection("EPSG:900913"), gutter:0, ratio:1, wrapDateLine: true, isBaselayer:true, singleTile:true, transitionEffect:'resize'} ); map.addLayers([wms]); if(!map.getCenter()) map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); map.addControl(new OpenLayers.Control.Scale('scale')); map.addControl(new OpenLayers.Control.Permalink('permalink')); map.addControl(new OpenLayers.Control.MousePosition()); map.addControl(new OpenLayers.Control.ScaleLine()); } </script>
lorsque je rajoute dans mon javascript
Code:
maxResolution : 176.38879363894032386111400388733,
Code:
An error occurred: Current x value 1703516.444825 is too far from tile corner x 1702847.051746
la je suis completement perdu.
meme l'ami google n'est pas bavard .
Dernière modification par keiser1080 (Mon 13 April 2009 04:43)
Hors ligne
#4 Wed 24 June 2009 17:25
- dumaurea24d
- Juste Inscrit !
- Date d'inscription: 23 Jun 2009
- Messages: 1
Re: [mapserver/openlayer/tilecache] tilecache.cfg
Bonjour,
je viens d'avoir le meme probleme je m'en suis sorti en insérant la résolution manquante 110.242996 pour toi
Hors ligne