Ticket #3487 (new defect)
Regression in 5.6.4 regarding handling of NullShapes
| Reported by: | woodbri | Owned by: | sdlime |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | MapServer C Library | Version: | 5.6 |
| Severity: | normal | Keywords: | |
| Cc: | dmorissette, jmckenna |
Description
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@carto:/u/data/leaddog$ dbfdump tidx-lw.dbf > bbb woodbri@carto:/u/data/leaddog$ vi bbb woodbri@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@carto:/u/software/mapserver-5.6.4$ diff -Naur mapdraw.c mapdraw.c-orig
--- 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)) {
msFreeShape(&shape);
continue;
}

