mapbox-dataset-sdk
v0.0.2
Published
[![Build Status](https://travis-ci.org/mapbox/mapbox-dataset-sdk.svg?branch=master)](https://travis-ci.org/mapbox/mapbox-dataset-sdk)
Downloads
17
Readme
mapbox-dataset-sdk
A JavaScript SDK for the Mapbox Dataset API
Usage
var Mapbox = require('mapbox-dataset-sdk');
var datasets = Mapbox.dataset({
user: 'my-mapbox-user'
});
var features = Mapbox.dataset({
user: 'my-mapbox-user',
dataset: 'my-dataset-id'
});
Configuration
Set these environment variables, or pass them as configuration options to the clients as shown above:
environment variable | config | description --- | --- | --- MapboxUser | user | required Mapbox user name
- | dataset | required for feature client Dataset ID
MapboxAccessToken | accessToken | required Mapbox access token with
dataset:read
anddataset:write
scopes MapboxAPI | mapbox | Mapbox API endpoint
API overview
datasets
method | arguments | description --- | --- | --- datasets.list | - | List available datasets datasets.get | id | Get information about a dataset datasets.create | [options] | Create a dataset, optionally specifying name and description. datasets.update | id, [options] | Update a dataset's name or description datasets.delete | id | Delete a dataset
features
method | arguments | description --- | --- | --- features.list | - | List features features.get | id | Get a feature features.insert | feature | Insert or update a GeoJSON Feature features.delete | id | Delete a feature features.bulk | [inserts], [deletes] | Perform bulk feature inserts, updates, and/or deletes features.replace | collection | Delete all the existing features in a dataset and replace it with the provided GeoJSON FeatureCollection
Tests
You must set MapboxUser
and MapboxAccessToken
environment variables to run the tests. These tests will create and destroy datasets and features in your account.