Skip to main content
100%

Mercator Map Tile functions for Ruby

✓ Published0🌍 Public
RRandomEtc
Last edited Dec 30, 2013
Created on Dec 30, 2013

This example demonstrates how to convert between geographic coordinates, Mercator projections, and map tile coordinates in Ruby. It defines a module with functions for transforming latitude/longitude pairs to and from Mercator-projected coordinates, as well as scaling those coordinates to specific zoom levels. The code also includes utility methods for calculating an optimal zoom level and center point that fits a set of locations within a given viewport, optionally accounting for padding. The implementation relies on the Ruby Math library for trigonometric and logarithmic operations, with no external dependencies.

AI-generated description

Similar vizzes