Best way to populate a geometry table?
Posted by: Koen Mannaerts
Date: January 11, 2007 03:40AM

Hi all,

These are my first days with a GIS capable database, so bear with me.
I'd like to add a LineString geometry to a table, from .NET:

// MySqlCommand cmdInsert
// byte[] wkbBytes
...
// Fails in the end:
cmdInsert.CommandText = "INSERT INTO tracks (track) VALUES(GeomFromWKB(@track))";
cmdInsert.Parameters.Add("@track", MySqlDbType.Blob);
cmdInsert.Parameters["@track"].Value = wkbBytes; // Pass WKB as a byte array
...

Yet passing the WKB as a set of bytes this way does not work. The track column does not get populated. I'm not sure what type /would/ work.
When I construct the query on the fly, inserting the hex representation of the WKB in the query, everything's fine.

// Fine:
cmdInsert.CommandText = "INSERT INTO tracks (track) VALUES(GeomFromWKB(0x01020000000...1040))";

Yet I'd like to pass the WKB as a parameter: eventually the query will be a stored procedure.
Anything I fail to see?

Thanks heaps,
Koen

Options: ReplyQuote


Subject
Written By
Posted
Best way to populate a geometry table?
January 11, 2007 03:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.