Michael Logutov wrote:So, how do I convert lat, lng values into WKB and back?
If you use a column of a spatial type, the data in this column is stored as a set of bytes in a binary format. If you perform a SELECT statement for this column, you will get this binary data. After this you may process this binary data in your application. For example, you may create a custom class that accepts this binary data to its constructor, parse it and assign corresponding values for the fields. Then you may work with this class, and after this convert data back to the binary format and store it to the database table.
You can also get the necessary fields with a query using the functions, creating geometry values using WKB. The list of such functions you can find in the MySQL documentation
http://dev.mysql.com/doc/refman/4.1/en/ ... tions.html
For example, suppose you have the following table:
SQL script:
Code: Select all
CREATE TABLE semenb.test_point (
t1 point DEFAULT NULL
);
INSERT INTO semenb.test_point(t1)
VALUES(PointFromText('POINT(1 1)'));
You can use MySQL functions for spatial types to get textual information on the POINT type coordinates. For example, you can use the following query:
Code: Select all
SELECT x(PointFROMWKB(t1)) AS X, y(PointFROMWKB(t1)) AS Y FROM test_point
Michael Logutov wrote:Is there some kind of OpenGIS .NET library that provides the types serializable in WKB format?
dotConnect for MySQL does not provide such a feature. Probably there are .NET libraries that provide the types serializable in WKB format, but this question is beyond the scope of our support.
Michael Logutov wrote:Or is there a way to convert System.Device.Location.GeoCoordinate to WKB and back?
GeoCoordinate class belongs to the System assembly, so please contact the Microsoft support on this question.