GCMapper: A Ruby gem for generating Great Circle maps
Yet another gem release announcement: this time it's GCMapper, a library for easy generation of Great Circle Map images between 2 or more airports. The gem provides an API for constructing the image URLs, the maps themselves are pulled from gcmap.com.
Here's a quote from the documentation:
.gcmap method can be applied to a string (or variable containing a string), representing a valid route between 2 or more airports (ICAO or IATA codes), connected with dashes, like this:
The resulting image size and look can be customized by passing an optional hash of arguments to the
.gcmap method. Customizable attributes include
width, height and
terrain (toggle satellite terrain overlay). These options can be combined in any way or omitted entirely.
Here are some examples:
Finally, here's an example of how to use the gem in a Rails application:
In your controller:
@route = "egll-lowi"
In your view:
<%= image_tag @route.gcmap(:width => "600") %>
routestring can be constructed from either ICAO or IATA airport codes; both types are recognized
routestring is not case sensitive, so for example
lgav-lqsawill be recognized as well
- layover routes that chain multiple airports (more than 2) are also supported
- default image parameters are: width 720px, width: 360px, terrain not shown
- when passing the
heighthash options the values can be put in quotes or not, either way works