谷歌地图API最大坐标长度?
这可能听起来很奇怪,但我需要知道 Google 地图 API 中坐标的最大位数是多少。
举个例子,我使用他们的“Web 服务”API 来查找地址,那么最长的纬度/经度数是多少?就像 xxx.xxxxx...
我看到他们在 Web 服务 API 文档中提到了一个 10 位数字(不包括点),但我不知道这是否是最大值?..
就我个人而言,在点返回后我没有看到任何超过 7 位数字的东西,但我知道谷歌至少可以搜索一个看似无穷无尽的坐标。
如果有人确切知道您期望返回的最长坐标是多少,请告诉我。
This may sound weird, but i need to know what the maximum amount of digits in a coordinate in the Google maps API is.
Say for an example, i use their "Web Services" API to find an address, then what is the longest possible lat/lng number? like xxx.xxxxx...
I see them referring to a 10 digit number (not counting the dot) in their documentation for the web services api, but i don't know if that's the max?..
Personally i haven't seen anything more than 7 digits after the dot returned, but i know google can at least search for a seemingly endless coordinate.
If anyone knows for sure what the longest coordinate you can expect returned is, please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SQL 方面:
纬度/经度应使用 FLOAT/DOUBLE 精度。
绝对不建议使用例如 VARCHAR(20),因为数字比较肯定会失败。
API 方面:
同样适用于 Maps JS API;
关于各种数据API,我不确定(并且没有时间测试)
(可能只是精度降低/接近...)
PHP 手册 - 浮点数:
更新 只是无缘无故地被否决(5年后)(很可能是由无法理解的人)......而较新版本的 mySQL 甚至具有 Point 数据类型,为了表示坐标...仍然是 API 明智的,数据始终以
String
形式发布。SQL-wise:
Latitude/Longitude should use FLOAT/DOUBLE precision.
It's definitely not recommend to use e.g. VARCHAR(20) because numeric comparisons would fail for sure.
API-wise:
Same applies for the Maps JS API;
about the various Data-APIs I'm not sure (and have no time to test that)
(probably just precision-reduction/proximity...)
PHP Manual - Floating point numbers:
update just being down-voted (5 years later) without a reason (most likely by someone, who failed to comprehend)... while newer versions of mySQL even feature a Point datatype, in order to represent coordinates... still API wise, the data is always posted as
String
.