Using MySQL GeoSpatial data types in .NET

谁说胖子不能爱 提交于 2019-12-11 01:30:03

问题


I'm looking for information on how to use MySQL geometry types in .NET. I'm using Sub-sonic for ORM and don't really need to support much more than MySQL's POINT type.

The MySQL .NET connector seems to return point data as a byte[] array in the OpenGIS WKB format.

  • What libraries are recommended for working with this WKB format?

  • Alternatively, since I only need support for Point, examples on converting WKB to/from a .NET type would probably suffice.

  • Assuming I can find (or build) a class that can handle the Point data type, how much trouble am I going to have getting Sub-sonic (v3) to work with it?


回答1:


Check out the OpenSource GeoAPI.Net - http://geoapi.codeplex.com

This has .NET classes for all geometry types and a number of tools to convert to these from other types such as WKB. Look at the sourcecode for version 2.11a src > GeoAPI > IO > WellKnownBinary. There are readers / writers / parsers etc.

GeoAPI.Net is used in a number of projects such as http://sharpmap.codeplex.com which have more complex spatial operations using the GeoAPI.Net types. http://code.google.com/p/nettopologysuite/ also uses thse classes so you will have a wide range of powerful operations to use on the classes if needed.

I know nothing about Sub-sonic, but as the Point classes / interface are fairly standard .NET I don't see why this sould cause any problems. You can always have a look at the source online to check.



来源:https://stackoverflow.com/questions/2371275/using-mysql-geospatial-data-types-in-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!