null shapes (was Re: WIP-pyshapelib-Unicode issues)

Bram de Greve bram.degreve at gmail.com
Tue Jan 15 15:41:39 CET 2008


Bernhard Reiter wrote:
> On Monday 14 January 2008 16:19, Bram de Greve wrote:
>   
>> Oh, I was under the assumption you were talking about shapefiles
>> _without_ records =)
>>
>> "cool, I saw some of the commits happening, but hunted the /empty shape
>> file/ problem. (Does somebody know, btw, if such a shape file is
>> legitimate at all?)" [emphasis is mine]
>>     
>
> Ah, sorry for the confusion. At least we've got it clarified.
>
>   
>> At the bottom of page 5 of the specs
>> (http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf), it states:
>>
>> "A shape type of 0 indicates a null shape, with no geometric data for
>> the shape.  Each feature type (point, line, polygon, etc.) [this would
>> be the type of the /file/, Bram] supports nulls - it is valid to have
>> points and null points in the same shapefile."
>>
>> So, yes, the example shapefile is legitimate. There are actually 109
>> null shapes in that file (on 4962 shapes in total).
>>     
>
> Very good to know! Thanks a lot for looking this up!
> I guess we should produce an example shapefile having one null element
> and one with points and add a unittest based on this file.
> Is it easy to create such a shapefile with shapelib?
>   
I would guess so.

I've skimmed over the source code, and it should give no problems at
all.  Just create a null shape as following:

obj = shapelib.SHPObject(shapelib.SHPT_NULL, -1, [])

and add it to the shapefile.

Bramz


>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Thuban-devel mailing list
> Thuban-devel at intevation.de
> https://intevation.de/mailman/listinfo/thuban-devel
>   




More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)