2014-02-25 23 views
0

我試圖使用this Ruby Gem,並且遇到了問題。有時候,我的輸出有問題,當我解碼多段線時,似乎有一個四捨五入的問題。如果我從官方的「交互式折線編碼器實用程序」收到的數組進行比較,有時,我沒有相同的結果。Google多段線轉換錯誤

https://developers.google.com/maps/documentation/utilities/polylineutility

例如,所使用的多段線的字符串是:

"eyhiHkx}[email protected][email protected]?PFqCfE}RTwB?Y|@@[email protected]`@[email protected]{@[email protected]@`TyaA^sBB}@[email protected]@[email protected]@[email protected]{ALoB\\eCZwAJF\\uABM^TjLtI`[email protected]@[email protected]]pF{EvMgMjI{[email protected][[email protected]`VyEpHwAtGkA|[email protected]@[email protected]@|@[email protected]@D{@^FPH|EhG" 

見附件2個截圖看出差別: enter image description here

enter image description here

第一一個是來自官方的谷歌實用程序,第二個是使用寶石。

你可以看到,GPS座標四捨五入是不一樣的:

48.87205,2.3006 

[48.87205000000001, 2.300600000000001] 

有沒有人經歷過同樣的事情,或者沒有人知道一種方法,我可以改變的結果使他們不一樣放鬆座標精度以比較兩條多段線?

謝謝

回答