No commit activity in last 3 years
No release in over 3 years
Generates random map points, within an optional bounding box.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 3.0.0, ~> 3.0
 Project Readme

random_point_generator

This gem is for generating random map points (latitude, longitude pair).

A bounding box can be given, to restrict points to that area.

Install

gem install random_point_generator

Usage

Without a Bounding Box

A default bounding box of the entire world will be used when a bounding box is not given.

require 'random_point_generator'

generator = RandomPointGenerator.new
generator.random_point
# => [-6.331129757683641, 131.37939708803907]

With a Bounding Box

The initializer takes in a southwest point (array of lat, lng) and a northeast point (array of lat, lng).

require 'random_point_generator'

sw_point = [40.636883,-74.083214]
ne_point = [40.831476,-73.673630]

nyc_point_generator = RandomPointGenerator.new(sw_point, ne_point)
nyc_point_generator.random_point
# => [40.637508713191345, -73.95164169297031]

Development

Install

gem install --dev random_point_generator

Specs

The default Rake task is to run the specs.

rake

License

MIT