Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

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
share|improve this answer
    
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
add comment

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.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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