<span class="ul-threaded" style="margin: 0.5em 0pt 0pt -20px;"><span class="text-cell">Hi there!
<br><br>I want to display the content of a shapefile using mapserver
with openlayers. I did it successfully in cases where the layer&#39;s type
is POLYGON but I still don&#39;t know where is the problem to do it when
the layer&#39;s type is LINE.
<br><br>Here are informations about my shapefile displayed with ogr info:<br><br><span style="background-color: rgb(255, 255, 51);">INFO: Open of `C:\ms4w\Apache\htdocs\my_shape_files\shape_ams\EXP_SEGMENT_FONCTIONNEL.shp&#39;
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">using driver `ESRI Shapefile&#39; successful.
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">Layer name: EXP_SEGMENT_FONCTIONNEL
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">Geometry: Line String
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">Feature Count: 6
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">Extent: (633527.743437, 2517184.387950) - (669562.958005, 2556945.272294)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">Layer SRS WKT:
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">(unknown)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">ID_SEGMENT: Real (24.5)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">ID_RESEAU: Real (24.5)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">TYPE_ETB_O: String (5.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">ID_ETB_ORI: Real (24.5)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">TYPE_ETB_E: String (5.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">ID_ETB_EXT: Real (24.5)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">CODE_OUVRA: String (30.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">ID_RAMONAB: Real (24.5)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">CLASSIFICA: String (80.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">LONGUEUR_S: Real (24.5)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">PME: Real (24.5)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">EXPL_DEGS_: String (80.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">COMMENTAIR: String (255.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">PK_INIT: Real (24.5)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">ID_ENTITE_: String (30.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">STATUT_CON: String (1.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">AUTEUR: String (80.0)
</span><br style="background-color: rgb(255, 255, 51);"><span style="background-color: rgb(255, 255, 51);">DATE_DERNI: Date (10.0)</span><br><br>Here is the content of my mapfile:
<br><br><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">MAP
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">  IMAGETYPE      PNG
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">  EXTENT         633527.743437 2517184.387950 669562.958005 2556945.272294
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">  SIZE           400 300
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">  SHAPEPATH      &quot;/ms4w/Apache/htdocs/my_shape_files/shape_ams&quot;
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">  IMAGECOLOR     255 255 255
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">  LAYER
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">    NAME         EXP_SEGMENT_FONCTIONNEL
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">    DATA         EXP_SEGMENT_FONCTIONNEL
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">        STATUS       OFF
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">        TYPE         LINE
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">    STATUS       DEFAULT
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">    CLASS
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">      NAME       &quot;AMS Example&quot;
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">      STYLE
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">        COLOR        0 0 0
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">        OUTLINECOLOR 32 32 32
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">      END
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">    END
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">  END
</span><br style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);"><span style="background-color: rgb(255, 255, 255); color: rgb(255, 102, 102);">END</span><br style="color: rgb(255, 102, 102);"><br>finally here is the content of the html file with the javascript code:<br>
<br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">&lt;html xmlns=&quot;</span><a style="color: rgb(51, 204, 0);" href="http://www.w3.org/1999/xhtml" target="_top" rel="nofollow">http://www.w3.org/1999/xhtml</a><span style="color: rgb(51, 204, 0);">&quot;&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">  &lt;head&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">    &lt;title&gt;MapServer Layer: AMS Example&lt;/title&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">    &lt;script src=&quot;../../lib/OpenLayers.js&quot;&gt;&lt;/script&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">    &lt;script type=&quot;text/javascript&quot;&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">        var map, layer, mybounds;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">        function init(){
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">            map = new OpenLayers.Map(&quot;map&quot;);
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">            layer = new OpenLayers.Layer.MapServer( &quot;Exemple AMS&quot;, &quot;</span><a style="color: rgb(51, 204, 0);" href="http://localhost:8081/cgi-bin/mapserv.exe?map=/ms4w/Apache/htdocs/my_examples_MS/ams_exp.map" target="_top" rel="nofollow">http://localhost:8081/cgi-bin/mapserv.exe?map=/ms4w/Apache/htdocs/my_examples_MS/ams_exp.map</a><span style="color: rgb(51, 204, 0);">&quot;, {layers: &quot;EXP_SEGMENT_FONCTIONNEL&quot;, format: &#39;image/png&#39;, isBaseLayer: false, opacity: 1});
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">            map.addLayer(layer);
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">            mybounds = new OpenLayers.Bounds(633527.743437,2517184.387950,669562.958005,2556945.272294);
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">            map.zoomToExtent(mybounds);
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">            map.addControl( new OpenLayers.Control.LayerSwitcher() );
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">        }
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">    &lt;/script&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">  &lt;/head&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">  &lt;body onload=&quot;init()&quot;&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">    &lt;div id=&quot;title&quot;&gt;MapServer Layer: AMS Example&lt;/div&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">    &lt;div id=&quot;map&quot;&gt;&lt;/div&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">  &lt;/body&gt;
</span><br style="color: rgb(51, 204, 0);"><span style="color: rgb(51, 204, 0);">&lt;/html&gt;</span><br><br>I tried to display this shapefile without using openlayers and
it worked so I guess the problem is in the javascript code probabily
when calling the method <i><b>OpenLayers.Layer.MapServer()</b></i> but when I
tried to debug the code I found no errors! Note that I did the same way
to display other shapefiles content having TYPE POLYGON with openlayers using mapserver and that
worked well so I don&#39;t know what else to do now!
<br><br>Please HELP!
</span></span><br clear="all"><br>-- <br>Abir Rezgui<br>-----------------------<br>Elève Ingénieur à l&#39;Ecole Nationale des Sciences Informatiques ( ENSI )<br>