Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pippa

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pippa

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Pippa

Gem Version

Pippa - a Ruby gem for producing simple map graphics overlain with geocoded dots of given area. Dot coordinates are in screen pixels, latitude/longitude, or US zipcode.

Installation

Add this line to your application's Gemfile:

gem 'pippa'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install pippa

Usage

require 'pippa'

# Get available map names.
puts Pippa.map_names

# Make a new, clean map.
map = Pippa::Map.new('USA') # or 29 other maps (default == 'World')

# Change default dark red fill to dark green.
# Changes cause dots entered so far to be rendered to graphic.
# Several other parameters also control dot appearance.
map.fill = 'DarkGreen'

# Change default to enable ImageMagick anti-aliasing by refraining
# from snapping dot coordinates to nearest pixel.
map.anti_alias = true

# Add a dot in the middle of the map using pixel coordinates.
map.add_dot(map.width/2, map.height/2, 100)

# Add a single green pixel dot at West Point, NY.
# Between calls to render, dots are drawn biggest first, so
# overlaps are generally okay.
map.add_at_lat_lon(41.5, -74.1)

# Flush buffered dots to the map.
map.render

# Add a dot with an area of 86 at a given zip code in Pennsylvania.
# This will be drawn on top of all previous dots regardless of
# size due to render above.
map.add_at_zip('18088', 86)

# Make a blob of the map e.g. suitable for Rails send_data.
# Any RMagick blob format will work in lieu of 'png'
blob = map.to_png

# Write the map directly to a file using RMagick write.
# Any RMagick writable format will work.
map.write_jpg('mymap.jpg')

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 02 Apr 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc