From af50af325d2917531354cb21df10bcd576cf926b Mon Sep 17 00:00:00 2001 From: csobier Date: Fri, 29 Jan 2016 11:46:03 -0500 Subject: [PATCH 1/5] added links to new mapconfig, updated named map intro, and added cartodbjs named map examples --- docs/anonymous_maps.md | 2 +- docs/named_maps.md | 16 ++++++++++++---- docs/static_maps_api.md | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/anonymous_maps.md b/docs/anonymous_maps.md index ead1ce96..31f585a2 100644 --- a/docs/anonymous_maps.md +++ b/docs/anonymous_maps.md @@ -28,7 +28,7 @@ POST /api/v1/map } ``` -Should be a [Mapconfig](https://github.com/CartoDB/Windshaft/blob/0.44.1/doc/MapConfig-1.3.0.md). +See [MapConfig File Formats](/cartodb-platform/maps-api/mapconfig/) for details. #### Response diff --git a/docs/named_maps.md b/docs/named_maps.md index 62dd44bd..4129fc59 100644 --- a/docs/named_maps.md +++ b/docs/named_maps.md @@ -1,6 +1,6 @@ -# Named Maps +http://docs.cartodb.com/cartodb-platform/maps-api/mapconfig/# Named Maps -Named maps are essentially the same as anonymous maps except the MapConfig is stored on the server and the map is given a unique name. Two other big differences are: you can create named maps from private data and that users without an API Key can see them even though they are from that private data. +Named maps are essentially the same as anonymous maps except the MapConfig is stored on the server, and the map is given a unique name. You can create named maps from private data, and users without an API Key can view your Named Map (while keeping your data private). The Named map workflow consists of making a call to your database, referencing a table, inserting your variables into the template where placeholders are defined, and creating custom queries. The main two differences compared to anonymous maps are: @@ -91,7 +91,7 @@ auth | |_ method | `"token"` or `"open"` (the default if no `"method"` is given). |_ valid_tokens | when `"method"` is set to `"token"`, the values listed here allow you to instantiate the named map. placeholders | Variables not listed here are not substituted. Variables not provided at instantiation time trigger an error. A default is required for optional variables. Type specification is used for quoting, to avoid injections see template format section below. -layergroup | the layer list definition. This is the MapConfig explained in anonymous maps. See [MapConfig documentation](https://github.com/CartoDB/Windshaft/blob/0.44.1/doc/MapConfig-1.3.0.md) for more info. +layergroup | the layer list definition. This is the MapConfig explained in anonymous maps. See [MapConfig File Format](/cartodb-platform/maps-api/mapconfig/) for more info. view (optional) | extra keys to specify the compelling area for the map. It can be used to have a static preview of a named map without having to instantiate it. It is possible to specify it with `center` + `zoom` or with a bounding box `bbox`. Center+zoom takes precedence over bounding box. --- | --- @@ -437,7 +437,7 @@ curl -X GET 'https://documentation.cartodb.com/api/v1/map/named/:template_name?a } ``` -## Use with CartoDB.js +## Creating Named Maps with CartoDB.js Named maps can be used with CartoDB.js by specifying a named map in a layer source as follows. Named maps are treated almost the same as other layer source types in most other ways. ```js @@ -462,3 +462,11 @@ cartodb.createLayer('map_dom_id',layerSource) 1. [layer.setParams()](http://docs.cartodb.com/cartodb-platform/cartodb-js/api-methods/#layersetparamskey-value) allows you to change the template variables (in the placeholders object) via JavaScript 2. [layer.setAuthToken()](http://docs.cartodb.com/cartodb-platform/cartodb-js/api-methods/#layersetauthtokenauthtoken) allows you to set the auth tokens to create the layer + +### Complete Examples of Named Maps created with CartoDB.js + +- [Named map selectors with interaction](http://bl.ocks.org/ohasselblad/515a8af1f99d5e690484) + +- [Named map with interactivity and config file used to create it](http://bl.ocks.org/ohasselblad/d1a45b8ff5e7bd90cd68) + +- [Toggling sublayers in a Named Map](http://bl.ocks.org/ohasselblad/c1a0f4913610eec53cd3) diff --git a/docs/static_maps_api.md b/docs/static_maps_api.md index 1d6f3160..426501d5 100644 --- a/docs/static_maps_api.md +++ b/docs/static_maps_api.md @@ -127,7 +127,7 @@ By manipulating the `"urlTemplate"` custom basemaps can be used in generating st **CartoDB** -As described in the [Mapconfig documentation](https://github.com/CartoDB/Windshaft/blob/0.44.1/doc/MapConfig-1.3.0.md), a "cartodb" type layer is now just an alias to a "mapnik" type layer as above, intended for backwards compatibility. +As described in the [MapConfig File Format](/cartodb-platform/maps-api/mapconfig/), a "cartodb" type layer is now just an alias to a "mapnik" type layer as above, intended for backwards compatibility. ```javascript { From 486a55ed7f9592ffb9354a42f575978c76675063 Mon Sep 17 00:00:00 2001 From: csobier Date: Fri, 29 Jan 2016 11:52:17 -0500 Subject: [PATCH 2/5] edited intro text and fixed typo --- docs/Map-API.md | 2 +- docs/named_maps.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Map-API.md b/docs/Map-API.md index bb74d209..df411259 100644 --- a/docs/Map-API.md +++ b/docs/Map-API.md @@ -1,6 +1,6 @@ # Maps API -The CartoDB Maps API allows you to generate maps based on data hosted in your CartoDB account and you can apply custom SQL and CartoCSS to the data. The API generates a XYZ-based URL to fetch Web Mercator projected tiles using web clients such as [Leaflet](http://leafletjs.com), [Google Maps](https://developers.google.com/maps/), or [OpenLayers](http://openlayers.org/). +The CartoDB Maps API allows you to generate maps based on data hosted in your CartoDB account and apply custom SQL and CartoCSS to the data. The API generates a XYZ-based URL to fetch Web Mercator projected tiles, using web clients such as [Leaflet](http://leafletjs.com), [Google Maps](https://developers.google.com/maps/), or [OpenLayers](http://openlayers.org/). You can create two types of maps with the Maps API: diff --git a/docs/named_maps.md b/docs/named_maps.md index 4129fc59..71c5fb88 100644 --- a/docs/named_maps.md +++ b/docs/named_maps.md @@ -12,7 +12,7 @@ The main two differences compared to anonymous maps are: Template maps are persistent with no preset expiration. They can only be created or deleted by a CartoDB user with a valid API_KEY (see auth section). -**Note:** There is a limit of 4,096 named maps allowed per account. If you need to create more Named Maps, it is recommended to use templates. +**Note:** There is a limit of 4,096 named maps allowed per account. If you need to create more Named maps, it is recommended to use templates. ## Create From 912b8f6ff4f5cdc385cdd512a0fc16aa63914c73 Mon Sep 17 00:00:00 2001 From: csobier Date: Fri, 29 Jan 2016 12:07:47 -0500 Subject: [PATCH 3/5] fixed title of named maps --- docs/named_maps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/named_maps.md b/docs/named_maps.md index 71c5fb88..56257628 100644 --- a/docs/named_maps.md +++ b/docs/named_maps.md @@ -1,4 +1,4 @@ -http://docs.cartodb.com/cartodb-platform/maps-api/mapconfig/# Named Maps +# Named Maps Named maps are essentially the same as anonymous maps except the MapConfig is stored on the server, and the map is given a unique name. You can create named maps from private data, and users without an API Key can view your Named Map (while keeping your data private). The Named map workflow consists of making a call to your database, referencing a table, inserting your variables into the template where placeholders are defined, and creating custom queries. From 1620cbc8df6df5a4e1bc82d204e04da2ea2d3415 Mon Sep 17 00:00:00 2001 From: csobier Date: Fri, 29 Jan 2016 12:11:21 -0500 Subject: [PATCH 4/5] modified title --- docs/named_maps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/named_maps.md b/docs/named_maps.md index 56257628..748ea7cc 100644 --- a/docs/named_maps.md +++ b/docs/named_maps.md @@ -437,7 +437,7 @@ curl -X GET 'https://documentation.cartodb.com/api/v1/map/named/:template_name?a } ``` -## Creating Named Maps with CartoDB.js +## Use CartoDB.js to Create Named Maps Named maps can be used with CartoDB.js by specifying a named map in a layer source as follows. Named maps are treated almost the same as other layer source types in most other ways. ```js From 5e77c50102917ee7cd9ce06e3f5ba66201eff307 Mon Sep 17 00:00:00 2001 From: csobier Date: Fri, 29 Jan 2016 16:46:42 -0500 Subject: [PATCH 5/5] changed relative links to absolute links --- docs/anonymous_maps.md | 2 +- docs/named_maps.md | 2 +- docs/static_maps_api.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/anonymous_maps.md b/docs/anonymous_maps.md index 31f585a2..02d35dc9 100644 --- a/docs/anonymous_maps.md +++ b/docs/anonymous_maps.md @@ -28,7 +28,7 @@ POST /api/v1/map } ``` -See [MapConfig File Formats](/cartodb-platform/maps-api/mapconfig/) for details. +See [MapConfig File Formats](http://docs.cartodb.com/cartodb-platform/maps-api/mapconfig/) for details. #### Response diff --git a/docs/named_maps.md b/docs/named_maps.md index 748ea7cc..4dac6d5c 100644 --- a/docs/named_maps.md +++ b/docs/named_maps.md @@ -91,7 +91,7 @@ auth | |_ method | `"token"` or `"open"` (the default if no `"method"` is given). |_ valid_tokens | when `"method"` is set to `"token"`, the values listed here allow you to instantiate the named map. placeholders | Variables not listed here are not substituted. Variables not provided at instantiation time trigger an error. A default is required for optional variables. Type specification is used for quoting, to avoid injections see template format section below. -layergroup | the layer list definition. This is the MapConfig explained in anonymous maps. See [MapConfig File Format](/cartodb-platform/maps-api/mapconfig/) for more info. +layergroup | the layer list definition. This is the MapConfig explained in anonymous maps. See [MapConfig File Format](http://docs.cartodb.com/cartodb-platform/maps-api/mapconfig/) for more info. view (optional) | extra keys to specify the compelling area for the map. It can be used to have a static preview of a named map without having to instantiate it. It is possible to specify it with `center` + `zoom` or with a bounding box `bbox`. Center+zoom takes precedence over bounding box. --- | --- diff --git a/docs/static_maps_api.md b/docs/static_maps_api.md index 426501d5..9c3c2d3d 100644 --- a/docs/static_maps_api.md +++ b/docs/static_maps_api.md @@ -127,7 +127,7 @@ By manipulating the `"urlTemplate"` custom basemaps can be used in generating st **CartoDB** -As described in the [MapConfig File Format](/cartodb-platform/maps-api/mapconfig/), a "cartodb" type layer is now just an alias to a "mapnik" type layer as above, intended for backwards compatibility. +As described in the [MapConfig File Format](http://docs.cartodb.com/cartodb-platform/maps-api/mapconfig/), a "cartodb" type layer is now just an alias to a "mapnik" type layer as above, intended for backwards compatibility. ```javascript {