[mapserver-dev] Regression in 5.6.4

Stephen Woodbridge woodbri at swoodbridge.com
Sat Jul 10 12:02:37 EDT 2010

I'm not sure when this regression crept in because I'm converting a lot 
of older apps over to use 5.6.4. But on 5.2.2 I could draw a layer with 
NullShape items in a shapefile without a problem and on 5.6.4 it dies 
with a general error message.

msDrawMap(): Image handling error. Failed to draw layer named 'Linear 
Water'. msDrawShape(): General error message. Only polygon or line 
shapes can be drawn using a line layer definition.

In general, since mapserver is designed for drawing data and not 
validating it or being a GIS system in general. I think we should just 
step over these records. If we want to be more helpful AND the user has 
DEBUG truned on than it would be helpful to say what file and what 
record is a NullShape.

I have a huge tileindex that I converted to script like:
# shpdump ./afghanistan_p/major_roads/aflw | grep Shape:
with 128 files and anyones guess on the number of records.

woodbri at carto:/u/data/leaddog$ dbfdump tidx-lw.dbf > bbb
woodbri at carto:/u/data/leaddog$ vi bbb
woodbri at carto:/u/data/leaddog$ sh bbb | grep -v Arc
Shape:0 (NullShape)  nVertices=0, nParts=0
Shape:1 (NullShape)  nVertices=0, nParts=0

Here is a patch that seems to fix this:

woodbri at carto:/u/software/mapserver-5.6.4$ diff -Naur mapdraw.c 
--- mapdraw.c   2010-07-10 11:53:17.000000000 -0400
+++ mapdraw.c-orig      2010-07-10 11:57:27.000000000 -0400
@@ -964,7 +964,7 @@
    while((status = msLayerNextShape(layer, &shape)) == MS_SUCCESS) {

        shape.classindex = msShapeGetClass(layer, &shape, 
map->scaledenom, classgroup, nclasses);
-    if((shape.type == MS_SHAPE_NULL) || (shape.classindex == -1) || 
(layer->class[shape.classindex]->status == MS_OFF)) {
+    if((shape.classindex == -1) || 
(layer->class[shape.classindex]->status == MS_OFF)) {


-Steve W

More information about the mapserver-dev mailing list