I am trying to store lattitude and longtitude (which is produced by Drawing API) in the mysql database as a spatial datatype. Spatial Datatype supports 15 digit precision in mysql.

According to my usecase, I have to store the exact digit precision in the database. So I need a clarification whether google maps drawing API v3 will produce more than 15 digit precision ? ( I have seen it once with 16 digit precision, After that I am not getting it anymore). Any help is much appreciated.

有帮助吗?

解决方案

There is a difference between "number of digits used to represent a value" and the "number of meaningful digits used to represent a value".

No matter what you use to determine a location of a point on earth, there will be inaccuracies associated with your method. For GPS you are lucky to get 1 m - or a few cm if you use special correction methods.

Since the circumference of the earth is 40,000 km and 360 degrees, one degree (at the equator) corresponds to 111 km; so when you have 0.000 001 degree, you are down to 11 cm. In other words, 3 + 6 digits (in degrees) is about as accurate as you ever ought to care about.

Going to 15 digit (3 + 12) means you are down in the sub-micron range. Do you really care?

As an aside, a double can store about 15 digits of precision (53 bits of significand). So your question is right on the limit of what numbers can typically be represented by computers without taking special precautions. And when you start doing any kinds of calculations on numbers like that you will very quickly lose some precision in the least significant digits.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top