-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - mapbox #15539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Components - mapbox #15539
Changes from 4 commits
79c60e1
314b041
7c74d6a
4ff2b3f
0acc909
cabd2b8
5b470d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||
| import mapbox from "../../mapbox.app.mjs"; | ||||||
| import fs from "fs"; | ||||||
| import FormData from "form-data"; | ||||||
|
|
||||||
| export default { | ||||||
| key: "mapbox-create-tileset", | ||||||
| name: "Create Tileset", | ||||||
| description: "Uploads and creates a new tileset from a data source. [See the documentation](https://docs.mapbox.com/api/maps/mapbox-tiling-service/)", | ||||||
| version: "0.0.1", | ||||||
| type: "action", | ||||||
| props: { | ||||||
| mapbox, | ||||||
| username: { | ||||||
| type: "string", | ||||||
| label: "Username", | ||||||
| description: "The Mapbox username of the account for which to create a tileset source", | ||||||
| }, | ||||||
| tilesetName: { | ||||||
| type: "string", | ||||||
| label: "Tileset Name", | ||||||
| description: "A unique name for the tileset source to be created. Limited to 32 characters. The only allowed special characters are - and _.", | ||||||
| }, | ||||||
| filePath: { | ||||||
| type: "string", | ||||||
| label: "File Path", | ||||||
| description: "The path to a tileset source file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)", | ||||||
| }, | ||||||
| recipe: { | ||||||
| type: "object", | ||||||
| label: "Recipe", | ||||||
| description: "A recipe that describes how the GeoJSON data you uploaded should be transformed into tiles. A tileset source is raw geographic data formatted as [line-delimited GeoJSON](https://en.wikipedia.org/wiki/JSON_streaming#Line-delimited_JSON), or a supported [raster file format](https://docs.mapbox.com/mapbox-tiling-service/raster/supported-file-formats/). For more information on how to create and format recipes, see the ]Recipe reference](https://docs.mapbox.com/mapbox-tiling-service/reference/) and [Recipe examples](https://docs.mapbox.com/mapbox-tiling-service/examples/).", | ||||||
|
||||||
| description: "A recipe that describes how the GeoJSON data you uploaded should be transformed into tiles. A tileset source is raw geographic data formatted as [line-delimited GeoJSON](https://en.wikipedia.org/wiki/JSON_streaming#Line-delimited_JSON), or a supported [raster file format](https://docs.mapbox.com/mapbox-tiling-service/raster/supported-file-formats/). For more information on how to create and format recipes, see the ]Recipe reference](https://docs.mapbox.com/mapbox-tiling-service/reference/) and [Recipe examples](https://docs.mapbox.com/mapbox-tiling-service/examples/).", | |
| description: "A recipe that describes how the GeoJSON data you uploaded should be transformed into tiles. A tileset source is raw geographic data formatted as [line-delimited GeoJSON](https://en.wikipedia.org/wiki/JSON_streaming#Line-delimited_JSON), or a supported [raster file format](https://docs.mapbox.com/mapbox-tiling-service/raster/supported-file-formats/). For more information on how to create and format recipes, see the [Recipe reference](https://docs.mapbox.com/mapbox-tiling-service/reference/) and [Recipe examples](https://docs.mapbox.com/mapbox-tiling-service/examples/).", |
This seems to have a typo in the markdown syntax
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,59 @@ | ||||||
| import mapbox from "../../mapbox.app.mjs"; | ||||||
|
|
||||||
| export default { | ||||||
| key: "mapbox-generate-directions", | ||||||
| name: "Generate Directions", | ||||||
| description: "Generates directions between two or more locations using Mapbox API. [See the documentation](https://docs.mapbox.com/api/navigation/directions/).", | ||||||
| version: "0.0.1", | ||||||
| type: "action", | ||||||
| props: { | ||||||
| mapbox, | ||||||
| startCoordinate: { | ||||||
| type: "string", | ||||||
| label: "Start Coordinate", | ||||||
| description: "The starting point in the format `longitude,latitude`", | ||||||
|
||||||
| description: "The starting point in the format `longitude,latitude`", | |
| description: "The starting point in the format `longitude,latitude`, e.g. `37.835819,-85.244869`", |
An example would be helpful in these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is a default, this prop should be optional - or if it's not optional, it shouldn't mention a default
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import mapbox from "../../mapbox.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "mapbox-geocode-address", | ||
| name: "Geocode Address", | ||
| description: "Retrieves the geocoded location for a given address. [See the documentation](https://docs.mapbox.com/api/search/geocoding/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| mapbox, | ||
| address: { | ||
| type: "string", | ||
| label: "Address", | ||
| description: "The address (or partial address) to geocode. This could be an address, a city name, etc. Must consist of at most 20 words and numbers separated by spacing and punctuation, and at most 256 characters.", | ||
| }, | ||
| boundingBox: { | ||
| type: "string", | ||
| label: "Bounding Box", | ||
| description: "Limit results to only those contained within the supplied bounding box. Bounding boxes should be supplied as four numbers separated by commas, in `minLon,minLat,maxLon,maxLat` order. The bounding box cannot cross the 180th meridian. You can use the [Location Helper](https://labs.mapbox.com/location-helper) to find a bounding box for use with this API.", | ||
| optional: true, | ||
| }, | ||
| proximity: { | ||
| type: "string", | ||
| label: "Proximity", | ||
| description: "Bias the response to favor results that are closer to this location. Provided as two comma-separated coordinates in `longitude,latitude` order.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.mapbox.geocode({ | ||
| $, | ||
| params: { | ||
| q: this.address, | ||
| bBox: this.boundingBox, | ||
| proximity: this.proximity, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Geocoded location for "${this.address}" retrieved successfully`); | ||
| return response; | ||
| }, | ||
| }; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| const TRANSPORTATION_MODES = [ | ||
| "driving", | ||
| "walking", | ||
| "cycling", | ||
| "driving-traffic", | ||
| ]; | ||
|
|
||
| const EXCLUDE_OPTIONS = [ | ||
| "motorway", | ||
| "toll", | ||
| "ferry", | ||
| "unpaved", | ||
| "cash_only_tolls", | ||
| "country_border", | ||
| "state_border", | ||
| ]; | ||
|
|
||
| export default { | ||
| TRANSPORTATION_MODES, | ||
| EXCLUDE_OPTIONS, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "mapbox", | ||
| propDefinitions: { | ||
| transportationMode: { | ||
| type: "string", | ||
| label: "Transportation Mode", | ||
| description: "The mode of transportation", | ||
| options: constants.TRANSPORTATION_MODES, | ||
| }, | ||
| exclude: { | ||
| type: "string[]", | ||
| label: "Exclude", | ||
| description: "Exclude certain road types and custom locations from routing", | ||
| options: constants.EXCLUDE_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| _baseUrl() { | ||
| return "https://api.mapbox.com"; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, | ||
| path, | ||
| params, | ||
| ...otherOpts | ||
| }) { | ||
| return axios($, { | ||
| url: `${this._baseUrl()}${path}`, | ||
| params: { | ||
| access_token: this.$auth.access_token, | ||
| ...params, | ||
| }, | ||
| debug: true, | ||
| ...otherOpts, | ||
| }); | ||
| }, | ||
| geocode(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/search/geocode/v6/forward", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| getDirections({ | ||
| transportationMode, coordinates, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/directions/v5/mapbox/${transportationMode}/${coordinates}`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createTilesetSource({ | ||
| username, id, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: `/tilesets/v1/sources/${username}/${id}`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| validateRecipe(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "PUT", | ||
| path: "/tilesets/v1/validateRecipe", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createTileset({ | ||
| tilesetId, ...opts | ||
| }) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: `/tilesets/v1/${tilesetId}`, | ||
| ...opts, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,19 @@ | ||
| { | ||
| "name": "@pipedream/mapbox", | ||
| "version": "0.0.3", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Mapbox Components", | ||
| "main": "dist/app/mapbox.app.mjs", | ||
| "main": "mapbox.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "mapbox" | ||
| ], | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "homepage": "https://pipedream.com/apps/mapbox", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3", | ||
| "form-data": "^4.0.1" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be a slight help for less attentive users