在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):joshcrews/google-directions-ruby开源软件地址(OpenSource Url):https://github.com/joshcrews/google-directions-ruby开源编程语言(OpenSource Language):Ruby 100.0%开源软件介绍(OpenSource Introduction):Usagedirections = GoogleDirections.new(origin, destination) where origin and destination are strings of addresses or places that Google can find an address for. Example: “816 Meridian St., 37207” Get drive time or distance of whole trip
Get the XML Google returns with every turn, or the API call URL
Error situationsstatus: NOT_FOUND If Google can’t recognize your places, the distance_in_miles and drive_time_in_minutes will each return 0. You can call directions.statusand it should return “NOT_FOUND” (directions.status will also return any other Google API call statuses) status: OVER_QUERY_LIMIT If Google thinks you’ve hit their API too many times in day, or too rapidly, for your given IP address and API key; they might return OVER_QUERY_LIMIT. In this case distance_in_miles and drive_time_in_minutes will each return 0. You can call directions.statusand it should return “OVER_QUERY_LIMIT” Installationgemrails 3.0/4.0
CompatibilityTested on Rails 2.3.8 API keyGoogle mapsYou’ll need a Google Map API key http://code.google.com/apis/maps/signup.html Include it as the constant GOOGLE_MAPS_API_KEY in an app configuration file (environment.rb, config/initializers/api_keys.rb) Need turn-by-turn directions?Not yet included in this gem, but you can do it with nokogiri to parse the XML that comes back when you do GoogleDirections.new(origin, destination).xml And then nokogiri can cycle through each and you can pick out what you need. LicenseAnyone can use this code in any way. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论