2

how can i store my coordinates in wkb.. i want to know its implementation of wkb and wkt in db .. any one can please guide me.

5

http://dev.mysql.com/doc/refman/5.0/en/gis-wkb-format.html

For example, a WKB value that corresponds to POINT(1 1) consists of this sequence of 21 bytes (each represented here by two hex digits):

0101000000000000000000F03F000000000000F03F

The sequence may be broken down into these components:

Byte order : 01
WKB type   : 01000000
X          : 000000000000F03F
Y          : 000000000000F03F
  • WKB uses one-byte unsigned integers, four-byte unsigned integers, and eight-byte double-precision numbers (IEEE 754 format).. – tina Nov 24 '10 at 4:26
  • than how it consist on the sequence of 21 Bytes .. for point and same as line.. – tina Nov 24 '10 at 4:27
  • WKB uses one-byte unsigned integers, four-byte unsigned integers, and eight-byte double-precision numbers (IEEE 754 format.. than for this case:POINT(1 1) consists of this sequence of 21 bytes (each represented here by two hex digits)..how it consist of 21 sequence of Bytes and what will be the sequence of line in form of Bytes... – tina Nov 24 '10 at 4:31
2

Two notes about Well-Known Binary (WKB):

  • If you are using a spatial enabled database, it will likely be able to perform conversions from Well-Known Text to WKB. For instance, in PostGIS this can by done with something like this: "SELECT encode(ST_AsBinary(ST_GeomFromText('POINT(1 1)', -1)), 'hex');" (-1 means no projection system)
  • As Mapperz said in his response, WKB has a byte indicating the byte order storage. The WKB representation of a geometry is system endianness dependent. Thus, any geometry will have two possible WKB representations depending on system endianness.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.