Archive for February, 2008

Lat, lng points to GMmaps polyline in Ruby

Monday, February 11th, 2008

def encode(num)   str = ""   num = (num * 1e5).floor   num <<= 1   num = ~num if num < 0   while num >= 0x20     str += (((num & 0x1f) | 0x20) + 63).chr     num >>= 5   end   str += (num+63).chr   return str end def to_encoded_polyline(points)   polyline = ""   points.each do |point|     polyline += encode(point[:lat])     polyline += encode(point[:lng])   end   return polyline end

“Why would I want to do that?”

Wednesday, February 6th, 2008

I'm working with a friend on a chat application that we think is a unique approach to an idea that's been around for a few years, but has never been implemented in a sensible way. When I tell people at work or at school about it, most of them ...