[postgis-users] Change in WKB format between V 0.7.5 and V 0.8.1?

David Blasby dblasby at refractions.net
Wed Feb 11 10:25:45 PST 2004


Richard Taylor wrote:
> I look after a Python WKB parser and noticed that the mask required for 
> deciding whether a geometry is 2d or 3d has changed from 0x8000 to 
> 0x80000000.
> 
> Was this change documented anywhere? Are there any other changes to the WKB 
> format that might cause a problem to the parser. Is there a version flag that 
> I can check to test which of the mask values I should be useing?

Yes, I did change the "3d" WKB flag to 0x80000000.  The original postgis 
version followed OGR and used 0x8000.  This was later found to be 
incorrect and changed to the "correct" 0x80000000 in OGR.

There were several discussion on the mailing list WRT to this.

If you want your postgis to use the the old number, just change this 
line (near the top of postgis_inout.c):

#define WKB3DOFFSET 0x80000000

I would recommend you change your parser to use the 0x80000000 value. 
If you want to support both version, you could just do something like:

if (WKB_type > 1000)
{
	is_3d = true;
	WKB_type = (WKB_type & 0xFF);
}
else
{
	is_3d = false;
	// WKB_type is properly set
}




More information about the postgis-users mailing list