Dammyololade / flutter_polyline_points

A flutter plugin that's decodes encoded google poly line string into list of geo-coordinates suitable for showing route/polyline on maps
MIT License
109 stars 132 forks source link

Issue with negative longitudes #84

Closed Stormwave closed 1 year ago

Stormwave commented 1 year ago

I noticed when using this library that the directions scaled way off. After poking around a bit, I figured it was that dart uses 64-bit integers, and thus reversing the bits was failing to produce a negative integer.

I've solved this in my own code using toSigned(32) at the end of the dlng/dlat calculations, like so:

int dlng = ((result & 1) == 1 ? ~(result >> 1) : (result >> 1)).toSigned(32);

Figured I'd let you know, in case you want to look into this/patch it.

Thanks for the library.

Dammyololade commented 1 year ago

This has been fixed thanks for the suggestions