#1 Tue 21 February 2012 10:47
- frangin2003
- Juste Inscrit !
- Date d'inscription: 21 Feb 2012
- Messages: 2
[OpenLayers 2.11][MapServer 5.6.6] Tuiles décalées
Bonjour à tous, je me présente, je suis développeur.
Je travaille actuellement à la mise en place d'OpenLayers (2.11) et de MapServer (5.6.6). Je rencontre le problème suivant:
[img]http://frangin2003.free.fr/sig/pb.png[/img]
Comme le montre l'image, mes tuiles sont décalées, partiellement répétées d'une tuile à l'autre. Le phénomène s'amplifie au fur et à mesure que l'on dézoome, jusqu'à avoir deux fois côte à côte ma limite parcellaire.
1|2|3
-+-+-
4|5|6
Les URLs de chaque tuiles sont les suivantes:
1:http://localhost/cgi-bin/mapserv.exe?map=C%3A%2Fmapfile.map&layers=Limite_communale&projection=epsg%3A27592&displayProjection=epsg%3A27592&mode=map&map_imagetype=png&mapext=4.54833984375+46.175537109375+4.559326171875+46.1865234375&imgext=4.54833984375+46.175537109375+4.559326171875+46.1865234375&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
2:http://localhost/cgi-bin/mapserv.exe?map=C%3A%2Fmapfile.map&layers=Limite_communale&projection=epsg%3A27592&displayProjection=epsg%3A27592&mode=map&map_imagetype=png&mapext=4.559326171875+46.175537109375+4.5703125+46.1865234375&imgext=4.559326171875+46.175537109375+4.5703125+46.1865234375&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
3:http://localhost/cgi-bin/mapserv.exe?map=C%3A%2Fmapfile.map&layers=Limite_communale&projection=epsg%3A27592&displayProjection=epsg%3A27592&mode=map&map_imagetype=png&mapext=4.5703125+46.175537109375+4.581298828125+46.1865234375&imgext=4.5703125+46.175537109375+4.581298828125+46.1865234375&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
4:http://localhost/cgi-bin/mapserv.exe?map=C%3A%2Fmapfile.map&layers=Limite_communale&projection=epsg%3A27592&displayProjection=epsg%3A27592&mode=map&map_imagetype=png&mapext=4.54833984375+46.16455078125+4.559326171875+46.175537109375&imgext=4.54833984375+46.16455078125+4.559326171875+46.175537109375&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
5:http://localhost/cgi-bin/mapserv.exe?map=C%3A%2Fmapfile.map&layers=Limite_communale&projection=epsg%3A27592&displayProjection=epsg%3A27592&mode=map&map_imagetype=png&mapext=4.559326171875+46.16455078125+4.5703125+46.175537109375&imgext=4.559326171875+46.16455078125+4.5703125+46.175537109375&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
6:http://localhost/cgi-bin/mapserv.exe?map=C%3A%2Fmapfile.map&layers=Limite_communale&projection=epsg%3A27592&displayProjection=epsg%3A27592&mode=map&map_imagetype=png&mapext=4.5703125+46.16455078125+4.581298828125+46.175537109375&imgext=4.5703125+46.16455078125+4.581298828125+46.175537109375&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
Voici le code HTML qui me sert à afficher la carte:
Code:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> #map { width: 800px; height: 475px; border: 1px solid black; } </style> <script src="js/OpenLayers-2.11/OpenLayers.js"></script> <script type="text/javascript"> <!-- var map, layer; function init(){ map = new OpenLayers.Map('map'); layer = new OpenLayers.Layer.MapServer( "World Map", "http://localhost/cgi-bin/mapserv.exe", {map: 'C:/mapfile.map', layers:'Limite_communale', projection: new OpenLayers.Projection("epsg:27592"), displayProjection: new OpenLayers.Projection("epsg:27592") } ); map.addLayer(layer); map.zoomToMaxExtent(); } // --> </script> </head> <body onload="init()"> <div id="map"></div> </body> </html>
Le mapfile:
Code:
MAP EXTENT 765403.55587 131932.033381 773069.378879 136994.883804 FONTSET "../fonts/fonts.txt" TEMPLATEPATTERN "Démo" IMAGECOLOR 237 237 230 IMAGETYPE AGGA SYMBOLSET "../symbols/symbols.sym" SHAPEPATH "../layers" SIZE 1126 883 STATUS ON TRANSPARENT FALSE UNITS METERS NAME "DEMO" OUTPUTFORMAT NAME "AGGA" MIMETYPE "image/jpeg" DRIVER "AGG/JPEG" EXTENSION "jpg" IMAGEMODE "RGB" TRANSPARENT FALSE FORMATOPTION "INTERLACE=ON" FORMATOPTION "QUALITY=80" END PROJECTION "init=epsg:27592" END LEGEND IMAGECOLOR 255 255 255 KEYSIZE 22 16 KEYSPACING 5 3 LABEL ANGLE 0.000000 ANTIALIAS TRUE FONT "verdana" MAXSIZE 256 MINSIZE 4 SIZE 7 TYPE TRUETYPE BUFFER 0 COLOR 0 0 0 FORCE FALSE MINDISTANCE -1 MINFEATURESIZE -1 OFFSET 0 -4 PARTIALS TRUE END POSITION LL STATUS ON TRANSPARENT FALSE END QUERYMAP COLOR 255 255 0 SIZE -1 -1 STATUS OFF STYLE HILITE END REFERENCE COLOR -1 -1 -1 EXTENT 765403.55587 131932.033381 773069.378879 136994.883804 IMAGE "reference.jpeg" OUTLINECOLOR 200 0 0 SIZE 154 96 STATUS ON MARKER 0 MARKERSIZE 0 MINBOXSIZE 3 MAXBOXSIZE 0 END SCALEBAR ALIGN CENTER BACKGROUNDCOLOR 128 128 128 COLOR 0 0 0 IMAGECOLOR 237 237 230 INTERVALS 4 LABEL SIZE MEDIUM TYPE BITMAP BUFFER 0 COLOR 0 0 0 FORCE FALSE MINDISTANCE -1 MINFEATURESIZE -1 OFFSET 0 0 PARTIALS TRUE POSITION CR END POSITION LR SIZE 170 2 STATUS ON STYLE 0 TRANSPARENT TRUE UNITS METERS END WEB IMAGEPATH "" IMAGEURL "" LOG "log.dat" QUERYFORMAT text/html LEGENDFORMAT text/html BROWSEFORMAT text/html END LAYER CONNECTION "user=postgres password=postgres dbname=db_carto host=localhost port=5432" CONNECTIONTYPE POSTGIS DATA " the_geom from (select * from postgis_limitecommune) as foo USING UNIQUE gid SRID=27592" LABELITEM "nom" LABELMAXSCALEDENOM 50000 LABELMINSCALEDENOM 25000 METADATA "TYPE_LEGENDE" "0" "POSTGIS_NAME" "postgis_limitecommune" END NAME "Limite_communale" PROJECTION "init=epsg:27592" END STATUS ON TEMPLATE "ttt" TYPE POLYGON UNITS METERS CLASS NAME "Limite communale" STYLE ANGLE 360 COLOR 255 255 255 OPACITY 0 SIZE 1 SYMBOL "default-marker" WIDTH 1 END STYLE ANGLE 360 OUTLINECOLOR 0 96 48 SIZE 3 SYMBOL "mapinfo-pen-2" WIDTH 1 END LABEL ANGLE 0.000000 ANTIALIAS TRUE FONT "arial_black" MAXSIZE 256 MINSIZE 4 SIZE 9 TYPE TRUETYPE BACKGROUNDSHADOWSIZE 0 0 BUFFER 0 COLOR 0 0 0 FORCE FALSE MINDISTANCE -1 MINFEATURESIZE -1 OFFSET 0 0 OUTLINECOLOR 255 255 255 PARTIALS TRUE POSITION CC END END END END
J'ai essayé avec et sans déclarer la projection dans les options de ma couche, rien ne change.
Merci d'avance pour votre aide.
Hors ligne
#2 Tue 21 February 2012 11:19
- tbonfort
- Participant actif
- Date d'inscription: 11 Oct 2007
- Messages: 87
Re: [OpenLayers 2.11][MapServer 5.6.6] Tuiles décalées
Les layers de type MapServer ne sont pas a recommander dans OpenLayers, utilises plutot un layer de type WMS. Il te faudra aussi adapter legerement ton mapfile pour autoriser les acces WMS, dans WEB:
Code:
metadata "ows_srs" "EPSG:4326 EPSG:27592" #liste des projections autorisées "ows_title" "ma carte" end
--
thomas
Hors ligne
#3 Wed 22 February 2012 09:12
- frangin2003
- Juste Inscrit !
- Date d'inscription: 21 Feb 2012
- Messages: 2
Re: [OpenLayers 2.11][MapServer 5.6.6] Tuiles décalées
Merci bien, effectivement en WMS ça marche déjà beaucoup mieux.
Hors ligne