emcconville / google-map-polyline-encoding-tool

A simple class to handle polyline-encoding for Google Maps
Other
156 stars 40 forks source link

Wrong rouding method for google. #10

Closed oliviertassinari closed 10 years ago

oliviertassinari commented 10 years ago

Use round method instead of floor method.

Encode and decode (48.000006, 2.000004) to verify. You get (48.00001, 2). https://developers.google.com/maps/documentation/utilities/polylineutility

emcconville commented 10 years ago

Please provide a test case (encoded string, expected points, and actual points). It is well established & known that float point precision errors exists in the PHP language. The tool "Interactive Polyline Encoder Utility" also experiences the same precision errors.

emcconville commented 10 years ago

Please checkout the pu branch, and verify rounding of 1e5 is correct. I'll still need a good test case for this issue before I merge to master.

emcconville commented 10 years ago

Issue fixed with Patch Release v1.2.3