mapricot-api 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/lib/mapricot/api.rb +10 -9
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e778f6345129b270ba0ba06c9e791051a9093d5c361dbd17afa00aa15a5f0f8e
|
|
4
|
+
data.tar.gz: '092b116567111f7fc1b702add90dff4caf06e7c7ef46307a58346b229ce62730'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '093e71c5a7d7ab43b19c13a30671e3c20b334ebf115daefd01204600f021c7abe97c83dbe0b467c3f8bdac914bf26033de7c956b283c8a102db34f532cc5ebfe'
|
|
7
|
+
data.tar.gz: 7ec4ba130fa05c424d2d19b5caa40c0d3ab4323962fe4a08363e295f01c15535d47b8f2feaab95a1caaef4f79b7e901d0bfbbe690c5c90a479ff6bba13ffd497
|
data/README.md
CHANGED
|
@@ -34,9 +34,9 @@ Methods are grouped by product, the same way as the API's paths. Each returns th
|
|
|
34
34
|
| `client.geocoding.reverse(lat, lon, limit:, lang:)` | [`GET /geocoding/v1/reverse`](https://mapricot.com/docs/geocoding/#find-the-address-at-a-point) |
|
|
35
35
|
| `client.places.nearby(lat, lon, category:, radius:, limit:, lang:)` | [`GET /places/v1/nearby`](https://mapricot.com/docs/places/#list-places-around-a-point) |
|
|
36
36
|
| `client.places.get(id, lang:)` | [`GET /places/v1/{id}`](https://mapricot.com/docs/places/#look-up-a-saved-place) |
|
|
37
|
-
| `client.routing.route(waypoints, mode:, geometries:, steps:, lang:)` | [`POST /routing/v1/route`](https://mapricot.com/docs/routing/#get-a-route) |
|
|
38
|
-
| `client.routing.optimize(waypoints, mode:, geometries:, steps:, lang:)` | [`POST /routing/v1/optimize`](https://mapricot.com/docs/routing/#optimize-the-order-of-stops) |
|
|
39
|
-
| `client.routing.isochrone(location, minutes, mode:)` | [`POST /routing/v1/isochrone`](https://mapricot.com/docs/routing/#get-an-isochrone) |
|
|
37
|
+
| `client.routing.route(waypoints, mode:, geometries:, steps:, lang:, costing:)` | [`POST /routing/v1/route`](https://mapricot.com/docs/routing/#get-a-route) |
|
|
38
|
+
| `client.routing.optimize(waypoints, mode:, geometries:, steps:, lang:, costing:)` | [`POST /routing/v1/optimize`](https://mapricot.com/docs/routing/#optimize-the-order-of-stops) |
|
|
39
|
+
| `client.routing.isochrone(location, minutes, mode:, costing:)` | [`POST /routing/v1/isochrone`](https://mapricot.com/docs/routing/#get-an-isochrone) |
|
|
40
40
|
| `client.ip_geolocation.lookup(ip)` | [`GET /ip-geolocation/v1/{ip}`](https://mapricot.com/docs/ip-geolocation/#look-up-an-address) |
|
|
41
41
|
| `client.account` | `GET /account`, which checks a key and is never billed |
|
|
42
42
|
|
|
@@ -61,6 +61,8 @@ Pass `steps: true` and each leg's `steps` has its turn-by-turn directions: an `i
|
|
|
61
61
|
|
|
62
62
|
`routing.optimize` takes the same arguments as `routing.route` and returns the route that visits the waypoints in a fast order, keeping the first and last in place. It adds `"waypointOrder"`: the indexes of your waypoints in visiting order, which `"legs"` follow. Every pair of waypoints must be within 400 km of each other for `drive`, or 200 km for `walk` and `bicycle`.
|
|
63
63
|
|
|
64
|
+
`costing` changes how a route, optimized route, or isochrone picks its roads, with Valhalla's [costing options](https://mapricot.com/docs/routing/#costing-options) for the mode, such as `costing: { useTolls: 0, useHighways: 0 }` to drive avoiding tolls and highways where it can.
|
|
65
|
+
|
|
64
66
|
An isochrone is a GeoJSON `FeatureCollection` with one polygon per time, largest first, so a map that draws them in order shows the smaller ones on top:
|
|
65
67
|
|
|
66
68
|
```ruby
|
data/lib/mapricot/api.rb
CHANGED
|
@@ -7,7 +7,7 @@ require "net/http"
|
|
|
7
7
|
# The official client for the Mapricot API: address and place search, reverse geocoding, nearby places, routing,
|
|
8
8
|
# and IP geolocation. See https://mapricot.com/docs/ruby/.
|
|
9
9
|
module Mapricot
|
|
10
|
-
VERSION = "0.
|
|
10
|
+
VERSION = "0.10.0"
|
|
11
11
|
|
|
12
12
|
# An error response from the API.
|
|
13
13
|
class Error < StandardError
|
|
@@ -159,24 +159,25 @@ module Mapricot
|
|
|
159
159
|
|
|
160
160
|
# Find a route through 2 to 20 waypoints, each {lat:, lon:}. mode is "drive" (the default), "walk", or "bicycle".
|
|
161
161
|
# geometries is "polyline" (the default), "polyline6", or "geojson". steps: true adds each leg's turn-by-turn
|
|
162
|
-
# steps, in lang, an ISO 639-1 language, English by default.
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
# steps, in lang, an ISO 639-1 language, English by default. costing takes Valhalla's costing options for the mode,
|
|
163
|
+
# such as { useTolls: 0 }: https://mapricot.com/docs/routing/#costing-options.
|
|
164
|
+
def route(waypoints, mode: nil, geometries: nil, steps: nil, lang: nil, costing: nil)
|
|
165
|
+
body = { waypoints: waypoints, mode: mode, geometries: geometries, steps: steps, lang: lang, costing: costing }
|
|
165
166
|
@post.call("/routing/v1/route", body)
|
|
166
167
|
end
|
|
167
168
|
|
|
168
169
|
# Find a fast route through 2 to 20 waypoints, keeping the first and last in place and reordering the rest. It
|
|
169
170
|
# takes the same arguments as route, and the route adds "waypointOrder": the indexes of the waypoints sent, in
|
|
170
171
|
# visiting order.
|
|
171
|
-
def optimize(waypoints, mode: nil, geometries: nil, steps: nil, lang: nil)
|
|
172
|
-
body = { waypoints: waypoints, mode: mode, geometries: geometries, steps: steps, lang: lang }
|
|
172
|
+
def optimize(waypoints, mode: nil, geometries: nil, steps: nil, lang: nil, costing: nil)
|
|
173
|
+
body = { waypoints: waypoints, mode: mode, geometries: geometries, steps: steps, lang: lang, costing: costing }
|
|
173
174
|
@post.call("/routing/v1/optimize", body)
|
|
174
175
|
end
|
|
175
176
|
|
|
176
177
|
# The areas reachable from a location, {lat:, lon:}, within 1 to 4 times, each 1 to 60 minutes, as a GeoJSON
|
|
177
|
-
# FeatureCollection with one polygon per time, largest first. mode
|
|
178
|
-
def isochrone(location, minutes, mode: nil)
|
|
179
|
-
@post.call("/routing/v1/isochrone", { location: location, minutes: minutes, mode: mode })
|
|
178
|
+
# FeatureCollection with one polygon per time, largest first. mode and costing are as for route.
|
|
179
|
+
def isochrone(location, minutes, mode: nil, costing: nil)
|
|
180
|
+
@post.call("/routing/v1/isochrone", { location: location, minutes: minutes, mode: mode, costing: costing })
|
|
180
181
|
end
|
|
181
182
|
end
|
|
182
183
|
|