Giter Site home page Giter Site logo

marchdev-tk / google_polyline_algorithm Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 1.0 25 KB

Dart implementation of Googles Polyline Encoding lossy compression Algorithm.

License: BSD 3-Clause "New" or "Revised" License

Dart 100.00%
dart dartlang dart2 dart-library dart-package google-maps polyline-algorithm polyline-encoder polyline-decoder polyline

google_polyline_algorithm's People

Contributors

olehmarch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sisboca

google_polyline_algorithm's Issues

Possible issue with ~ operator in Chrome-web

In the decodePolyline method the ~ operator is used. I don't believe that this operator works as expected on Chrome. If you run the example in the library the negative longitudes are incorrect as a result. Things are fine on Android.

Windows 10/64 bit

A possible fix/workaround:

  final coordinateChange =
  //(result & 1) != 0 ? ~(result >> 1) : (result >> 1);
  (result & 1) != 0 ? (~BigInt.from(value)).toInt() : value;

image

Invalid value: Not in inclusive range

Hello,

Is there anything we can do for this annoying problem when the encoder encodes string with backslashes etc and then dart can't read it correctly and I am still getting Invalid value: Not in inclusive range when decoding it

'List<List<String>>' is not a subtype of type 'List<List<num>>' in type cast

Error:type 'List<List>' is not a subtype of type 'List<List>' in type cast

When I'm trying to pass a list of coordinates to encode getting the above issue.

Example:List of coordinates
[[26.7784002, 75.8425027], [26.7786778, 75.8425991], [26.7787995, 75.8428689], [26.7787386, 75.8431947], [26.7786963, 75.8435242], [26.7788872, 75.8437456], [26.7790054, 75.843449], [26.77906, 75.8431203], [26.7791082, 75.8428205], [26.7791817, 75.8425138], [26.7790115, 75.8422522], [26.7790001, 75.8419491], [26.7792244, 75.8417791], [26.7794847, 75.8418831], [26.7794877, 75.8421887], [26.7792773, 75.8424163], [26.7790088, 75.8422836], [26.7787782, 75.8421037], [26.7784653, 75.8420592], [26.7781823, 75.8420604], [26.7781429, 75.8423668]]

Some code of snapshot below
List temp=[];
for (int j = 0; j < getRoutesData!.data![i].routeCoordinates!.length; j++)
{
temp.add([getRoutesData!.data![i].routeCoordinates![j].lat,
getRoutesData!.data![i].routeCoordinates![j].lng].toString());
}
getRoutesData!.data![i].dataList.add(temp);
getRoutesData!.data![i].dataString=getRoutesData!.data![i].dataList.join(','+' ');
getRoutesData!.data![i].encodedString=encodePolyline(getRoutesData!.data![i].dataList as List<List>);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.