[Shapelib] Delete or hide Shape from Shapefile

Frank Warmerdam warmerdam at pobox.com
Tue May 12 09:03:26 EST 2009


Jelmer Baas wrote:
> Hello,
> 
> I'm looking for a way to remove or hide a shape in a shape file. I'm
> using MapServer to draw it, so it needs to be supported by MapServer,
> too. 
> 
> The PDF found on the shapelib page shows there's a shapetype 0 (Null
> Shape), can't that somehow be used? Otherwise overwrite the style to
> have a width of 0, something like that? I find it hard to believe that
> ESRI apps rewrite the entire file when a single object is deleted... 
> 
> Despite already finding evidence that it's not possible
> (http://lists.maptools.org/pipermail/shapelib/2004-May/000074.html), I
> wanted to ask it nonetheless.

Jelmer,

The normal approach to this is to call DBFMarkRecordDeleted() which flips
the bit in the DBF file marking a record as deleted.  However, I see no
evidence that the MapServer native shapefile code checks the deleted
marker so this isn't likely to help you with MapServer.

I think replacing the shape with a SHPT_NULL shape is the next best
alternative.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the Shapelib mailing list