
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
server-side-google-maps
Advanced tools
Make requests for direction from Google's servers, and receive them in a Ruby-usable object.
To install:
sudo gem install server-side-google-maps
Then, to use within Ruby:
route = ServerSideGoogleMaps::Route.new(['Montreal, QC', 'Ottawa, ON'], :mode => :driving)
# Origin and destination accept [lat,lon] coordinates as well as strings
# :mode => :driving is the default. Others are :bicycling and :walking
route.status # 'OK'
route.origin_address # 'Montreal, QC, Canada'
route.origin_point # [ 45.5086700, -73.5536800 ]
route.destination_address # 'Ottawa, ON, Canada'
route.destination_point # [ 45.4119000, -75.6984600 ]
route.path.points # Array of Point coordinates of route
route.points[0].latitude # .latitude, .longitude, .distance_to_here
route.distance # 199901 (metres)
# We can also find elevations along a path
path = route.path
path.elevations(20) # Array of equidistant Points, each with an elevation
# Paths used for elevation may only be up to around 230 points long,
# to comply with Google's URL length limit. That's not hard to achieve:
simple_path = path.interpolate(230) # will create a new Path by interpolating
One final :mode
is :direct
, which calculates points
and estimates
distance
without querying Google. To ensure Google isn't queried, input
the origin and destination as latitude/longitude coordinates.
As per the Google Maps API license agreement, the data returned from the Google Maps API must be used only for display on a Google Map.
I'll write that again: Google Maps data is for Google Maps only! You may not do any extra calculating and processing, unless the results of those extra calculations are displayed on a Google Map.
There are also query limits on each Google API, on the order of a few thousand queries each day. Design your software accordingly. (Cache heavily and don't query excessively.)
Each feature and issue must have a spec. Please write specs if you can.
FAQs
Unknown package
We found that server-side-google-maps 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.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.