Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
A Ruby gem 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.
The look and size of the map image can be customized by passing an optional hash of arguments, as explained in the Usage section.
Ruby 1.9.3 or higher | Supports Ruby 2.0!
Add this line to your application's Gemfile:
gem 'gcmapper'
And then execute:
$ bundle
Or install it yourself as:
$ gem install gcmapper
The .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: EGLL-LOWI
or
LFST-LSZH-LBSF
. Here are some examples:
# An example of normal route:
route = "EGLL-LOWI"
route.gcmap # => Returns an image map URL for the route EGLL-LOWI
# An exampmle of layover route:
another_route = "LFST-LSZH-LBSF"
another_route.gcmap # => Returns an image map URL for the layover route LFST-LSZH-LBSF
# The method can be applied directly to a string:
"EGLL-LOWI".gcmap # => Returns an image map URL for the route EGLL-LOWI
# It's not case sensitive:
"egll-lowi".gcmap # => Returns an image map URL for the route EGLL-LOWI
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, terrain (toggle satelite terrain
overlay), city label and airport name label.
Width, height and terrain can be combined in any way or omitted entirely. City label ad Airport name
label are mutually exclusive.
# Passing width only (default is 720px):
route = "egll-lowi"
route.gcmap(:width => "600") # => Returns an image map URL with width set to 600px
# Passing height only (default is 360px):
route = "egll-lowi"
route.gcmap(:height => 400) # => Returns an image map URL with height set to 400px
# Passing width and height:
"egll-lowi".gcmap(:width => "800", :height => "400") # => Returns an image map URL with width 800px and height 400px
# Enabling terrain overlay:
route = "egll-lowi"
route.gcmap(:terrain => true) # => Returns an image map URL with terrain overlay enabled
# Setting width, height and enabling terrain overlay:
"egll-lowi".gcmap(:width => 800, :height => 400, :terrain => true) # => Returns an image map URL with set width, height and terrain
# Setting width, height, enabling terrain overlay and disabling the city labels:
"egll-lowi".gcmap(:width => 800, :height=>400, :terrain=>true, :city=>false) # => Returns an image map URL with set width, height and terrain, with city labels disabled
# Setting the map to display the airports' names instead of the ICAO/IATA codes
route = "egll-lowi"
route.gcmap(:airport_name => true) # => Returns an image map URL with airport names displayed
# Setting the map to display the airports' names and a terrain overlay
route = "egll-lowi"
route.gcmap(:airport_name => true, :terrain => true) # => Returns an image map URL with airport names and terrain displayed
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") %>
route
string can be constructed from either ICAO or IATA airport codes; both types are recognizedroute
string is not case sensitive, so for example lgav-lqsa
will be recognized as wellwidth
and height
hash options the values can be put in quotes or not, either way workscity
label and airport_name
label options are mutually exclusive, i.e. you can either have the ICAO/IATA code with optional city name OR the Airport name:city
to toggle city labels on or off (see Usage):airport_name
to toggle airport name labels on or off (see Usage)git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)Copyright © 2013 Svilen Vassilev
If you find my work useful or time-saving, you can endorse it or buy me a cup of coffee:
Released under the MIT LICENSE
Maps generated by the Great Circle Mapper, copyright Karl L. Swartz
FAQs
Unknown package
We found that gcmapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.