~registry/postgis/trunk

« back to all changes in this revision

Viewing changes to extras/wkb_reader/README

  • Committer: strk
  • Date: 2005-04-15 14:09:20 UTC
  • Revision ID: svn-v4:b70326c6-7e19-0410-871a-916f4a2858ee:trunk:1623
Renamed examples/ to extras/. Added WFS_locks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
This is a very simple example of using binary cursors to move binary data from 
 
2
the server to the client.
 
3
 
 
4
We convert the GEOMETRY to the OpenGIS Well Known Binary (WKB) format before 
 
5
sending it to the client.
 
6
 
 
7
The WKB format contains information about the endian of the data, so it can be
 
8
used for transfer between servers and clients that are not the same endian 
 
9
(ie. between i386 and sparc)
 
10
 
 
11
See http://www.opengis.org/techno/specs/99-049.rtf page 3-24 for the WKB 
 
12
specification.
 
13
 
 
14
Z and M coordinates presence is encoded by or'ing WKBZOFFSET (0x80000000)
 
15
and WKBMOFFSET (0x40000000) to the type.
 
16
Points can then be 24 bytes (XYZ,XYM) or 32 bytes (XYZM)
 
17
 
 
18
You can force geometries to be returned as 2d using the force_2d()
 
19
function. For example:
 
20
 
 
21
  select asBinary(force_2d(geom)) from mytable;
 
22
 
 
23
If the client is running on a i386, you should use asBinary(geom, 'NDR')
 
24
and on a sparc you should use asBinary(geom, 'XDR') so you do not causes
 
25
an endian shift on both the server and client.
 
26