Point Failure #1

rockwood opened this Issue May 30, 2012 · 5 comments


None yet
4 participants


We're testing this out for our app and stumbled on some issues when encoding certain points.

for instance, doing:

Polylines::Encoder.encode_points([[41.3522171071184, -86.0456299662023],[41.3522171071183, -86.0454368471533]])

Gives the error

       undefined method `+' for nil:NilClass
     # ./lib/polylines/base.rb:62:in `block (2 levels) in step_10'
     # ./lib/polylines/base.rb:62:in `map'
     # ./lib/polylines/base.rb:62:in `block in step_10'
     # ./lib/polylines/base.rb:73:in `encode!'
     # ./lib/polylines/base.rb:62:in `step_10'
     # ./lib/polylines/encoder.rb:18:in `block in encode'
     # ./lib/polylines/encoder.rb:10:in `tap'
     # ./lib/polylines/encoder.rb:10:in `encode'
     # ./lib/polylines/encoder.rb:5:in `block in encode_points'
     # ./lib/polylines/encoder.rb:5:in `map'
     # ./lib/polylines/encoder.rb:5:in `encode_points'
     # ./spec/polylines/encoder_spec.rb:14:in `block (2 levels) in <top (required)>'

I'm not quite sure why only some points are failing. Any ideas?


joshuaclayton commented May 30, 2012

Looks like there wasn't a case to handle when breaking into 5-bit chunks returned an empty array. I've made sure both encoding and decoding works with this set of points. Thanks!

You rock! Thanks.

cdmwebs commented May 30, 2012

@joshuaclayton you da man. Thanks a ton. I was just getting ready to dive in to this.

We've run into this problem too - the fix worked great. Would you be able to push to RubyGems?


joshuaclayton commented Jun 18, 2012

Sure thing! Just pushed 0.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment