X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/881d0b11b519524873ec28ea9ca8010b5710c83b..9143fd61e8ae268ec40837efdb2b7cae49783b4d:/lib/short_link.rb diff --git a/lib/short_link.rb b/lib/short_link.rb index 2dfb0fb58..eb73d6029 100644 --- a/lib/short_link.rb +++ b/lib/short_link.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ## # Encodes and decodes locations from Morton-coded "quad tile" strings. Each # variable-length string encodes to a precision of one pixel per tile (roughly, @@ -57,7 +59,7 @@ module ShortLink def encode(lon, lat, z) code = interleave_bits(((lon + 180.0) * (2**32) / 360.0).to_i, ((lat + 90.0) * (2**32) / 180.0).to_i) - str = String.new + str = +"" # add eight to the zoom level, which approximates an accuracy of # one pixel in a tile. ((z + 8) / 3.0).ceil.times do |i|