added fetch tile in for Maps API

This commit is contained in:
csobier 2016-02-19 11:45:06 -05:00
parent 4d6b4b1755
commit cfa2714dbb

View File

@ -29,6 +29,7 @@ POST /api/v1/map/named
Params | Description Params | Description
--- | --- --- | ---
api_key | is required api_key | is required
MapConfig | a [Named Map MapConfig](http://docs.cartodb.com/cartodb-platform/maps-api/mapconfig/#named-map-layer-options) is required to create a Named Map
#### template.json #### template.json
@ -352,7 +353,7 @@ curl -X GET 'https://documentation.cartodb.com/api/v1/map/named?api_key=APIKEY'
} }
``` ```
## Get Specific Templates ## Get Specified Template Definition
This gets the definition of a template. This gets the definition of a template.
@ -448,26 +449,33 @@ callback({
``` ```
## CartoDB.js for Named Maps ## CartoDB.js for Named Maps
Named Maps can be used with CartoDB.js, by specifying a Named Map in a layer source as follows. You can initialize your Named Map using CartoDB.js, by specifying a Named Map template in a [layer source object](http://docs.cartodb.com/cartodb-platform/cartodb-js/layer-source-object/#named-maps-layer-source-object-type-namedmap).
```js ```javascript
var layerSource = { {
user_name: '{your_user_name}', user_name: 'your_user_name', // Required
type: 'namedmap', type: 'namedmap', // Required
named_map: { named_map: {
name: '{template_name}', name: 'name_of_map', // Required
layers: [{ // Optional
layer_name: "layer1", layers: [{
layer_name: "sublayer0", // Optional
interactivity: "column1, column2, ..." // Optional
},
{
layer_name: "sublayer1",
interactivity: "column1, column2, ..." interactivity: "column1, column2, ..."
}] },
...
],
// Optional
params: {
color: "hex_value",
num: 2
}
} }
} }
cartodb.createLayer('map_dom_id',layerSource)
.addTo(map_object);
``` ```
**Note:** Instantiating a Named Map over a `createLayer` does not require an API Key and by default, does not include auth tokens. _If_ you defined auth tokens for the Named Map configuration, then you will have to include them. **Note:** Instantiating a Named Map over a `createLayer` does not require an API Key and by default, does not include auth tokens. _If_ you defined auth tokens for the Named Map configuration, then you will have to include them.
[CartoDB.js](http://docs.cartodb.com/cartodb-platform/cartodb-js/) has methods for accessing your Named Maps. [CartoDB.js](http://docs.cartodb.com/cartodb-platform/cartodb-js/) has methods for accessing your Named Maps.