Quantcast
Channel: maps for developers - Medium
Viewing all articles
Browse latest Browse all 2230

The Datasets API is now available to all!

$
0
0

We just launched the Datasets API, a new way to interact with custom geo data. Speaking raw GeoJSON, the Datasets API provides an endpoint for every single feature. This fine-grained control allows you to create tuned and frequently updating geo applications. From location-based video games to analytical pipelines to live updating maps, the Datasets API opens up endless possibilities for you to help your users understand the world around them.

A live updating map of wild fires in the United States.

The core of the Datasets API is the GeoJSON feature. You can create, read, update, and delete each feature on its own. This means you can make only the changes that you need to when updating your data. As feature ids can be any string, the Datasets API can quickly fit into any workflow as a hosted key-value store. This is great for apps that need serverless data storage.

In contrast to the Uploads API, which optimizes and strips uploaded data to make small, fast vector tiles, the Datasets API stores features up to six decimal points of precision. By keeping data accurate, the Datasets API sets itself up to be a great storage platform for geospatial analysis. And because it speaks GeoJSON, it’s primed and ready to work with Turf.

To help you get started using the Datasets API, we’ve added support to our SDKs.

Creating a dataset with the JavaScript SDK looks like:

varMapboxClient=require('mapbox');varclient=newMapboxClient('ACCESSTOKEN');client.createDataset({name:'foo',description:'bar'},function(err,dataset,response){console.log(dataset.id);// => 'dataseti-id'});


Here is how to add or update a feature in a dataset:

varpoint={id:'null-island',type:'Feature',properties:{},geometry:{coordinates:[0,0],type:'Point'}};client.insertFeature(point,'dataset-id',function(err,feature){console.log(feature.id);// => 'null-island'});


And here is how you read and than delete a feature:

client.readFeature('null-island','dataset-id',function(err,feature){console.log('null island is at: ',feature.geometry.coordinates);client.deleteFeature('null-island','dataset-id',function(err){console.log('null island has been deleted');});});


We have much more planned for the Datasets API and will be talking about it more in the coming weeks. Until then check out the Datasets API docs and share your creations with us via Twitter.


Viewing all articles
Browse latest Browse all 2230

Trending Articles