我应该使用什么类型的数据库模式来存储和处理地理位置数据?
我正在创建一个应用程序来存储特定交易的地理位置数据。我应该存储一个简单的纬度/经度还是有更优选的标准?我应该使用哪些数据类型以便将来切换到 NoSQL?
I'm creating an application that will store geolocation data for specific transactions. Should I store a simple lat/long or is there a more preferred standard? What datatypes should I use to allow for switching to NoSQL in the future?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
忘记 NoSQL - 学习使用数据库或雇用可以使用数据库的人。大多数 NoSql“主张”都是由那些在精神上无法正确使用数据库的人提出的。
使用特殊数据类型。不确定 MySQL - 但 MS SQL Server 在 2008 服务器中添加了几何/地理位置数据。这并不像拥有数据类型那么容易,因为查询背后的逻辑以及如何构建索引必须位于数据库引擎中才能真正高效。特别是点的二维索引和处理“形式”并不是在后续步骤中轻松有效地添加的内容。
Forget about NoSQL - learn to use database or hire someone who can. Most NoSql "propositions" are by people mentally not getting around proper use of databases.
Use special data types. Not sure about MySQL - but MS SQL Server added geometry / geolocation data with 2008 server. It is not as easy as having a data type, as the logic behind queries and how to build indices MUST be IN the database engine to be really efficient. Espeically the two-dimensional indices of a point and handling "forms" is not something easil and effectivel added in a post-step.
世界大地测量标准被广泛使用。最新版本是WGS84。这是全球定位系统等使用的坐标系。
许多数据库都有自定义数据类型来处理空间数据。如果您的数据库就是这种情况,您可能会考虑使用它们来存储坐标。否则,坐标可以存储为纬度/经度。有几个开源库可用于在各种坐标系之间进行转换,因此如果您稍后需要切换,您应该能够轻松地转换数据。
The World Geodetic Standard is widely used. The latest revision is WGS84. This is the coordinate system used by the Global Positioning System, among others.
Many databases have custom data types for dealing with spatial data. If this is the case with your database, you might consider using these for storing coordinates. Otherwise, coordinates may be stored as latitude/longitude. There are several open source libraries available for converting between various coordinate systems, so you should be able to convert your data without too much hassle if you need to switch later on.