[DB-SIG] thoughts about OpenGIS extensions

Mario Frasca mfrasca at zonnet.nl
Tue Oct 3 16:44:45 CEST 2006

Hallo Andy

On 2006-1003 10:24:42, Andy Dustman wrote:
> http://dev.mysql.com/doc/refman/5.0/en/supported-spatial-data-formats.html
> I think these are OpenGIS formats.

yes and no: 

these are the formats returned by the translation functions asBinary
and asText.  both take a geometry object and return a representation
in a 'well known' format, which are both different from the internal

a small python interaction to show the difference (from the mysql client
you don't see anything) (I'm forcing geomFromText(...) to create a
geometry object on the fly)

>>> cr.execute("select geomFromText('POINT(34214.3412 34214.3412)')")
>>> cr.description
(("geomFromText('POINT(34214.3412 34214.3412)')", 253, 25, 8192, 8192, 0, 0),)
>>> cr.fetchone()
('\x00\x00\x00\x00\x01\x01\x00\x00\x00-C\x1c\xeb\xca\xb4\xe0 at -C\x1c\xeb\xca\xb4\xe0@',)
>>> cr.execute("select asBinary(geomFromText('POINT(34214.3412 34214.3412)'))")
>>> cr.description
(("asBinary(geomFromText('POINT(34214.3412 34214.3412)'))", 253, 21, 8192, 8192, 0, 0),)
>>> cr.fetchone()
('\x01\x01\x00\x00\x00-C\x1c\xeb\xca\xb4\xe0 at -C\x1c\xeb\xca\xb4\xe0@',)

is the fact that the description field has the same '253' value for both
internal and wkb formats going to be a problem?  if I was _using_
mysqldb, I don't see a chance to distinguish the two things.  but maybe
_inside_ of mysqldb the distinction is made somehow.

ah, well, you do see that the internal binary representation is
different from the wkb one...

as a user and even more as a library writer, I would not want to have
to write a 'asBinary(<field>)' for each of my geometric fields.


everything done. Thank you for downloading a media file containing
proprietary and patentend technology.

More information about the DB-SIG mailing list