├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── README.md ├── config.json.enc ├── config.json.example ├── create_named.js ├── dark-matter-all-lowercase.yml ├── dark-matter-all.yml ├── dark-matter-labels-only.yml ├── dark-matter-no-labels.yml ├── dark-matter.yml ├── data ├── README.md ├── cartodb_sql.js ├── core_functions.sql ├── datasets.txt ├── fixed_shps │ ├── ne_10m_admin_1_states_provinces_lines_shp.zip │ ├── ne_10m_geography_marine_polys.zip │ └── ne_50m_geography_marine_polys.zip ├── generalizations.yml ├── generalizations_sql.js ├── generalizations_sql_batch.js ├── global_functions.sql ├── import_extract.js ├── import_files.js ├── import_sync.js ├── imposm3_mapping.json ├── refresh.js ├── replicate.sh ├── small_shps │ ├── continents_900913.dbf │ ├── continents_900913.prj │ ├── continents_900913.shp │ └── continents_900913.shx └── syncdatasets.txt ├── deploy.sh ├── layers.yml ├── migrations └── v2.1.0.sql ├── package.json ├── positron-all-lowercase.yml ├── positron-all.yml ├── positron-labels-only.yml ├── positron-no-labels.yml ├── positron.yml └── styles ├── admin0boundaries.mss ├── admin1_labels.mss ├── admin1_labels_lowercase.mss ├── admin1boundaries.mss ├── admin1boundary_labels.mss ├── admin1boundary_labels_lowercase.mss ├── aeroways.mss ├── buildings.mss ├── continent_labels.mss ├── continent_labels_lowercase.mss ├── country_city_labels.mss ├── country_city_labels_lowercase.mss ├── false_background.mss ├── global_variables.mss ├── global_variables_dark.mss ├── global_variables_dark_lowercase.mss ├── global_variables_dark_only_labels.mss ├── global_variables_lowercase.mss ├── global_variables_only_labels.mss ├── green_areas.mss ├── images ├── bgnoise.png ├── capital_shield_dark.png ├── capital_shield_dark.svg ├── capital_shield_dark_444.png ├── capital_shield_dark_444.svg ├── capital_shield_dark_666.png ├── capital_shield_dark_666.svg ├── capital_shield_light.png ├── circles.png ├── city_shield_dark.svg ├── city_shield_dark_444.png ├── city_shield_dark_444.svg ├── city_shield_dark_666.png ├── city_shield_dark_666.svg ├── city_shield_light.svg ├── park-halftone-1.png ├── star.idraw └── star8.png ├── land_negative.mss ├── land_positive.mss ├── marine_labels.mss ├── marine_labels_lowercase.mss ├── ne10mroads.mss ├── osm_roads_labels.mss ├── osm_roads_labels_lowercase.mss ├── osmbridges.mss ├── osmroads.mss ├── osmtunnels.mss ├── park_labels.mss ├── park_labels_lowercase.mss ├── urban_areas.mss ├── water.mss ├── water_labels.mss └── water_labels_lowercase.mss /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | .env 3 | .thumb.png 4 | node_modules 5 | config.json 6 | config.json.dev 7 | config.json.prod 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | addons: 4 | apt: 5 | packages: 6 | - python-demjson 7 | deploy: 8 | provider: script 9 | script: ./deploy.sh 10 | skip_cleanup: true 11 | on: 12 | branch: develop 13 | install: 14 | - npm install 15 | script: 16 | - jsonlint data/imposm3_mapping.json 17 | - GLOBIGNORE="layers.yml:.travis.yml" 18 | - for style in *.yml; do 19 | jsonstyle="$(./node_modules/.bin/cartodb-yaml $style)" || exit 1; 20 | if [[ "$jsonstyle" == "{}" ]]; then echo "$style created an empty JSON file"; exit 1; fi 21 | done 22 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Creative Commons Legal Code 3 | 4 | Attribution 3.0 Unported 5 | 6 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 7 | LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN 8 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 9 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 10 | REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR 11 | DAMAGES RESULTING FROM ITS USE. 12 | 13 | License 14 | 15 | THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE 16 | COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY 17 | COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS 18 | AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. 19 | 20 | BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE 21 | TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY 22 | BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS 23 | CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND 24 | CONDITIONS. 25 | 26 | 1. Definitions 27 | 28 | a. "Adaptation" means a work based upon the Work, or upon the Work and 29 | other pre-existing works, such as a translation, adaptation, 30 | derivative work, arrangement of music or other alterations of a 31 | literary or artistic work, or phonogram or performance and includes 32 | cinematographic adaptations or any other form in which the Work may be 33 | recast, transformed, or adapted including in any form recognizably 34 | derived from the original, except that a work that constitutes a 35 | Collection will not be considered an Adaptation for the purpose of 36 | this License. For the avoidance of doubt, where the Work is a musical 37 | work, performance or phonogram, the synchronization of the Work in 38 | timed-relation with a moving image ("synching") will be considered an 39 | Adaptation for the purpose of this License. 40 | b. "Collection" means a collection of literary or artistic works, such as 41 | encyclopedias and anthologies, or performances, phonograms or 42 | broadcasts, or other works or subject matter other than works listed 43 | in Section 1(f) below, which, by reason of the selection and 44 | arrangement of their contents, constitute intellectual creations, in 45 | which the Work is included in its entirety in unmodified form along 46 | with one or more other contributions, each constituting separate and 47 | independent works in themselves, which together are assembled into a 48 | collective whole. A work that constitutes a Collection will not be 49 | considered an Adaptation (as defined above) for the purposes of this 50 | License. 51 | c. "Distribute" means to make available to the public the original and 52 | copies of the Work or Adaptation, as appropriate, through sale or 53 | other transfer of ownership. 54 | d. "Licensor" means the individual, individuals, entity or entities that 55 | offer(s) the Work under the terms of this License. 56 | e. "Original Author" means, in the case of a literary or artistic work, 57 | the individual, individuals, entity or entities who created the Work 58 | or if no individual or entity can be identified, the publisher; and in 59 | addition (i) in the case of a performance the actors, singers, 60 | musicians, dancers, and other persons who act, sing, deliver, declaim, 61 | play in, interpret or otherwise perform literary or artistic works or 62 | expressions of folklore; (ii) in the case of a phonogram the producer 63 | being the person or legal entity who first fixes the sounds of a 64 | performance or other sounds; and, (iii) in the case of broadcasts, the 65 | organization that transmits the broadcast. 66 | f. "Work" means the literary and/or artistic work offered under the terms 67 | of this License including without limitation any production in the 68 | literary, scientific and artistic domain, whatever may be the mode or 69 | form of its expression including digital form, such as a book, 70 | pamphlet and other writing; a lecture, address, sermon or other work 71 | of the same nature; a dramatic or dramatico-musical work; a 72 | choreographic work or entertainment in dumb show; a musical 73 | composition with or without words; a cinematographic work to which are 74 | assimilated works expressed by a process analogous to cinematography; 75 | a work of drawing, painting, architecture, sculpture, engraving or 76 | lithography; a photographic work to which are assimilated works 77 | expressed by a process analogous to photography; a work of applied 78 | art; an illustration, map, plan, sketch or three-dimensional work 79 | relative to geography, topography, architecture or science; a 80 | performance; a broadcast; a phonogram; a compilation of data to the 81 | extent it is protected as a copyrightable work; or a work performed by 82 | a variety or circus performer to the extent it is not otherwise 83 | considered a literary or artistic work. 84 | g. "You" means an individual or entity exercising rights under this 85 | License who has not previously violated the terms of this License with 86 | respect to the Work, or who has received express permission from the 87 | Licensor to exercise rights under this License despite a previous 88 | violation. 89 | h. "Publicly Perform" means to perform public recitations of the Work and 90 | to communicate to the public those public recitations, by any means or 91 | process, including by wire or wireless means or public digital 92 | performances; to make available to the public Works in such a way that 93 | members of the public may access these Works from a place and at a 94 | place individually chosen by them; to perform the Work to the public 95 | by any means or process and the communication to the public of the 96 | performances of the Work, including by public digital performance; to 97 | broadcast and rebroadcast the Work by any means including signs, 98 | sounds or images. 99 | i. "Reproduce" means to make copies of the Work by any means including 100 | without limitation by sound or visual recordings and the right of 101 | fixation and reproducing fixations of the Work, including storage of a 102 | protected performance or phonogram in digital form or other electronic 103 | medium. 104 | 105 | 2. Fair Dealing Rights. Nothing in this License is intended to reduce, 106 | limit, or restrict any uses free from copyright or rights arising from 107 | limitations or exceptions that are provided for in connection with the 108 | copyright protection under copyright law or other applicable laws. 109 | 110 | 3. License Grant. Subject to the terms and conditions of this License, 111 | Licensor hereby grants You a worldwide, royalty-free, non-exclusive, 112 | perpetual (for the duration of the applicable copyright) license to 113 | exercise the rights in the Work as stated below: 114 | 115 | a. to Reproduce the Work, to incorporate the Work into one or more 116 | Collections, and to Reproduce the Work as incorporated in the 117 | Collections; 118 | b. to create and Reproduce Adaptations provided that any such Adaptation, 119 | including any translation in any medium, takes reasonable steps to 120 | clearly label, demarcate or otherwise identify that changes were made 121 | to the original Work. For example, a translation could be marked "The 122 | original work was translated from English to Spanish," or a 123 | modification could indicate "The original work has been modified."; 124 | c. to Distribute and Publicly Perform the Work including as incorporated 125 | in Collections; and, 126 | d. to Distribute and Publicly Perform Adaptations. 127 | e. For the avoidance of doubt: 128 | 129 | i. Non-waivable Compulsory License Schemes. In those jurisdictions in 130 | which the right to collect royalties through any statutory or 131 | compulsory licensing scheme cannot be waived, the Licensor 132 | reserves the exclusive right to collect such royalties for any 133 | exercise by You of the rights granted under this License; 134 | ii. Waivable Compulsory License Schemes. In those jurisdictions in 135 | which the right to collect royalties through any statutory or 136 | compulsory licensing scheme can be waived, the Licensor waives the 137 | exclusive right to collect such royalties for any exercise by You 138 | of the rights granted under this License; and, 139 | iii. Voluntary License Schemes. The Licensor waives the right to 140 | collect royalties, whether individually or, in the event that the 141 | Licensor is a member of a collecting society that administers 142 | voluntary licensing schemes, via that society, from any exercise 143 | by You of the rights granted under this License. 144 | 145 | The above rights may be exercised in all media and formats whether now 146 | known or hereafter devised. The above rights include the right to make 147 | such modifications as are technically necessary to exercise the rights in 148 | other media and formats. Subject to Section 8(f), all rights not expressly 149 | granted by Licensor are hereby reserved. 150 | 151 | 4. Restrictions. The license granted in Section 3 above is expressly made 152 | subject to and limited by the following restrictions: 153 | 154 | a. You may Distribute or Publicly Perform the Work only under the terms 155 | of this License. You must include a copy of, or the Uniform Resource 156 | Identifier (URI) for, this License with every copy of the Work You 157 | Distribute or Publicly Perform. You may not offer or impose any terms 158 | on the Work that restrict the terms of this License or the ability of 159 | the recipient of the Work to exercise the rights granted to that 160 | recipient under the terms of the License. You may not sublicense the 161 | Work. You must keep intact all notices that refer to this License and 162 | to the disclaimer of warranties with every copy of the Work You 163 | Distribute or Publicly Perform. When You Distribute or Publicly 164 | Perform the Work, You may not impose any effective technological 165 | measures on the Work that restrict the ability of a recipient of the 166 | Work from You to exercise the rights granted to that recipient under 167 | the terms of the License. This Section 4(a) applies to the Work as 168 | incorporated in a Collection, but this does not require the Collection 169 | apart from the Work itself to be made subject to the terms of this 170 | License. If You create a Collection, upon notice from any Licensor You 171 | must, to the extent practicable, remove from the Collection any credit 172 | as required by Section 4(b), as requested. If You create an 173 | Adaptation, upon notice from any Licensor You must, to the extent 174 | practicable, remove from the Adaptation any credit as required by 175 | Section 4(b), as requested. 176 | b. If You Distribute, or Publicly Perform the Work or any Adaptations or 177 | Collections, You must, unless a request has been made pursuant to 178 | Section 4(a), keep intact all copyright notices for the Work and 179 | provide, reasonable to the medium or means You are utilizing: (i) the 180 | name of the Original Author (or pseudonym, if applicable) if supplied, 181 | and/or if the Original Author and/or Licensor designate another party 182 | or parties (e.g., a sponsor institute, publishing entity, journal) for 183 | attribution ("Attribution Parties") in Licensor's copyright notice, 184 | terms of service or by other reasonable means, the name of such party 185 | or parties; (ii) the title of the Work if supplied; (iii) to the 186 | extent reasonably practicable, the URI, if any, that Licensor 187 | specifies to be associated with the Work, unless such URI does not 188 | refer to the copyright notice or licensing information for the Work; 189 | and (iv) , consistent with Section 3(b), in the case of an Adaptation, 190 | a credit identifying the use of the Work in the Adaptation (e.g., 191 | "French translation of the Work by Original Author," or "Screenplay 192 | based on original Work by Original Author"). The credit required by 193 | this Section 4 (b) may be implemented in any reasonable manner; 194 | provided, however, that in the case of a Adaptation or Collection, at 195 | a minimum such credit will appear, if a credit for all contributing 196 | authors of the Adaptation or Collection appears, then as part of these 197 | credits and in a manner at least as prominent as the credits for the 198 | other contributing authors. For the avoidance of doubt, You may only 199 | use the credit required by this Section for the purpose of attribution 200 | in the manner set out above and, by exercising Your rights under this 201 | License, You may not implicitly or explicitly assert or imply any 202 | connection with, sponsorship or endorsement by the Original Author, 203 | Licensor and/or Attribution Parties, as appropriate, of You or Your 204 | use of the Work, without the separate, express prior written 205 | permission of the Original Author, Licensor and/or Attribution 206 | Parties. 207 | c. Except as otherwise agreed in writing by the Licensor or as may be 208 | otherwise permitted by applicable law, if You Reproduce, Distribute or 209 | Publicly Perform the Work either by itself or as part of any 210 | Adaptations or Collections, You must not distort, mutilate, modify or 211 | take other derogatory action in relation to the Work which would be 212 | prejudicial to the Original Author's honor or reputation. Licensor 213 | agrees that in those jurisdictions (e.g. Japan), in which any exercise 214 | of the right granted in Section 3(b) of this License (the right to 215 | make Adaptations) would be deemed to be a distortion, mutilation, 216 | modification or other derogatory action prejudicial to the Original 217 | Author's honor and reputation, the Licensor will waive or not assert, 218 | as appropriate, this Section, to the fullest extent permitted by the 219 | applicable national law, to enable You to reasonably exercise Your 220 | right under Section 3(b) of this License (right to make Adaptations) 221 | but not otherwise. 222 | 223 | 5. Representations, Warranties and Disclaimer 224 | 225 | UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR 226 | OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY 227 | KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, 228 | INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, 229 | FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF 230 | LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, 231 | WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION 232 | OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. 233 | 234 | 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE 235 | LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR 236 | ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES 237 | ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS 238 | BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 239 | 240 | 7. Termination 241 | 242 | a. This License and the rights granted hereunder will terminate 243 | automatically upon any breach by You of the terms of this License. 244 | Individuals or entities who have received Adaptations or Collections 245 | from You under this License, however, will not have their licenses 246 | terminated provided such individuals or entities remain in full 247 | compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will 248 | survive any termination of this License. 249 | b. Subject to the above terms and conditions, the license granted here is 250 | perpetual (for the duration of the applicable copyright in the Work). 251 | Notwithstanding the above, Licensor reserves the right to release the 252 | Work under different license terms or to stop distributing the Work at 253 | any time; provided, however that any such election will not serve to 254 | withdraw this License (or any other license that has been, or is 255 | required to be, granted under the terms of this License), and this 256 | License will continue in full force and effect unless terminated as 257 | stated above. 258 | 259 | 8. Miscellaneous 260 | 261 | a. Each time You Distribute or Publicly Perform the Work or a Collection, 262 | the Licensor offers to the recipient a license to the Work on the same 263 | terms and conditions as the license granted to You under this License. 264 | b. Each time You Distribute or Publicly Perform an Adaptation, Licensor 265 | offers to the recipient a license to the original Work on the same 266 | terms and conditions as the license granted to You under this License. 267 | c. If any provision of this License is invalid or unenforceable under 268 | applicable law, it shall not affect the validity or enforceability of 269 | the remainder of the terms of this License, and without further action 270 | by the parties to this agreement, such provision shall be reformed to 271 | the minimum extent necessary to make such provision valid and 272 | enforceable. 273 | d. No term or provision of this License shall be deemed waived and no 274 | breach consented to unless such waiver or consent shall be in writing 275 | and signed by the party to be charged with such waiver or consent. 276 | e. This License constitutes the entire agreement between the parties with 277 | respect to the Work licensed here. There are no understandings, 278 | agreements or representations with respect to the Work not specified 279 | here. Licensor shall not be bound by any additional provisions that 280 | may appear in any communication from You. This License may not be 281 | modified without the mutual written agreement of the Licensor and You. 282 | f. The rights granted under, and the subject matter referenced, in this 283 | License were drafted utilizing the terminology of the Berne Convention 284 | for the Protection of Literary and Artistic Works (as amended on 285 | September 28, 1979), the Rome Convention of 1961, the WIPO Copyright 286 | Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 287 | and the Universal Copyright Convention (as revised on July 24, 1971). 288 | These rights and subject matter take effect in the relevant 289 | jurisdiction in which the License terms are sought to be enforced 290 | according to the corresponding provisions of the implementation of 291 | those treaty provisions in the applicable national law. If the 292 | standard suite of rights granted under applicable copyright law 293 | includes additional rights not granted under this License, such 294 | additional rights are deemed to be included in the License; this 295 | License is not intended to restrict the license of any rights under 296 | applicable law. 297 | 298 | 299 | Creative Commons Notice 300 | 301 | Creative Commons is not a party to this License, and makes no warranty 302 | whatsoever in connection with the Work. Creative Commons will not be 303 | liable to You or any party on any legal theory for any damages 304 | whatsoever, including without limitation any general, special, 305 | incidental or consequential damages arising in connection to this 306 | license. Notwithstanding the foregoing two (2) sentences, if Creative 307 | Commons has expressly identified itself as the Licensor hereunder, it 308 | shall have all rights and obligations of Licensor. 309 | 310 | Except for the limited purpose of indicating to the public that the 311 | Work is licensed under the CCPL, Creative Commons does not authorize 312 | the use by either party of the trademark "Creative Commons" or any 313 | related trademark or logo of Creative Commons without the prior 314 | written consent of Creative Commons. Any permitted use will be in 315 | compliance with Creative Commons' then-current trademark usage 316 | guidelines, as may be published on its website or otherwise made 317 | available upon request from time to time. For the avoidance of doubt, 318 | this trademark restriction does not form part of this License. 319 | 320 | Creative Commons may be contacted at http://creativecommons.org/. 321 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CartoDB Basemaps 2 | 3 | This is the source code and styles for the [CartoDB Basemaps](http://cartodb.com/basemaps), designed by [Stamen](http://stamen.com). 4 | 5 | The code and styles here are intended for serving the basemaps on your own local CartoDB instance and developing the styles, if you just want to use them for your own map, you should use our [hosted version](http://cartodb.com/basemaps). 6 | 7 | ## What does what? 8 | 9 | This style is designed to work with CartoDB and Windshaft, so is structured differently than a standard CartoCSS project. 10 | 11 | * All CartoCSS styles live in [`/styles`](styles/). Layers for a map style are defined in named YAML files in the root directory, and it selects layers from the layers catalog in [`layers.yml`](layers.yml). 12 | 13 | * The map style layers file is combined with the catalog using [cartodb-yaml](https://github.com/stamen/cartodb-yaml) 14 | 15 | * There's two places where database stuff (materialized views, PL/PGSQL functions) are defined. 16 | * [`global_functions.sql`](data/global_functions.sql) is where all the functions go. This needs to be loaded first. 17 | * [`generalizations.yml`](data/generalizations.yml) describes the materialized views, this is read by `generalizations_sql.js` to output either raw SQL or issue queries. 18 | 19 | 20 | ## Setup 21 | 22 | Install the required software with `npm install` 23 | 24 | ### Authentication 25 | 26 | Create a the file `config.json` in this directory with your CartoDB host and API key. An example is [`config.json.template`](config.json.template). 27 | 28 | ```json 29 | { 30 | "api_key": "API_KEY", 31 | "cdb_url": "https://myuser.cartodb.com" 32 | } 33 | ``` 34 | 35 | You can find the API key at https://myuser.cartodb.com/your_apps 36 | 37 | ## Loading data 38 | 39 | Instructions for loading data into a CartoDB instance can be found in [the data readme](data/README.md). 40 | 41 | ## Development 42 | 43 | This style is intended to be used with the [Atom text editor](*https://atom.io/) and [CartoDB extension](https://github.com/stamen/atom-cartodb). 44 | 45 | 1. [Download and install Atom](https://atom.io/). 46 | 2. Install the cartodb and language-carto packages. 47 | 3. [Set the CartoDB username (e.g. `myuser`) and API key](https://github.com/stamen/atom-cartodb#configuration) 48 | 4. Open a map YAML file, e.g. [positron-all.yml](positron-all.yml). 49 | 5. Under Packages -> CartoDB, open a preview 50 | 51 | ## Named map creation 52 | 53 | To let users access the basemap without an API key, the script `create_named.js` can be used. 54 | 55 | For the six maps listed on [the basemap page](https://cartodb.com/basemaps) this can be done with 56 | 57 | ```sh 58 | node create_named.js positron-all.yml light_all 59 | node create_named.js positron-all-lowercase.yml light_all_lowercase 60 | node create_named.js positron-no-labels.yml light_nolabels 61 | node create_named.js positron-labels-only.yml light_only_labels 62 | node create_named.js dark-matter-all.yml dark_all 63 | node create_named.js dark-matter-all-lowercase.yml dark_all_lowercase 64 | node create_named.js dark-matter-no-labels.yml dark_nolabels 65 | node create_named.js dark-matter-labels-only.yml dark_only_labels 66 | ``` 67 | 68 | ## Versioning 69 | 70 | This project follows a MAJOR.MINOR.PATCH versioning system. In the context of a cartographic project you can expect the following: 71 | 72 | PATCH: When a patch version is released, there would be no reason not to upgrade. PATCH versions contain only bugfixes e.g. stylesheets won't compile, features are missing by mistake, etc. 73 | 74 | MINOR: These are routine releases. They will contain changes to what's shown on the map, how they appear, new features added and old features removed. They may rarely contain changes to assets i.e. shapefiles and fonts but will not contain changes that require software or database reloads. They may contain function or view changes that can be done without downtime or a reload. 75 | 76 | MAJOR: Any change the requires reloading a database, or upgrading software dependecies will trigger a major version change. 77 | 78 | The `master` branch only contains versions tagged and released, while work is merged to the `develop` branch. 79 | 80 | ## Releases 81 | 82 | Commits from the develop branch are automatically pushed to the develop basemap server by Travis. Releases require manually pushing to the production server with `create_named.js`. 83 | -------------------------------------------------------------------------------- /config.json.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/config.json.enc -------------------------------------------------------------------------------- /config.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "cdb_url": "https://myaccount.cartodb.com", 3 | "api_key": "" 4 | } 5 | -------------------------------------------------------------------------------- /create_named.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Takes a YAML file for a map and uploads it as a named map 3 | * Usage: node create_named.js 4 | * 5 | * This is roughly equivalent to 6 | * cartodb-yaml foo.yaml > foo.json 7 | * curl -X DELETE CARTODB_URL/api/v1/map/named/foo 8 | * # fiddle with foo.json 9 | * curl -X POST -d @foo.json CARTODB_URL/api/v1/map/named 10 | */ 11 | var fs = require("fs"); 12 | var request = require('request'); 13 | var compile = require('cartodb-yaml'); 14 | var async = require('async'); 15 | 16 | require("http").globalAgent.maxSockets = 1; 17 | 18 | var API_KEY; 19 | var CARTODB_URL; 20 | if (process.env.CARTODB_API_KEY && process.env.CARTODB_URL) { 21 | API_KEY = process.env.CARTODB_API_KEY; 22 | CARTODB_URL = process.env.CARTODB_URL; 23 | } else { 24 | console.log("Reading config variables from config.json"); 25 | json = JSON.parse(fs.readFileSync("config.json")); 26 | API_KEY = json.api_key; 27 | CARTODB_URL = json.cdb_url; 28 | } 29 | 30 | request = request.defaults({"baseUrl": CARTODB_URL + '/api/v1/'}) 31 | 32 | var deleteNamed = function(name, callback) { 33 | var get = { 34 | method: "DELETE", 35 | uri: 'map/named/' + name + '?api_key=' + API_KEY 36 | } 37 | request(get, function(error, response, body) { 38 | if(error) return callback(error); 39 | if (response.statusCode == 404) { 40 | console.log("Map " + name + " does not exist, DELETE did not do anything") 41 | } else if (response.statusCode == 204) { 42 | console.log("Map " + name + " deleted") 43 | } else { 44 | throw "Unknown response deleting"; 45 | callback(error); 46 | } 47 | }) 48 | } 49 | 50 | var createNamed = function(json, name, callback) { 51 | json.auth = "open" // https://github.com/stamen/cartodb-yaml/issues/1 52 | json.name = name 53 | 54 | var post = { 55 | method: "POST", 56 | uri: 'map/named' + '?api_key=' + API_KEY, 57 | body: json, 58 | json: true 59 | } 60 | request(post, function(error, response, body) { 61 | if(error) return callback(error); 62 | 63 | console.log("Map " + name + " created as " + response.body.template_id); 64 | }) 65 | } 66 | 67 | 68 | function make(filename, named_map_name) { 69 | var json = compile(fs.readFileSync(filename, "utf8")); 70 | 71 | deleteNamed(named_map_name, function(error){ 72 | if(error) { 73 | throw "error deleting"; 74 | } 75 | }); 76 | 77 | createNamed(json, named_map_name, function(error){}); 78 | } 79 | 80 | make(process.argv[2], process.argv[3]); 81 | -------------------------------------------------------------------------------- /dark-matter-all-lowercase.yml: -------------------------------------------------------------------------------- 1 | name: DarkMatter-all-lowercase 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: styles/global_variables_dark_lowercase.mss 7 | - false_background: 8 | - land_positive: 9 | - urban_areas: 10 | - green_areas: 11 | - admin0boundaries: 12 | - admin1boundaries: 13 | - water: 14 | - aeroways: 15 | - ne10mroads: 16 | - buildings: 17 | - osmtunnels: 18 | - osmroads: 19 | - osmbridges: 20 | - country_city_labels_lowercase: 21 | - park_labels_lowercase: 22 | - water_labels_lowercase: 23 | - osm_roads_labels_lowercase: 24 | - marine_labels_lowercase: 25 | - admin1boundary_labels_lowercase: 26 | - admin1_labels_lowercase: 27 | - continent_labels_lowercase: 28 | -------------------------------------------------------------------------------- /dark-matter-all.yml: -------------------------------------------------------------------------------- 1 | name: DarkMatter-all 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: styles/global_variables_dark.mss 7 | - false_background: 8 | - land_positive: 9 | - urban_areas: 10 | - green_areas: 11 | - admin0boundaries: 12 | - admin1boundaries: 13 | - water: 14 | - aeroways: 15 | - ne10mroads: 16 | - buildings: 17 | - osmtunnels: 18 | - osmroads: 19 | - osmbridges: 20 | - country_city_labels: 21 | - park_labels: 22 | - water_labels: 23 | - osm_roads_labels: 24 | - marine_labels: 25 | - admin1boundary_labels: 26 | - admin1_labels: 27 | - continent_labels: 28 | -------------------------------------------------------------------------------- /dark-matter-labels-only.yml: -------------------------------------------------------------------------------- 1 | name: DarkMatter-labels-only 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: styles/global_variables_dark_only_labels.mss 7 | - country_city_labels: 8 | - park_labels: 9 | - water_labels: 10 | - osm_roads_labels: 11 | - marine_labels: 12 | - admin1boundary_labels: 13 | - admin1_labels: 14 | - continent_labels: 15 | -------------------------------------------------------------------------------- /dark-matter-no-labels.yml: -------------------------------------------------------------------------------- 1 | name: DarkMatter-no-labels 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: styles/global_variables_dark.mss 7 | - false_background: 8 | - land_positive: 9 | - urban_areas: 10 | - green_areas: 11 | - admin0boundaries: 12 | - admin1boundaries: 13 | - water: 14 | - aeroways: 15 | - ne10mroads: 16 | - buildings: 17 | - osmtunnels: 18 | - osmroads: 19 | - osmbridges: 20 | -------------------------------------------------------------------------------- /dark-matter.yml: -------------------------------------------------------------------------------- 1 | name: DarkMatter 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: styles/global_variables_dark.mss 7 | - false_background: 8 | - land_positive: 9 | - admin0boundaries: 10 | - admin1boundaries: 11 | - water: 12 | - aeroways: 13 | - ne10mroads: 14 | - osmtunnels: 15 | - osmroads: 16 | - osmbridges: 17 | - country_city_labels: 18 | - park_labels: 19 | - water_labels: 20 | - osm_roads_labels: 21 | - marine_labels: 22 | - admin1boundary_labels: 23 | - admin1_labels: 24 | - continent_labels: 25 | -------------------------------------------------------------------------------- /data/README.md: -------------------------------------------------------------------------------- 1 | # CartoDB Basemaps Data 2 | 3 | Some parts of loading data onto a CartoDB instance require direct access, not access through the SQL API. 4 | 5 | ## Loading data 6 | ### Installing static data and coastlines 7 | 1. Run `node import_files.js` to import Natural Earth and other static data. This requires your CartoDB instance have external internet connectivity. A total of about 150MB of space is required. 8 | 2. Run `node import_sync.js` to import coastline data. This requires your CartoDB instance have external internet connectivity. A total of about 600MB of space is required. 9 | 10 | ### Importing OSM data 11 | 1. Install imposm3, e.g. from [Imposm3 static releases](http://imposm.org/static/rel/) or [building from source](https://github.com/omniscale/imposm3). The machine with Imposm3 must have PostgreSQL access to your CartoDB instance. 12 | 2. Set PostgreSQL environment variables with 13 | ```sh 14 | export PGUSER=cartodb_user_uid 15 | export PGDATABASE="${PGUSER}_db" 16 | # Required so imposm3 won't time out 17 | export PGOPTIONS="-c statement_timeout=0" 18 | # Setting PGHOST allows use of sockets. This may need adjusting on different OSes, or for network connections 19 | # See https://github.com/omniscale/imposm3/issues/43 20 | export PGHOST=/var/run/postgresql 21 | ``` 22 | 3. Download OpenStreetMap data from [planet.openstreetmap.org](http://planet.openstreetmap.org/), [Geofabrik Extracts](http://download.geofabrik.de/), or [Mapzen Metro Extracts](https://mapzen.com/data/metro-extracts). 23 | 4. Enable hstore on the database with ``psql -U postgres -c 'CREATE EXTENSION IF NOT EXISTS hstore;'`` 24 | *PostGIS was previously set up by the static data instructions.* 25 | 5. *Optional: Remove previous imposm3 imports with* 26 | ```sh 27 | psql -c 'DROP TABLE IF EXISTS planet CASCADE; DROP SCHEMA IF EXISTS import CASCADE; DROP SCHEMA IF EXISTS backup CASCADE;' 28 | ``` 29 | *If planning on consuming replication updates from OSM, read the updating section before running these commands* 30 | 6. Import an OSM extract into your db, using `imposm3_mapping.json`. This can be done with 31 | ```sh 32 | imposm3 import -mapping imposm3_mapping.json \ 33 | -connection='postgis://?prefix=NONE' \ 34 | -read path/to/extract.osm.pbf -write \ 35 | -deployproduction -overwritecache 36 | ``` 37 | *Imposm3 has additional options which are worth exploring for larger imports* 38 | 39 | 7. Import `core_functions.sql` into your DB with `node cartodb_sql.js -f core_functions.sql` 40 | 8. run `node generalizations_sql.js | node cartodb_sql.js -f /dev/stdin` into your DB. If dealing with a full planet extract, this should be done on the database server with `node generalizations_sql.js | psql`. 41 | *It can be more efficient to run this on the DB server in parallel* 42 | - You can alternatively run `node generalizations_sql_batch.js` to execute the generalizations in parallel over the CartoDB SQL Batch API. 43 | 9. Import `global_functions.sql` into your DB with `node cartodb_sql.js -f global_functions.sql` 44 | 45 | 10. Ensure the Azo Sans, DejaVu unicode, unifont fonts are available on your instance. 46 | 47 | ## Updating data 48 | ### Coastlines and other quasi-static data 49 | 50 | TODO: Convert static data instructions to use sync tables 51 | 52 | ### OpenStreetMap data 53 | Updating OpenStreetMap data requires importing the data slightly differently. Instead of the command line above, add the ``-cachedir`` option to set a persistent cache directory, and the ``-diff`` option to store some additional data. 54 | 55 | The PGUSER and other libpq environment variables need to be set like above. 56 | 57 | ```sh 58 | # Because we're going to use it a lot, set the cache directory to a variable 59 | imposm3 import -mapping imposm3_mapping.json \ 60 | -cachedir imposm3_cache -diff 61 | -connection='postgis://?prefix=NONE' \ 62 | -read path/to/extract.osm.pbf -write \ 63 | -deployproduction -overwritecache 64 | ``` 65 | 66 | The global functions and generalizations are created like normal. 67 | 68 | A sample script that uses Osmosis to fetch diffs is included as replicate.sh. To 69 | set up the script on Ubuntu using the user `ubuntu`, do 70 | 71 | ```sh 72 | mkdir -p /home/ubuntu/replicate 73 | cd /home/ubuntu/replicate 74 | git clone https://github.com/CartoDB/CartoDB-basemaps.git # note: won't work until develop branch is merged 75 | # download imposm3 into an imposm3 directory 76 | # import, using replicate/imposm3_cache as a cache dir 77 | osmosis --rrii 78 | # edit configuration.txt if needed 79 | # download an appropriate state.txt 80 | ``` 81 | 82 | For production purposes, you probably want to put the script into Chef or similar, and change some paths. 83 | 84 | ### Refreshing views 85 | To generate the SQL necessary to update the views, run `node refresh.js`. 86 | -------------------------------------------------------------------------------- /data/cartodb_sql.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | var request = require('request'); 3 | var CONFIG = JSON.parse(fs.readFileSync("../config.json")); 4 | 5 | if (process.argv[2] == '-c') { 6 | var post = { 7 | method: "post", 8 | uri: CONFIG.cdb_url + '/api/v2/sql', 9 | form: {q: process.argv[3], api_key: CONFIG.api_key} 10 | } 11 | request(post, function (error, response, body) { 12 | if (error || response.statusCode != 200) { 13 | console.log(error); 14 | console.log(body); 15 | return 16 | } 17 | console.log(body); 18 | }) 19 | } 20 | 21 | if (process.argv[2] == '-f') { 22 | var sql = fs.readFileSync(process.argv[3]); 23 | var post = { 24 | method: "post", 25 | uri: CONFIG.cdb_url + '/api/v2/sql', 26 | form: {q: sql, api_key: CONFIG.api_key} 27 | } 28 | request(post, function (error, response, body) { 29 | if (error || response.statusCode != 200) { 30 | console.log(error); 31 | console.log(body); 32 | return 33 | } 34 | console.log(body); 35 | }) 36 | } 37 | 38 | -------------------------------------------------------------------------------- /data/core_functions.sql: -------------------------------------------------------------------------------- 1 | -- These functions are basic ones which do not depend on OSM data or any mat views, 2 | -- but other functions or views may depend on them. 3 | 4 | SET client_min_messages TO WARNING; 5 | 6 | BEGIN; 7 | 8 | CREATE OR REPLACE FUNCTION generalize(geom geometry, zoom int) RETURNS geometry 9 | AS $$ 10 | -- generalize to 1/4 pixel (assuming 256x256 tiles) 11 | SELECT ST_Simplify(geom, 20037508.34 * 2 / 2^(9 + zoom)); 12 | $$ LANGUAGE SQL IMMUTABLE; 13 | 14 | CREATE OR REPLACE FUNCTION numeric_or_zero(s text) RETURNS numeric 15 | AS 16 | $$ 17 | SELECT CASE WHEN s ~ '^[0-9]+$' THEN s::numeric ELSE 0 END; 18 | $$ 19 | LANGUAGE SQL IMMUTABLE; 20 | 21 | CREATE OR REPLACE FUNCTION numeric_or_zero(s numeric) RETURNS numeric 22 | AS 23 | $$ 24 | SELECT s::numeric; 25 | $$ 26 | LANGUAGE SQL IMMUTABLE; 27 | 28 | -- see https://github.com/omniscale/imposm3/blob/master/mapping/fields.go#L199 29 | CREATE OR REPLACE FUNCTION wayzorder(tags hstore) RETURNS integer 30 | AS $$ 31 | DECLARE 32 | z INTEGER; 33 | BEGIN 34 | z = 0; 35 | IF tags ? 'layer' THEN 36 | z = z + numeric_or_zero(tags -> 'layer') * 10; 37 | END IF; 38 | 39 | CASE 40 | WHEN tags -> 'highway' IN ('road','unclassified','residential','living_street','tertiary_link', 41 | 'secondary_link','primary_link','trunk_link','motorway_link') THEN 42 | z = z + 3; 43 | WHEN tags -> 'highway' = 'tertiary' THEN 44 | z = z + 4; 45 | WHEN tags -> 'highway' = 'secondary' THEN 46 | z = z + 5; 47 | WHEN tags -> 'highway' = 'primary' THEN 48 | z = z + 6; 49 | WHEN tags -> 'highway' = 'trunk' THEN 50 | z = z + 8; 51 | WHEN tags -> 'highway' = 'motorway' THEN 52 | z = z + 9; 53 | ELSE 54 | IF tags ? 'railway' AND tags -> 'railway' != 'no' THEN 55 | z = z + 7; 56 | END IF; 57 | END CASE; 58 | 59 | IF tags -> 'tunnel' IN ('true','yes','1') THEN 60 | z = z - 10; 61 | END IF; 62 | 63 | IF tags -> 'bridge' IN ('true','yes','1') THEN 64 | z = z + 10; 65 | END IF; 66 | 67 | RETURN z; 68 | END 69 | $$ LANGUAGE plpgsql IMMUTABLE; 70 | 71 | CREATE OR REPLACE FUNCTION zoom(scaleDenominator numeric) RETURNS int AS $$ 72 | BEGIN 73 | CASE 74 | WHEN scaleDenominator > 1000000000 THEN RETURN 0; 75 | WHEN scaleDenominator <= 1000000000 AND scaleDenominator > 500000000 THEN RETURN 1; 76 | WHEN scaleDenominator <= 500000000 AND scaleDenominator > 200000000 THEN RETURN 2; 77 | WHEN scaleDenominator <= 200000000 AND scaleDenominator > 100000000 THEN RETURN 3; 78 | WHEN scaleDenominator <= 100000000 AND scaleDenominator > 50000000 THEN RETURN 3; 79 | WHEN scaleDenominator <= 50000000 AND scaleDenominator > 25000000 THEN RETURN 4; 80 | WHEN scaleDenominator <= 25000000 AND scaleDenominator > 12500000 THEN RETURN 5; 81 | WHEN scaleDenominator <= 12500000 AND scaleDenominator > 6500000 THEN RETURN 6; 82 | WHEN scaleDenominator <= 6500000 AND scaleDenominator > 3000000 THEN RETURN 7; 83 | WHEN scaleDenominator <= 3000000 AND scaleDenominator > 1500000 THEN RETURN 8; 84 | WHEN scaleDenominator <= 1500000 AND scaleDenominator > 750000 THEN RETURN 9; 85 | WHEN scaleDenominator <= 750000 AND scaleDenominator > 400000 THEN RETURN 10; 86 | WHEN scaleDenominator <= 400000 AND scaleDenominator > 200000 THEN RETURN 11; 87 | WHEN scaleDenominator <= 200000 AND scaleDenominator > 100000 THEN RETURN 12; 88 | WHEN scaleDenominator <= 100000 AND scaleDenominator > 50000 THEN RETURN 13; 89 | WHEN scaleDenominator <= 50000 AND scaleDenominator > 25000 THEN RETURN 14; 90 | WHEN scaleDenominator <= 25000 AND scaleDenominator > 12500 THEN RETURN 15; 91 | WHEN scaleDenominator <= 12500 AND scaleDenominator > 5000 THEN RETURN 16; 92 | WHEN scaleDenominator <= 5000 AND scaleDenominator > 2500 THEN RETURN 17; 93 | WHEN scaleDenominator <= 2500 AND scaleDenominator > 1500 THEN RETURN 18; 94 | WHEN scaleDenominator <= 1500 AND scaleDenominator > 750 THEN RETURN 19; 95 | WHEN scaleDenominator <= 750 AND scaleDenominator > 500 THEN RETURN 20; 96 | WHEN scaleDenominator <= 500 AND scaleDenominator > 250 THEN RETURN 21; 97 | WHEN scaleDenominator <= 250 AND scaleDenominator > 100 THEN RETURN 22; 98 | WHEN scaleDenominator <= 100 THEN RETURN 23; 99 | END CASE; 100 | END 101 | $$ LANGUAGE plpgsql; 102 | 103 | COMMIT; 104 | -- Not needed unless another file is being used in the same session 105 | RESET client_min_messages; 106 | -------------------------------------------------------------------------------- /data/datasets.txt: -------------------------------------------------------------------------------- 1 | http://common-data.cartodb.net.s3.amazonaws.com/basemap_datasets/continents_900913.zip 2 | http://common-data.cartodb.net.s3.amazonaws.com/basemap_datasets/ne_10m_admin_1_states_provinces_lines_shp.zip 3 | http://common-data.cartodb.net.s3.amazonaws.com/basemap_datasets/ne_10m_geography_marine_polys.zip 4 | http://common-data.cartodb.net.s3.amazonaws.com/basemap_datasets/ne_50m_geography_marine_polys.zip 5 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries_lakes.zip 6 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_boundary_lines_land.zip 7 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_1_states_provinces.zip 8 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_1_states_provinces_lines.zip 9 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_roads.zip 10 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_lakes.zip 11 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_airports.zip 12 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places_simple.zip 13 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/physical/ne_10m_rivers_lake_centerlines.zip 14 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_urban_areas.zip 15 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_boundary_lines_map_units.zip 16 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_0_countries_lakes.zip 17 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_1_states_provinces.zip 18 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_admin_1_states_provinces_lines.zip 19 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/physical/ne_50m_land.zip 20 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/physical/ne_50m_lakes.zip 21 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_populated_places_simple.zip 22 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/physical/ne_50m_rivers_lake_centerlines.zip 23 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/cultural/ne_50m_urban_areas.zip 24 | http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_geography_marine_polys.zip 25 | -------------------------------------------------------------------------------- /data/fixed_shps/ne_10m_admin_1_states_provinces_lines_shp.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/data/fixed_shps/ne_10m_admin_1_states_provinces_lines_shp.zip -------------------------------------------------------------------------------- /data/fixed_shps/ne_10m_geography_marine_polys.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/data/fixed_shps/ne_10m_geography_marine_polys.zip -------------------------------------------------------------------------------- /data/fixed_shps/ne_50m_geography_marine_polys.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/data/fixed_shps/ne_50m_geography_marine_polys.zip -------------------------------------------------------------------------------- /data/generalizations.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Since imposm isn't unifying values, we use tags ? 'key' AND tags -> 'key' != 'no' 3 | 4 | # Aeroways 5 | - name: aeroways 6 | materialized: false 7 | index_by: the_geom 8 | select: the_geom AS the_geom_webmercator, tags -> 'aeroway' AS type 9 | from: planet 10 | where: tags ? 'aeroway' AND tags -> 'aeroway' != 'no' 11 | 12 | # admin-0 and admin-1 boundaries 13 | - name: administrative 14 | materialized: true 15 | cluster_on: the_geom 16 | index_by: the_geom_webmercator 17 | select: tags, tags -> 'admin_level' AS admin_level, the_geom AS the_geom_webmercator 18 | from: planet 19 | where: tags -> 'boundary' = 'administrative' 20 | 21 | # Buildings 22 | - name: buildings_z14plus 23 | materialized: true 24 | cluster_on: the_geom 25 | index_by: the_geom_webmercator 26 | select: osm_id, tags -> 'building' building, tags -> 'height' height, ST_Area(the_geom)::bigint AS area, the_geom AS the_geom_webmercator 27 | from: planet 28 | where: tags ? 'building' AND tags -> 'building' != 'no' 29 | 30 | - name: buildings_z13 31 | materialized: true 32 | cluster_on: the_geom_webmercator 33 | index_by: the_geom_webmercator 34 | select: osm_id, building, height, area, generalize(the_geom_webmercator,13) as the_geom_webmercator 35 | from: buildings_z14plus 36 | where: area > 10000 37 | 38 | # Green Areas 39 | # 1311+160+9 40 | - name: green_areas_z14plus 41 | materialized: false 42 | index_by: the_geom 43 | select: tags -> 'name' AS name, ST_Area(the_geom)::bigint AS area, the_geom AS the_geom_webmercator 44 | from: planet 45 | where: tags -> 'leisure' IN ('park','water_park','marina','nature_reserve','playground', 46 | 'garden','common','sports_centre','golf_course','stadium','track','pitch') 47 | OR tags -> 'amenity' IN ('graveyard') 48 | OR tags -> 'landuse' IN ('cemetery','recreation_ground','forest','wood') 49 | 50 | - name: green_areas_z13 51 | materialized: true 52 | cluster_on: the_geom_webmercator 53 | index_by: the_geom_webmercator 54 | select: name, area, generalize(the_geom_webmercator,13) as the_geom_webmercator 55 | from: green_areas_z14plus 56 | where: area > 75000 57 | 58 | - name: green_areas_z10 59 | materialized: true 60 | cluster_on: the_geom_webmercator 61 | index_by: the_geom_webmercator 62 | select: name, area, generalize(the_geom_webmercator,10) as the_geom_webmercator 63 | from: green_areas_z13 64 | where: area > 5000000 65 | 66 | # Water Areas 67 | - name: water_areas_z14plus 68 | materialized: false 69 | index_by: the_geom 70 | select: tags -> 'name' AS name, ST_Area(the_geom)::bigint AS area, COALESCE(tags -> 'natural', tags -> 'waterway', tags -> 'landuse') AS type, the_geom AS the_geom_webmercator 71 | from: planet 72 | where: tags -> 'natural' IN ('water','bay') 73 | OR tags -> 'waterway' IN ('riverbank','canal','river') 74 | OR tags -> 'landuse' IN ('reservoir') 75 | 76 | - name: water_areas_z13 77 | materialized: true 78 | cluster_on: the_geom_webmercator 79 | index_by: the_geom_webmercator 80 | select: name, area, type, generalize(the_geom_webmercator,13) as the_geom_webmercator 81 | from: water_areas_z14plus 82 | where: area > 25000 OR type = 'riverbank' 83 | 84 | - name: water_areas_z10 85 | materialized: true 86 | cluster_on: the_geom_webmercator 87 | index_by: the_geom_webmercator 88 | select: name, area, type, generalize(the_geom_webmercator,10) as the_geom_webmercator 89 | from: water_areas_z13 90 | where: area > 25000 OR type = 'riverbank' 91 | 92 | # Roads 93 | - name: highroad_z15plus 94 | materialized: true 95 | cluster_on: the_geom 96 | index_by: the_geom_webmercator 97 | select: the_geom AS the_geom_webmercator, 98 | tags -> 'highway' as highway, 99 | tags -> 'railway' as railway, 100 | (CASE WHEN tags -> 'highway' IN ('motorway', 'motorway_link') THEN 'highway' 101 | WHEN tags -> 'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road' 102 | WHEN tags -> 'highway' IN ('footpath', 'track', 'footway', 'steps', 'pedestrian', 'path', 'cycleway') THEN 'path' 103 | WHEN tags -> 'railway' IN ('rail', 'tram', 'light_rail', 'narrow_guage', 'monorail') THEN 'rail' 104 | ELSE 'minor_road' END) AS kind, 105 | (CASE WHEN tags -> 'highway' IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') THEN 'yes' 106 | ELSE 'no' END) AS is_link, 107 | (CASE WHEN tags ? 'tunnel' AND tags -> 'tunnel' != 'no' THEN 'yes' 108 | ELSE 'no' END) AS is_tunnel, 109 | (CASE WHEN tags ? 'bridge' AND tags -> 'bridge' != 'no' THEN 'yes' 110 | ELSE 'no' END) AS is_bridge, 111 | wayzorder(tags) as z_order , 112 | tags -> 'name' as name, 113 | tags -> 'ref' as ref 114 | from: planet 115 | where: tags -> 'highway' IN ('motorway', 'motorway_link') 116 | OR tags -> 'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') 117 | OR tags -> 'highway' IN ('unclassified', 'residential', 'living_street', 'service', 'road') 118 | OR tags -> 'highway' IN ('footpath', 'track', 'footway', 'steps', 'pedestrian', 'path', 'cycleway') 119 | OR tags -> 'railway' IN ('rail', 'tram', 'light_rail', 'narrow_guage', 'monorail') 120 | 121 | - name: highroad_z14 122 | materialized: true 123 | cluster_on: the_geom_webmercator 124 | index_by: the_geom_webmercator 125 | select: generalize(the_geom_webmercator, 14) AS the_geom_webmercator, 126 | highway, 127 | railway, 128 | (CASE WHEN highway IN ('motorway', 'motorway_link') THEN 'highway' 129 | WHEN highway IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road' 130 | WHEN highway IN ('unclassified', 'residential', 'living_street', 'road') THEN 'minor_road' 131 | WHEN railway IN ('rail') THEN 'rail' 132 | ELSE 'unknown' END) AS kind, 133 | is_link, 134 | is_tunnel, 135 | is_bridge, 136 | z_order, 137 | name, 138 | ref 139 | from: highroad_z15plus 140 | where: highway in ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 141 | 'primary_link', 'secondary', 'secondary_link', 'tertiary', 142 | 'tertiary_link', 'unclassified', 'residential', 'living_street', 'road') 143 | OR railway = 'rail' 144 | 145 | - name: highroad_z13 146 | materialized: true 147 | cluster_on: the_geom_webmercator 148 | index_by: the_geom_webmercator 149 | select: generalize(the_geom_webmercator, 13) AS the_geom_webmercator, 150 | highway, 151 | railway, 152 | (CASE WHEN highway IN ('motorway', 'motorway_link') THEN 'highway' 153 | WHEN highway IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road' 154 | ELSE 'minor_road' END) AS kind, 155 | is_link, 156 | is_tunnel, 157 | is_bridge, 158 | z_order, 159 | name, 160 | ref 161 | from: highroad_z14 162 | where: highway in ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 163 | 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'unclassified', 'residential', 'living_street', 'road') 164 | OR railway = 'rail' 165 | 166 | - name: highroad_z12 167 | materialized: true 168 | cluster_on: the_geom_webmercator 169 | index_by: the_geom_webmercator 170 | select: generalize(the_geom_webmercator, 12) AS the_geom_webmercator, 171 | highway, 172 | railway, 173 | (CASE WHEN highway IN ('motorway') THEN 'highway' 174 | WHEN highway IN ('trunk', 'primary', 'secondary') THEN 'major_road' 175 | ELSE 'minor_road' END) AS kind, 176 | 'no'::text AS is_link, 177 | is_tunnel, 178 | is_bridge, 179 | z_order, 180 | name, 181 | ref 182 | from: highroad_z13 183 | where: highway in ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street', 'road') 184 | 185 | - name: highroad_z11 186 | materialized: true 187 | cluster_on: the_geom_webmercator 188 | index_by: the_geom_webmercator 189 | select: generalize(the_geom_webmercator, 11) AS the_geom_webmercator, 190 | highway, 191 | railway, 192 | (CASE WHEN highway IN ('motorway') THEN 'highway' 193 | WHEN highway IN ('trunk', 'primary') THEN 'major_road' 194 | ELSE 'minor_road' END) AS kind, 195 | 'no'::text AS is_link, 196 | is_tunnel, 197 | is_bridge, 198 | z_order, 199 | name, 200 | ref 201 | from: highroad_z12 202 | where: highway in ('motorway', 'trunk', 'primary', 'secondary', 'tertiary') 203 | 204 | - name: highroad_z10 205 | materialized: true 206 | cluster_on: the_geom_webmercator 207 | index_by: the_geom_webmercator 208 | select: generalize(the_geom_webmercator, 10) AS the_geom_webmercator, 209 | highway, 210 | railway, 211 | (CASE WHEN highway IN ('motorway') THEN 'highway' 212 | WHEN highway IN ('trunk', 'primary') THEN 'major_road' 213 | ELSE 'minor_road' END) AS kind, 214 | 'no'::text AS is_link, 215 | is_tunnel, 216 | is_bridge, 217 | z_order, 218 | name, 219 | ref 220 | from: highroad_z11 221 | where: highway in ('motorway', 'trunk', 'primary', 'secondary') 222 | 223 | - name: places 224 | materialized: false 225 | index_by: the_geom 226 | select: tags -> 'place' AS place, 227 | tags -> 'name' AS name, 228 | tags -> 'population' AS population, 229 | the_geom AS the_geom_webmercator 230 | from: planet 231 | where: tags -> 'place' IN ('city','town','village','hamlet','suburb','neighbourhood') 232 | -------------------------------------------------------------------------------- /data/generalizations_sql.js: -------------------------------------------------------------------------------- 1 | // Converts yaml to sql 2 | 3 | var yaml = require('js-yaml'); 4 | var fs = require('fs'); 5 | 6 | function tname(table_name) { 7 | return table_name; 8 | } 9 | 10 | 11 | if (process.argv.length == 2) { 12 | // Write SQL to STDOUT 13 | var doc = yaml.safeLoad(fs.readFileSync('generalizations.yml', 'utf8')); 14 | console.log("SET client_min_messages TO WARNING;"); 15 | console.log("SET statement_timeout = 0;\n") 16 | doc.forEach(function(view) { 17 | var pg_type = 'VIEW'; 18 | if (view.materialized) { 19 | var pg_type = 'MATERIALIZED VIEW'; 20 | } 21 | console.log("DROP "+pg_type+" IF EXISTS " + tname(view.name) + " CASCADE;"); 22 | console.log("CREATE "+pg_type+" " + tname(view.name) + " AS"); 23 | console.log(" SELECT id, " + view.select); 24 | console.log(" FROM " + tname(view.from)); 25 | console.log(" WHERE " + view.where); 26 | if (pg_type == 'MATERIALIZED VIEW') { 27 | if (view.cluster_on) { 28 | console.log(" ORDER BY ST_GeoHash(ST_Transform(ST_SetSRID(Box2D(" + view.cluster_on + "), 3857), 4326));"); 29 | } else { 30 | console.log(";"); 31 | } 32 | console.log("CREATE INDEX " + view.name + "_" + view.index_by + "_gist ON " + 33 | tname(view.name) + " USING gist(" + view.index_by + ");"); 34 | console.log("CREATE UNIQUE INDEX ON " + tname(view.name) + " (id);"); 35 | console.log("ANALYZE " + tname(view.name) + ";\n"); 36 | } else { 37 | console.log(";"); // Don't ORDER BY 38 | console.log("CREATE INDEX IF NOT EXISTS \"" + view.from + "_view_" + view.name + "_idx\" ON " + tname(view.from) + 39 | " USING GIST (" + view.index_by + ") WHERE (" + view.where + ");"); 40 | } 41 | console.log(""); 42 | }); 43 | console.log("RESET client_min_messages;"); 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /data/generalizations_sql_batch.js: -------------------------------------------------------------------------------- 1 | // Converts yaml to sql 2 | 3 | var yaml = require('js-yaml'); 4 | var fs = require('fs'); 5 | var request = require('request'); 6 | 7 | function tname(table_name) { 8 | return table_name; 9 | } 10 | 11 | var API_KEY; 12 | var CARTODB_URL; 13 | if (process.env.CARTODB_API_KEY && process.env.CARTODB_URL) { 14 | API_KEY = process.env.CARTODB_API_KEY; 15 | CARTODB_URL = process.env.CARTODB_URL; 16 | } else { 17 | console.log("Reading config variables from config.json"); 18 | json = JSON.parse(fs.readFileSync("../config.json")); 19 | API_KEY = json.api_key; 20 | CARTODB_URL = json.cdb_url; 21 | } 22 | request = request.defaults({"baseUrl": CARTODB_URL + '/api/v1/'}); 23 | 24 | var get_sql_from_view = function(view) { 25 | var pg_type = 'VIEW'; 26 | if (view.materialized) { 27 | pg_type = 'MATERIALIZED VIEW'; 28 | } 29 | var sql = "DROP "+pg_type+" IF EXISTS " + tname(view.name) + " CASCADE;"; 30 | sql += "CREATE "+pg_type+" " + tname(view.name) + " AS"; 31 | sql += " SELECT id, " + view.select; 32 | sql += " FROM " + tname(view.from); 33 | sql += " WHERE " + view.where; 34 | if (pg_type == 'MATERIALIZED VIEW') { 35 | if (view.cluster_on) { 36 | sql += " ORDER BY ST_GeoHash(ST_Transform(ST_SetSRID(Box2D(" + view.cluster_on + "), 3857), 4326));"; 37 | } else { 38 | sql += ";"; 39 | } 40 | sql += ("CREATE INDEX " + view.name + "_" + view.index_by + "_gist ON " + 41 | tname(view.name) + " USING gist(" + view.index_by + ");"); 42 | sql += ("CREATE UNIQUE INDEX ON " + tname(view.name) + " (id);"); 43 | sql += ("ANALYZE " + tname(view.name) + ";\n"); 44 | } else { 45 | sql += (";"); // Don't ORDER BY 46 | sql += ("CREATE INDEX IF NOT EXISTS \"" + view.from + "_view_" + view.name + "_idx\" ON " + tname(view.from) + 47 | " USING GIST (" + view.index_by + ") WHERE (" + view.where + ");"); 48 | } 49 | sql += (""); 50 | return sql; 51 | }; 52 | 53 | 54 | if (process.argv.length == 2) { 55 | var doc = yaml.safeLoad(fs.readFileSync('generalizations.yml', 'utf8')); 56 | var views = {}; 57 | var deps = {}; 58 | 59 | doc.forEach(function(view) { 60 | deps[view.from] = deps[view.from] || []; 61 | deps[view.from].push(view.name); 62 | views[view.name] = view; 63 | }); 64 | 65 | var getViewAndDependants = function(viewName) { 66 | sql = get_sql_from_view(views[viewName]); 67 | if(viewName in deps) { 68 | deps[viewName].forEach(function(dependant) { 69 | sql += getViewAndDependants(dependant); 70 | }); 71 | } 72 | return sql; 73 | }; 74 | 75 | deps.planet.forEach(function(viewName) { 76 | var sql = getViewAndDependants(viewName); 77 | request({ 78 | method: 'POST', 79 | uri: 'sql/job', 80 | json: { 81 | query: sql, 82 | api_key: API_KEY 83 | } 84 | }, function(error, response, body) { 85 | console.log(body); 86 | }); 87 | }); 88 | } 89 | 90 | 91 | -------------------------------------------------------------------------------- /data/global_functions.sql: -------------------------------------------------------------------------------- 1 | -- The functions used to take a schema name, but no longer do. This is 2 | -- why many drop two functions 3 | SET client_min_messages TO WARNING; 4 | 5 | BEGIN; 6 | 7 | DROP FUNCTION IF EXISTS false_background_zoomed(text,box3d); 8 | CREATE OR REPLACE FUNCTION false_background_zoomed(scaleDenominator text, bbox box3d) 9 | RETURNS TABLE(the_geom_webmercator geometry) AS 10 | $$ 11 | SELECT bbox::geometry 12 | WHERE zoom(scaleDenominator::numeric) >= 9; 13 | $$ 14 | LANGUAGE SQL; 15 | 16 | DROP FUNCTION IF EXISTS continents_zoomed(text,box3d); 17 | CREATE OR REPLACE FUNCTION continents_zoomed(scaleDenominator text, bbox box3d) 18 | RETURNS TABLE(cartodb_id integer, name text, the_geom_webmercator geometry) AS 19 | $$ 20 | SELECT 21 | cartodb_id, 22 | name::text, 23 | the_geom_webmercator 24 | FROM continents_900913 25 | WHERE the_geom_webmercator && bbox 26 | -- hack hack. scaledenominators seem to be inaccurate at zooms 0-2 27 | AND scaleDenominator::numeric > 139000000; 28 | $$ 29 | LANGUAGE SQL; 30 | 31 | DROP FUNCTION IF EXISTS land_positive_zoomed(text,box3d); 32 | CREATE OR REPLACE FUNCTION land_positive_zoomed(scaleDenominator text, bbox box3d) 33 | RETURNS TABLE(cartodb_id integer, the_geom_webmercator geometry) AS 34 | $$ 35 | DECLARE 36 | zoom NUMERIC; 37 | BEGIN 38 | zoom := zoom(scaleDenominator::numeric); 39 | IF zoom <= 1 THEN 40 | RETURN QUERY EXECUTE format( 41 | 'SELECT cartodb_id, the_geom_webmercator 42 | FROM ne_50m_land 43 | WHERE the_geom_webmercator && $1' 44 | ) USING bbox; 45 | ELSIF zoom <= 3 THEN 46 | RETURN QUERY EXECUTE format( 47 | 'SELECT cartodb_id, the_geom_webmercator 48 | FROM ne_50m_admin_0_countries_lakes 49 | WHERE the_geom_webmercator && $1' 50 | ) USING bbox; 51 | ELSIF zoom <= 7 THEN 52 | RETURN QUERY EXECUTE format( 53 | 'SELECT cartodb_id, the_geom_webmercator 54 | FROM ne_10m_admin_0_countries_lakes 55 | WHERE the_geom_webmercator && $1' 56 | ) USING bbox; 57 | ELSIF zoom <= 8 THEN 58 | RETURN QUERY EXECUTE format( 59 | 'SELECT cartodb_id, the_geom_webmercator 60 | FROM simplified_land_polygons 61 | WHERE the_geom_webmercator && $1' 62 | ) USING bbox; 63 | ELSE 64 | RETURN; 65 | END IF; 66 | END 67 | $$ 68 | LANGUAGE 'plpgsql'; 69 | 70 | DROP FUNCTION IF EXISTS land_negative_zoomed(text,box3d); 71 | CREATE OR REPLACE FUNCTION land_negative_zoomed(scaleDenominator text, bbox box3d) 72 | RETURNS TABLE(cartodb_id bigint, the_geom_webmercator geometry) AS 73 | $$ 74 | SELECT 75 | cartodb_id::bigint, 76 | the_geom_webmercator 77 | FROM water_polygons 78 | WHERE the_geom_webmercator && bbox 79 | AND zoom(scaleDenominator::numeric) >= 9; 80 | $$ 81 | LANGUAGE SQL; 82 | 83 | DROP FUNCTION IF EXISTS ne_marine_zoomed(text,box3d); 84 | CREATE OR REPLACE FUNCTION ne_marine_zoomed(scaleDenominator text, bbox box3d) 85 | RETURNS TABLE(cartodb_id bigint, the_geom_webmercator geometry, name text, namealt text, featurecla text, scalerank integer) AS 86 | /* Some tables have cartodb_id bigint, some integer, so cast them all to bigint */ 87 | $$ 88 | BEGIN 89 | IF zoom(scaleDenominator::numeric) <= 3 AND zoom(scaleDenominator::numeric) >= 2 THEN 90 | RETURN QUERY EXECUTE format( 91 | 'SELECT cartodb_id::bigint, the_geom_webmercator, name::text, namealt::text, featurecla::text, scalerank::integer 92 | FROM ne_110m_geography_marine_polys 93 | WHERE the_geom_webmercator && $1' 94 | ) USING bbox; 95 | ELSIF zoom(scaleDenominator::numeric) >= 4 AND zoom(scaleDenominator::numeric) <= 5 THEN 96 | RETURN QUERY EXECUTE format( 97 | 'SELECT cartodb_id::bigint, the_geom_webmercator, name::text, namealt::text, featurecla::text, scalerank::integer 98 | FROM ne_50m_geography_marine_polys 99 | WHERE the_geom_webmercator && $1' 100 | ) USING bbox; 101 | ELSIF zoom(scaleDenominator::numeric) >= 6 AND zoom(scaleDenominator::numeric) <= 8 THEN 102 | RETURN QUERY EXECUTE format( 103 | 'SELECT cartodb_id::bigint, the_geom_webmercator, name::text, namealt::text, featurecla::text, scalerank::integer 104 | FROM ne_10m_geography_marine_polys 105 | WHERE the_geom_webmercator && $1' 106 | ) USING bbox; 107 | ELSE 108 | RETURN; 109 | END IF; 110 | END 111 | $$ 112 | LANGUAGE 'plpgsql'; 113 | 114 | -- Rivers go below lakes, so rivers are drawn first (river = 0) 115 | DROP FUNCTION IF EXISTS water_zoomed(text,box3d); 116 | DROP FUNCTION IF EXISTS water_zoomed(text,text,box3d); 117 | CREATE OR REPLACE FUNCTION water_zoomed(scaleDenominator text, bbox box3d) 118 | RETURNS TABLE(id bigint, the_geom_webmercator geometry, name text, type text, is_lake integer, ne_scalerank integer, area bigint) AS 119 | $$ 120 | BEGIN 121 | IF zoom(scaleDenominator::numeric) >= 3 AND zoom(scaleDenominator::numeric) <= 4 THEN 122 | RETURN QUERY EXECUTE format( 123 | '(select cartodb_id::bigint AS id, the_geom_webmercator, name::text, ''river'' AS type, 0 AS is_lake, scalerank::integer, ST_Area(the_geom_webmercator)::bigint 124 | from ne_50m_rivers_lake_centerlines 125 | where the_geom_webmercator && $1) 126 | UNION 127 | (SELECT cartodb_id::bigint AS id, the_geom_webmercator, name::text, ''lake'' AS type, 1 AS is_lake, scalerank::integer, ST_Area(the_geom_webmercator)::bigint 128 | FROM ne_50m_lakes 129 | WHERE the_geom_webmercator && $1) 130 | ORDER BY is_lake ASC' 131 | ) USING bbox; 132 | ELSIF zoom(scaleDenominator::numeric) >= 5 AND zoom(scaleDenominator::numeric) <= 7 THEN 133 | RETURN QUERY EXECUTE format( 134 | '(SELECT cartodb_id::bigint AS id, the_geom_webmercator, name::text, ''river'' AS type, 0 AS is_lake, scalerank::integer, ST_Area(the_geom_webmercator)::bigint 135 | FROM ne_10m_rivers_lake_centerlines 136 | WHERE the_geom_webmercator && $1) 137 | UNION 138 | (SELECT cartodb_id::bigint AS id, the_geom_webmercator, name, ''lake'' AS type, 1 AS is_lake, scalerank::integer, ST_Area(the_geom_webmercator)::bigint 139 | FROM ne_10m_lakes 140 | WHERE the_geom_webmercator && $1) 141 | ORDER BY is_lake ASC' 142 | ) USING bbox; 143 | ELSIF zoom(scaleDenominator::numeric) >= 8 AND zoom(scaleDenominator::numeric) <= 10 THEN 144 | RETURN QUERY EXECUTE format( 145 | 'SELECT id::bigint AS id, the_geom_webmercator, name::text, type::text, 146 | (CASE WHEN type IN (''water'',''bay'',''riverbank'',''reservoir'') 147 | AND ST_GeometryType(the_geom_webmercator) IN (''ST_Polygon'',''ST_MultiPolygon'') THEN 1 ELSE 0 END) as is_lake, 148 | 0 as ne_scalerank, area::bigint 149 | FROM water_areas_z10 150 | WHERE the_geom_webmercator && $1 151 | ORDER BY is_lake ASC' 152 | ) USING bbox; 153 | ELSIF zoom(scaleDenominator::numeric) >= 11 AND zoom(scaleDenominator::numeric) <= 13 THEN 154 | RETURN QUERY EXECUTE format( 155 | 'SELECT id::bigint AS id, the_geom_webmercator, name::text, type::text, 156 | (CASE WHEN type IN (''water'',''bay'',''riverbank'',''reservoir'') 157 | AND ST_GeometryType(the_geom_webmercator) IN (''ST_Polygon'',''ST_MultiPolygon'') THEN 1 ELSE 0 END) as is_lake, 158 | 0 AS ne_scalerank, area::bigint 159 | FROM water_areas_z13 160 | WHERE the_geom_webmercator && $1 161 | ORDER BY is_lake ASC' 162 | ) USING bbox; 163 | ELSIF zoom(scaleDenominator::numeric) >= 14 THEN 164 | RETURN QUERY EXECUTE format( 165 | 'SELECT id::bigint AS id, the_geom_webmercator, name::text, type::text, 166 | (CASE WHEN type IN (''water'',''bay'',''riverbank'',''reservoir'') 167 | AND ST_GeometryType(the_geom_webmercator) IN (''ST_Polygon'',''ST_MultiPolygon'') THEN 1 ELSE 0 END) as is_lake, 168 | 0 as ne_scalerank, area::bigint 169 | FROM water_areas_z14plus 170 | WHERE the_geom_webmercator && $1 171 | ORDER BY is_lake ASC' 172 | ) USING bbox; 173 | ELSE 174 | RETURN; 175 | END IF; 176 | END 177 | $$ 178 | LANGUAGE 'plpgsql'; 179 | 180 | 181 | DROP FUNCTION IF EXISTS urban_areas_zoomed(text,box3d); 182 | CREATE OR REPLACE FUNCTION urban_areas_zoomed(scaleDenominator text, bbox box3d) 183 | RETURNS TABLE(cartodb_id bigint, scalerank integer, the_geom_webmercator geometry) AS 184 | $$ 185 | SELECT cartodb_id::bigint, scalerank::integer, the_geom_webmercator 186 | FROM ne_50m_urban_areas 187 | WHERE the_geom_webmercator && bbox 188 | AND zoom(scaleDenominator::numeric) < 5 189 | UNION ALL 190 | SELECT cartodb_id::bigint, scalerank::integer, the_geom_webmercator 191 | FROM ne_10m_urban_areas 192 | WHERE the_geom_webmercator && bbox 193 | AND zoom(scaleDenominator::numeric) >= 5 AND zoom(scaleDenominator::numeric) < 9; 194 | $$ 195 | LANGUAGE SQL; 196 | 197 | DROP FUNCTION IF EXISTS country_city_labels_zoomed(text,box3d); 198 | DROP FUNCTION IF EXISTS country_city_labels_zoomed(text,text,box3d); 199 | CREATE OR REPLACE FUNCTION country_city_labels_zoomed(scaleDenominator text, bbox box3d) 200 | RETURNS TABLE(cartodb_id bigint, name text, country_city text, the_geom_webmercator geometry, scalerank integer, place text, pop_est numeric, is_capital bool) AS 201 | $$ 202 | 203 | 204 | 205 | BEGIN 206 | IF zoom(scaleDenominator::numeric) <= 3 AND zoom(scaleDenominator::numeric) >= 1 THEN 207 | RETURN QUERY EXECUTE format( 208 | 'SELECT cartodb_id::bigint, admin::text AS name, ''country''::text, the_geom_webmercator, scalerank::integer, ''''::text, pop_est::numeric, false 209 | FROM ne_50m_admin_0_countries_lakes 210 | WHERE the_geom_webmercator && $1 211 | ORDER BY pop_est DESC' 212 | ) USING bbox; 213 | ELSIF zoom(scaleDenominator::numeric) <= 5 AND zoom(scaleDenominator::numeric) >= 4 THEN 214 | RETURN QUERY EXECUTE format( 215 | '(SELECT cartodb_id::bigint, admin::text AS name, ''country''::text as country_city, the_geom_webmercator, scalerank::integer, ''''::text, pop_est::numeric, false as is_capital 216 | FROM ne_50m_admin_0_countries_lakes 217 | WHERE the_geom_webmercator && $1) 218 | UNION 219 | (select cartodb_id::bigint, name::text, ''city''::text as country_city, the_geom_webmercator, zoom::integer as scalerank, ''''::text, population::numeric as pop_est, capital = ''yes'' as is_capital 220 | from z4to10 221 | where the_geom_webmercator && $1 and zoom <= 5 222 | order by scalerank asc, population desc nulls last)' 223 | ) USING bbox; 224 | ELSIF zoom(scaleDenominator::numeric) >= 6 AND zoom(scaleDenominator::numeric) <= 7 THEN 225 | RETURN QUERY EXECUTE format( 226 | 'select cartodb_id::bigint, name::text, ''city''::text, the_geom_webmercator, zoom::integer as scalerank, ''''::text, population::numeric as pop_est, capital = ''yes'' as is_capital 227 | from z4to10 228 | where the_geom_webmercator && $1 and zoom <= 7 229 | order by scalerank asc, population desc nulls last' 230 | ) USING bbox; 231 | ELSIF zoom(scaleDenominator::numeric) >= 8 AND zoom(scaleDenominator::numeric) <= 12 THEN 232 | RETURN QUERY EXECUTE format( 233 | 'SELECT cartodb_id::bigint, name::text, ''city''::text, the_geom_webmercator, zoom::integer as scalerank, ''''::text, population::numeric as pop_est, capital = ''yes'' as is_capital 234 | FROM z4to10 235 | WHERE the_geom_webmercator && $1 236 | ORDER BY scalerank ASC, population DESC NULLS LAST' 237 | ) USING bbox; 238 | ELSIF zoom(scaleDenominator::numeric) >= 13 THEN 239 | RETURN QUERY EXECUTE format( 240 | 'SELECT id::bigint AS cartodb_id, name::text, ''city''::text, the_geom_webmercator, 99 as scalerank, place::text, numeric_or_zero(population) as pop_est, false as is_capital 241 | FROM places 242 | WHERE the_geom_webmercator && $1 243 | ORDER BY population DESC NULLS LAST, 244 | CASE place 245 | WHEN ''city'' THEN 10 246 | WHEN ''town'' THEN 9 247 | WHEN ''village'' THEN 8 248 | WHEN ''hamlet'' THEN 7 249 | WHEN ''suburb'' THEN 6 250 | WHEN ''neighbourhood'' THEN 5 251 | END DESC, 252 | length(name) DESC' 253 | ) USING bbox; 254 | ELSE 255 | RETURN; 256 | END IF; 257 | END 258 | $$ 259 | LANGUAGE 'plpgsql'; 260 | 261 | DROP FUNCTION IF EXISTS ne_10m_roads_zoomed(text,box3d); 262 | CREATE OR REPLACE FUNCTION ne_10m_roads_zoomed(scaleDenominator text, bbox box3d) 263 | RETURNS TABLE(cartodb_id integer, the_geom_webmercator geometry, type text, scalerank numeric) AS 264 | $$ 265 | SELECT 266 | cartodb_id, 267 | the_geom_webmercator, 268 | type::text, 269 | scalerank::numeric 270 | FROM ne_10m_roads 271 | WHERE type NOT IN ('Ferry, seasonal', 'Ferry Route') 272 | AND the_geom_webmercator && bbox 273 | AND zoom(scaleDenominator::numeric) >= 6 AND zoom(scaleDenominator::numeric) < 9 274 | ORDER BY scalerank DESC 275 | $$ 276 | LANGUAGE SQL; 277 | 278 | DROP FUNCTION IF EXISTS admin0boundaries_zoomed(text,box3d); 279 | DROP FUNCTION IF EXISTS admin0boundaries_zoomed(text,text,box3d); 280 | CREATE OR REPLACE FUNCTION admin0boundaries_zoomed(scaleDenominator text, bbox box3d) 281 | RETURNS TABLE(cartodb_id bigint, the_geom_webmercator geometry, unit boolean) AS 282 | $$ 283 | BEGIN 284 | IF zoom(scaleDenominator::numeric) <= 9 AND zoom(scaleDenominator::numeric) >= 3 THEN 285 | RETURN QUERY EXECUTE format( 286 | '(SELECT cartodb_id::bigint, the_geom_webmercator, false 287 | FROM ne_10m_admin_0_boundary_lines_land 288 | WHERE fid_ne_10m NOT IN (372,374) 289 | AND the_geom_webmercator && $1) 290 | union 291 | (SELECT cartodb_id::bigint, the_geom_webmercator, true 292 | FROM ne_10m_admin_0_boundary_lines_map_units 293 | WHERE the_geom_webmercator && $1)' 294 | ) USING bbox; 295 | ELSIF zoom(scaleDenominator::numeric) >= 10 THEN 296 | RETURN QUERY EXECUTE format( 297 | 'SELECT id::bigint, the_geom_webmercator, false 298 | FROM administrative 299 | WHERE admin_level = ''2'' 300 | AND the_geom_webmercator && $1' 301 | ) USING bbox; 302 | ELSE 303 | RETURN; 304 | END IF; 305 | END 306 | $$ 307 | LANGUAGE 'plpgsql'; 308 | 309 | DROP FUNCTION IF EXISTS admin1boundaries_zoomed(text, box3d); 310 | DROP FUNCTION IF EXISTS admin1boundaries_zoomed(text, text, box3d); 311 | CREATE OR REPLACE FUNCTION admin1boundaries_zoomed(scaleDenominator text, bbox box3d) 312 | RETURNS TABLE(cartodb_id bigint, name text, scalerank integer, the_geom_webmercator geometry, geomtype text) AS 313 | $$ 314 | BEGIN 315 | IF scaleDenominator::numeric > 139000000 THEN 316 | RETURN QUERY EXECUTE format( 317 | 'select cartodb_id::bigint, ''''::text as name, scalerank::integer, the_geom_webmercator, ST_GeometryType(the_geom_webmercator) AS geomtype 318 | from ne_50m_admin_1_states_provinces_lines_shp 319 | where the_geom_webmercator && $1' 320 | ) USING bbox; 321 | ELSIF zoom(scaleDenominator::numeric) >= 3 AND zoom(scaleDenominator::numeric) <= 9 THEN 322 | RETURN QUERY EXECUTE format( 323 | 'select cartodb_id::bigint, ''''::text as name, scalerank::integer, the_geom_webmercator, ST_GeometryType(the_geom_webmercator) AS geomtype 324 | from ne_10m_admin_1_states_provinces_lines_shp 325 | where the_geom_webmercator && $1' 326 | ) USING bbox; 327 | ELSIF zoom(scaleDenominator::numeric) >= 10 THEN 328 | RETURN QUERY EXECUTE format( 329 | 'SELECT id::bigint, tags::hstore -> ''name'' as name, 0, the_geom_webmercator, ST_GeometryType(the_geom_webmercator) AS geomtype 330 | FROM administrative 331 | WHERE admin_level = ''4'' 332 | AND the_geom_webmercator && $1' 333 | ) USING bbox; 334 | ELSE 335 | RETURN; 336 | END IF; 337 | END 338 | $$ 339 | LANGUAGE 'plpgsql'; 340 | 341 | DROP FUNCTION IF EXISTS admin1_polygons_zoomed(text,box3d); 342 | CREATE OR REPLACE FUNCTION admin1_polygons_zoomed(scaleDenominator text, bbox box3d) 343 | RETURNS TABLE(cartodb_id integer, name text, scalerank integer, the_geom_webmercator geometry) AS 344 | $$ 345 | SELECT 346 | cartodb_id, 347 | name::text, 348 | scalerank::integer, 349 | the_geom_webmercator 350 | FROM ne_10m_admin_1_states_provinces 351 | WHERE adm0_a3 IN ('USA','CAN','AUS') 352 | AND the_geom_webmercator && bbox 353 | AND zoom(scaleDenominator::numeric) >= 3 AND zoom(scaleDenominator::numeric) < 8; 354 | $$ 355 | LANGUAGE SQL; 356 | 357 | 358 | DROP FUNCTION IF EXISTS high_road(scaleDenominator text, bbox box3d); 359 | DROP FUNCTION IF EXISTS high_road(schema text, scaleDenominator text, bbox box3d); 360 | CREATE OR REPLACE FUNCTION high_road(scaleDenominator text, bbox box3d) 361 | RETURNS TABLE(name text, ref text, the_geom_webmercator geometry, highway text, railway text, kind text, is_link text, is_tunnel text, is_bridge text, z_order integer) AS 362 | $$ 363 | DECLARE 364 | conditions TEXT; 365 | BEGIN 366 | -- TODO use zoom() 367 | CASE 368 | WHEN zoom(scaleDenominator::numeric) = 13 THEN 369 | conditions := 'is_bridge=''no'''; 370 | 371 | WHEN zoom(scaleDenominator::numeric) >= 14 THEN 372 | conditions := 'is_bridge=''no'' AND is_tunnel=''no'''; 373 | 374 | ELSE 375 | conditions := 'true'; 376 | END CASE; 377 | 378 | RETURN QUERY SELECT * FROM high_road(scaleDenominator, bbox, conditions); 379 | END 380 | $$ 381 | LANGUAGE 'plpgsql'; 382 | 383 | DROP FUNCTION IF EXISTS high_road(scaleDenominator text, bbox box3d, conditions text); 384 | DROP FUNCTION IF EXISTS high_road(schema text, scaleDenominator text, bbox box3d, conditions text); 385 | CREATE OR REPLACE FUNCTION high_road(scaleDenominator text, bbox box3d, conditions text) 386 | RETURNS TABLE(name text, ref text, the_geom_webmercator geometry, highway text, railway text, kind text, is_link text, is_tunnel text, is_bridge text, z_order integer) AS 387 | $$ 388 | DECLARE 389 | tablename TEXT; 390 | BEGIN 391 | CASE 392 | WHEN zoom(scaleDenominator::numeric) >= 9 AND zoom(scaleDenominator::numeric) <= 10 THEN 393 | tablename := 'highroad_z10'; 394 | WHEN zoom(scaleDenominator::numeric) = 11 THEN 395 | tablename := 'highroad_z11'; 396 | WHEN zoom(scaleDenominator::numeric) = 12 THEN 397 | tablename := 'highroad_z12'; 398 | WHEN zoom(scaleDenominator::numeric) = 13 THEN 399 | tablename := 'highroad_z13'; 400 | WHEN zoom(scaleDenominator::numeric) = 14 THEN 401 | tablename := 'highroad_z14'; 402 | WHEN zoom(scaleDenominator::numeric) >= 15 THEN 403 | tablename := 'highroad_z15plus'; 404 | ELSE 405 | RETURN; 406 | END CASE; 407 | 408 | RETURN QUERY EXECUTE format( 409 | 'SELECT name, ref, the_geom_webmercator, highway::text, railway::text, kind::text, is_link::text, is_tunnel::text, is_bridge::text, z_order 410 | FROM %I 411 | WHERE the_geom_webmercator && $1 412 | AND %s ORDER BY z_order ASC', tablename, conditions 413 | ) USING bbox; 414 | END 415 | $$ 416 | LANGUAGE 'plpgsql'; 417 | 418 | DROP FUNCTION IF EXISTS high_road_labels(scaleDenominator text, bbox box3d); 419 | DROP FUNCTION IF EXISTS high_road_labels(schema text, scaleDenominator text, bbox box3d); 420 | CREATE OR REPLACE FUNCTION high_road_labels(scaleDenominator text, bbox box3d) 421 | RETURNS TABLE(name text, ref text, the_geom_webmercator geometry, highway text, railway text, kind text, is_link text, is_tunnel text, is_bridge text, z_order integer) AS 422 | $$ 423 | DECLARE 424 | tablename TEXT; 425 | BEGIN 426 | CASE 427 | WHEN zoom(scaleDenominator::numeric) = 12 THEN 428 | tablename := 'highroad_z12'; 429 | WHEN zoom(scaleDenominator::numeric) = 13 THEN 430 | tablename := 'highroad_z13'; 431 | WHEN zoom(scaleDenominator::numeric) = 14 THEN 432 | tablename := 'highroad_z14'; 433 | WHEN zoom(scaleDenominator::numeric) >= 15 THEN 434 | tablename := 'highroad_z15plus'; 435 | ELSE 436 | RETURN; 437 | END CASE; 438 | 439 | RETURN QUERY EXECUTE format( 440 | 'SELECT name, ref, the_geom_webmercator, highway::text, railway::text, kind::text, is_link::text, is_tunnel::text, is_bridge::text, z_order 441 | FROM %I 442 | WHERE the_geom_webmercator && $1 443 | ORDER BY z_order ASC', tablename 444 | ) USING bbox; 445 | END 446 | $$ 447 | LANGUAGE 'plpgsql'; 448 | 449 | DROP FUNCTION IF EXISTS tunnels(scaleDenominator text, bbox box3d); 450 | DROP FUNCTION IF EXISTS tunnels(schema text, scaleDenominator text, bbox box3d); 451 | CREATE OR REPLACE FUNCTION tunnels(scaleDenominator text, bbox box3d) 452 | RETURNS TABLE(the_geom_webmercator geometry, highway text, railway text, kind text, is_link text, is_tunnel text, is_bridge text) AS 453 | $$ 454 | DECLARE 455 | tablename TEXT; 456 | BEGIN 457 | CASE 458 | WHEN zoom(scaleDenominator::numeric) = 13 THEN 459 | tablename := 'highroad_z13'; 460 | WHEN zoom(scaleDenominator::numeric) = 14 THEN 461 | tablename := 'highroad_z14'; 462 | WHEN zoom(scaleDenominator::numeric) >= 15 THEN 463 | tablename := 'highroad_z15plus'; 464 | ELSE 465 | RETURN; 466 | END CASE; 467 | 468 | RETURN QUERY EXECUTE format( 469 | 'SELECT the_geom_webmercator, highway::text, railway::text, kind::text, is_link::text, is_tunnel::text, is_bridge::text 470 | FROM %I 471 | WHERE the_geom_webmercator && $1 472 | AND is_tunnel = ''yes'' ORDER BY z_order ASC', tablename 473 | ) USING bbox; 474 | END 475 | $$ 476 | LANGUAGE 'plpgsql'; 477 | 478 | DROP FUNCTION IF EXISTS bridges(scaleDenominator text, bbox box3d); 479 | DROP FUNCTION IF EXISTS bridges(schema text, scaleDenominator text, bbox box3d); 480 | CREATE OR REPLACE FUNCTION bridges(scaleDenominator text, bbox box3d) 481 | RETURNS TABLE(the_geom_webmercator geometry, highway text, railway text, kind text, is_link text, is_tunnel text, is_bridge text) AS 482 | $$ 483 | DECLARE 484 | tablename TEXT; 485 | BEGIN 486 | CASE 487 | WHEN zoom(scaleDenominator::numeric) = 13 THEN 488 | tablename := 'highroad_z13'; 489 | WHEN zoom(scaleDenominator::numeric) = 14 THEN 490 | tablename := 'highroad_z14'; 491 | WHEN zoom(scaleDenominator::numeric) >= 15 THEN 492 | tablename := 'highroad_z15plus'; 493 | ELSE 494 | RETURN; 495 | END CASE; 496 | 497 | RETURN QUERY EXECUTE format( 498 | 'SELECT the_geom_webmercator, highway::text, railway::text, kind::text, is_link::text, is_tunnel::text, is_bridge::text 499 | FROM %I 500 | WHERE the_geom_webmercator && $1 501 | AND is_bridge = ''yes'' ORDER BY z_order ASC', tablename 502 | ) USING bbox; 503 | END 504 | $$ 505 | LANGUAGE 'plpgsql'; 506 | 507 | DROP FUNCTION IF EXISTS buildings_zoomed(text,box3d); 508 | DROP FUNCTION IF EXISTS buildings_zoomed(text,text,box3d); 509 | CREATE OR REPLACE FUNCTION buildings_zoomed(scaleDenominator text, bbox box3d) 510 | RETURNS TABLE(cartodb_id bigint, osm_id bigint, area bigint, the_geom_webmercator geometry) AS 511 | $$ 512 | BEGIN 513 | IF zoom(scaleDenominator::numeric) >= 12 AND zoom(scaleDenominator::numeric) <= 13 THEN 514 | RETURN QUERY EXECUTE format( 515 | 'SELECT id::bigint AS cartodb_id, osm_id::bigint, area::bigint, the_geom_webmercator 516 | FROM buildings_z13 517 | WHERE the_geom_webmercator && $1' 518 | ) USING bbox; 519 | ELSIF zoom(scaleDenominator::numeric) >= 14 THEN 520 | RETURN QUERY EXECUTE format( 521 | 'SELECT id::bigint AS cartodb_id, osm_id::bigint, area::bigint, the_geom_webmercator 522 | FROM buildings_z14plus 523 | WHERE the_geom_webmercator && $1' 524 | ) USING bbox; 525 | ELSE 526 | RETURN; 527 | END IF; 528 | END 529 | $$ 530 | LANGUAGE 'plpgsql'; 531 | 532 | DROP FUNCTION IF EXISTS green_areas_zoomed(text,box3d); 533 | DROP FUNCTION IF EXISTS green_areas_zoomed(text,text,box3d); 534 | CREATE OR REPLACE FUNCTION green_areas_zoomed(scaleDenominator text, bbox box3d) 535 | RETURNS TABLE(cartodb_id bigint, name text, area bigint, the_geom_webmercator geometry) AS 536 | $$ 537 | BEGIN 538 | IF zoom(scaleDenominator::numeric) >= 9 AND zoom(scaleDenominator::numeric) <= 10 THEN 539 | RETURN QUERY EXECUTE format( 540 | 'SELECT id::bigint AS cartodb_id, name, area::bigint, the_geom_webmercator 541 | FROM green_areas_z10 542 | WHERE the_geom_webmercator && $1' 543 | ) USING bbox; 544 | ELSIF zoom(scaleDenominator::numeric) >= 11 AND zoom(scaleDenominator::numeric) <= 13 THEN 545 | RETURN QUERY EXECUTE format( 546 | 'SELECT id::bigint AS cartodb_id, name, area::bigint, the_geom_webmercator 547 | FROM green_areas_z13 548 | WHERE the_geom_webmercator && $1' 549 | ) USING bbox; 550 | ELSIF zoom(scaleDenominator::numeric) >= 14 THEN 551 | RETURN QUERY EXECUTE format( 552 | 'SELECT id::bigint AS cartodb_id, name, area::bigint, the_geom_webmercator 553 | FROM green_areas_z14plus 554 | WHERE the_geom_webmercator && $1' 555 | ) USING bbox; 556 | ELSE 557 | RETURN; 558 | END IF; 559 | END 560 | $$ 561 | LANGUAGE 'plpgsql'; 562 | 563 | 564 | DROP FUNCTION IF EXISTS aeroways_zoomed(text,box3d); 565 | DROP FUNCTION IF EXISTS aeroways_zoomed(text,text,box3d); 566 | CREATE OR REPLACE FUNCTION aeroways_zoomed(scaleDenominator text, bbox box3d) 567 | RETURNS TABLE(cartodb_id bigint, type text, the_geom_webmercator geometry) AS 568 | $$ 569 | SELECT 570 | id::bigint AS cartodb_id, 571 | type::text, 572 | the_geom_webmercator 573 | FROM aeroways 574 | WHERE the_geom_webmercator && bbox 575 | AND zoom(scaleDenominator::numeric) >= 12; 576 | $$ 577 | LANGUAGE SQL; 578 | 579 | DROP FUNCTION IF EXISTS osm_admin_zoomed(text,box3d); 580 | DROP FUNCTION IF EXISTS osm_admin_zoomed(text,text,box3d); 581 | CREATE OR REPLACE FUNCTION osm_admin_zoomed(scaleDenominator text, bbox box3d) 582 | RETURNS TABLE(cartodb_id bigint, admin_level text, the_geom_webmercator geometry) AS 583 | $$ 584 | SELECT 585 | id::bigint AS cartodb_id, 586 | admin_level::text, 587 | the_geom_webmercator 588 | FROM administrative 589 | WHERE the_geom_webmercator && bbox 590 | AND zoom(scaleDenominator::numeric) >= 9; 591 | $$ 592 | LANGUAGE SQL; 593 | 594 | COMMIT; 595 | -- Not needed unless another file is being used in the same session 596 | RESET client_min_messages; 597 | -------------------------------------------------------------------------------- /data/import_extract.js: -------------------------------------------------------------------------------- 1 | 2 | var yaml = require('js-yaml'); 3 | var fs = require('fs'); 4 | var pg = require('pg'); 5 | var async = require('async'); 6 | var request = require('request'); 7 | var _ = require('underscore'); 8 | 9 | var ORIGIN_SCHEMA='planet_green' 10 | var ORIGIN_URL="https://originaccount.cartodb.com" 11 | var ORIGIN_API_KEY="CHANGE_ME" 12 | var FILTER_QUERY="WHERE the_geom_webmercator && ST_Transform(ST_SetSRID('BOX(-122.737 37.449,-122.011 37.955)'::box2d, 4326), 3857) OR the_geom_webmercator && ST_Transform(ST_SetSRID('BOX(-4.293 39.8,-3.057 41.03)'::box2d, 4326), 3857)" 13 | 14 | 15 | // fully qualified table name 16 | function tname(table_name) { 17 | if (table_name.indexOf(".") >= 0) return table_name; 18 | return default_schema + "." + table_name; 19 | } 20 | 21 | 22 | var getTables = function(callback) { 23 | // Get existing tables from CartoDB account 24 | var get = { 25 | method: "POST", 26 | uri: CARTODB_URL + '/api/v1/sql?skipfields=the_geom_webmercator&api_key=' + API_KEY, 27 | json: {'q': "SELECT * FROM pg_tables WHERE tableowner=user and schemaname!='cdb_importer'"} 28 | } 29 | request(get, function (error, response, body) { 30 | if (error) callback(error); 31 | var uploaded_tables = _.pluck(body['rows'], 'tablename'); 32 | callback(null, uploaded_tables); 33 | }); 34 | } 35 | 36 | var startImport = function(wantedUrl) { 37 | return function(callback) { 38 | var get = { 39 | method: "POST", 40 | uri: CARTODB_URL + '/api/v1/imports?api_key=' + API_KEY, 41 | json: {'url': wantedUrl} 42 | } 43 | request(get, function (error, response, body) { 44 | if (error) callback(error); 45 | checkImport(wantedUrl.split("/").pop(), body['item_queue_id'], callback) 46 | }); 47 | } 48 | } 49 | 50 | var doc = yaml.safeLoad(fs.readFileSync('generalizations.yml', 'utf8')); 51 | var generalizationTables = _.pluck(doc, 'name'); 52 | 53 | var API_KEY; 54 | var CARTODB_URL; 55 | if (process.env.CARTODB_API_KEY && process.env.CARTODB_URL) { 56 | API_KEY = process.env.CARTODB_API_KEY; 57 | CARTODB_URL = process.env.CARTODB_URL; 58 | } else { 59 | console.log("Reading config variables from config.json"); 60 | json = JSON.parse(fs.readFileSync("../config.json")); 61 | API_KEY = json.api_key; 62 | CARTODB_URL = json.cdb_url; 63 | } 64 | 65 | var checkImport = function(url, import_id, callback) { 66 | var get = { 67 | method: "GET", 68 | uri: CARTODB_URL + '/api/v1/imports/' + import_id + '?api_key=' + API_KEY 69 | } 70 | request(get, function(error, response, body) { 71 | if(error) return callback(error); 72 | json = JSON.parse(body); 73 | console.log(import_id+": "+json['state']); 74 | if(json['state'] == 'failure') return callback(json); 75 | if(json['state'] != 'complete') { 76 | setTimeout(function(){checkImport(url, import_id, callback)}, 500); 77 | }else{ 78 | callback(null, body); 79 | } 80 | }) 81 | } 82 | 83 | getTables(function(error, uploaded_tables) { 84 | if(error) throw "Can't get existing CartoDB tables, check the variables in config.json"; 85 | missingTables = _.filter(generalizationTables, function(t) { 86 | return (uploaded_tables.indexOf(t) == -1 && uploaded_tables.indexOf(t+"_shp") == -1 && t != "") 87 | }) 88 | console.log(missingTables.length+" files need to be imported:\n", missingTables); 89 | urls = _.map(missingTables, function(table) { 90 | query="SELECT *, the_geom_webmercator AS the_geom FROM "+ORIGIN_SCHEMA+"."+table+" "+FILTER_QUERY 91 | return ORIGIN_URL+"/api/v1/sql?q="+escape(query)+"&api_key="+ORIGIN_API_KEY+"&format=csv&filename="+table+".csv"; 92 | }) 93 | var reqs = []; 94 | urls.forEach(function(w) { 95 | reqs.push(startImport(w)); 96 | }); 97 | async.parallelLimit(reqs, 3, function(err, results) { 98 | if (err) console.log(err); 99 | }); 100 | }); 101 | -------------------------------------------------------------------------------- /data/import_files.js: -------------------------------------------------------------------------------- 1 | // issues requests to the CartoDB import api for all static files 2 | 3 | var _ = require("underscore"); 4 | var fs = require("fs"); 5 | var request = require('request'); 6 | var async = require('async'); 7 | 8 | require("http").globalAgent.maxSockets = 1; 9 | 10 | var API_KEY; 11 | var CARTODB_URL; 12 | if (process.env.CARTODB_API_KEY && process.env.CARTODB_URL) { 13 | API_KEY = process.env.CARTODB_API_KEY; 14 | CARTODB_URL = process.env.CARTODB_URL; 15 | } else { 16 | console.log("Reading config variables from config.json"); 17 | json = JSON.parse(fs.readFileSync("../config.json")); 18 | API_KEY = json.api_key; 19 | CARTODB_URL = json.cdb_url; 20 | } 21 | 22 | request = request.defaults({"baseUrl": CARTODB_URL + '/api/v1/'}) 23 | 24 | var wantedUrls = fs.readFileSync('datasets.txt').toString().split("\n"); 25 | 26 | var getTables = function(callback) { 27 | // Get existing tables from CartoDB account 28 | var get = { 29 | method: "POST", 30 | uri: 'sql?api_key=' + API_KEY, 31 | json: {'q': "SELECT * FROM pg_tables WHERE tableowner=user and schemaname!='cdb_importer'"} 32 | } 33 | request(get, function (error, response, body) { 34 | if (error) callback(error); 35 | var uploaded_tables = _.pluck(body['rows'], 'tablename'); 36 | callback(null, uploaded_tables); 37 | }); 38 | } 39 | 40 | var startImport = function(wantedUrl) { 41 | return function(callback) { 42 | var get = { 43 | method: "POST", 44 | uri: 'imports?api_key=' + API_KEY, 45 | json: {'url': wantedUrl} 46 | } 47 | request(get, function (error, response, body) { 48 | if (error) callback(error); 49 | checkImport(wantedUrl.split("/").pop(), body['item_queue_id'], callback) 50 | }); 51 | } 52 | } 53 | 54 | var checkImport = function(url, import_id, callback) { 55 | var get = { 56 | method: "GET", 57 | uri: 'imports/' + import_id + '?api_key=' + API_KEY 58 | } 59 | request(get, function(error, response, body) { 60 | if(error) return callback(error); 61 | json = JSON.parse(body); 62 | console.log(url+": "+json['state']); 63 | if(json['state'] == 'failure') return callback(json); 64 | if(json['state'] != 'complete') { 65 | setTimeout(function(){checkImport(url, import_id, callback)}, 500); 66 | }else{ 67 | callback(null, body); 68 | } 69 | }) 70 | } 71 | 72 | getTables(function(error, uploaded_tables) { 73 | if(error) throw "Can't get existing CartoDB tables, check the variables in config.json"; 74 | missingTables = _.filter(wantedUrls, function(t) { 75 | // Clean names so they match the name they will have once imported in CartoDB 76 | cleanName = t.split("/").pop() 77 | .replace(/(\.zip$|\.json$)/,"") 78 | .replace(/-(complete|split)-3857/,"") 79 | .replace(/-/g,"_"); 80 | return (uploaded_tables.indexOf(cleanName) == -1 && uploaded_tables.indexOf(cleanName+"_shp") == -1 && t != "") 81 | }) 82 | console.log(missingTables.length+" files need to be imported:\n", missingTables); 83 | var reqs = []; 84 | missingTables.forEach(function(w) { 85 | reqs.push(startImport(w)); 86 | }); 87 | async.parallelLimit(reqs, 3, function(err, results) { 88 | if (err) console.log(err); 89 | }); 90 | }); 91 | -------------------------------------------------------------------------------- /data/import_sync.js: -------------------------------------------------------------------------------- 1 | // issues requests to the CartoDB import api for all static files 2 | 3 | var _ = require("underscore"); 4 | var fs = require("fs"); 5 | var request = require('request'); 6 | var async = require('async'); 7 | 8 | require("http").globalAgent.maxSockets = 1; 9 | 10 | var API_KEY; 11 | var CARTODB_URL; 12 | if (process.env.CARTODB_API_KEY && process.env.CARTODB_URL) { 13 | API_KEY = process.env.CARTODB_API_KEY; 14 | CARTODB_URL = process.env.CARTODB_URL; 15 | } else { 16 | console.log("Reading config variables from config.json"); 17 | json = JSON.parse(fs.readFileSync("../config.json")); 18 | API_KEY = json.api_key; 19 | CARTODB_URL = json.cdb_url; 20 | } 21 | 22 | request = request.defaults({"baseUrl": CARTODB_URL + '/api/v1/'}) 23 | 24 | var wantedUrls = fs.readFileSync('syncdatasets.txt').toString().split("\n"); 25 | 26 | var getTables = function(callback) { 27 | // Get existing tables from CartoDB account 28 | var get = { 29 | method: "POST", 30 | uri: 'sql?api_key=' + API_KEY, 31 | json: {'q': "SELECT * FROM pg_tables WHERE tableowner=user and schemaname!='cdb_importer'"} 32 | } 33 | request(get, function (error, response, body) { 34 | if (error) callback(error); 35 | var uploaded_tables = _.pluck(body['rows'], 'tablename'); 36 | callback(null, uploaded_tables); 37 | }); 38 | } 39 | 40 | var startImport = function(wantedUrl) { 41 | return function(callback) { 42 | var get = { 43 | method: "POST", 44 | uri: 'synchronizations?api_key=' + API_KEY, 45 | json: { 46 | 'url': wantedUrl, 47 | 'interval': 86400 // one day 48 | } 49 | } 50 | request(get, function (error, response, body) { 51 | if (error) callback(error); 52 | checkImport(wantedUrl.split("/").pop(), body['id'], callback) 53 | }); 54 | } 55 | } 56 | 57 | var checkImport = function(url, import_id, callback) { 58 | var get = { 59 | method: "GET", 60 | uri: 'synchronizations/' + import_id + '/sync_now?api_key=' + API_KEY 61 | } 62 | request(get, function(error, response, body) { 63 | if(error) return callback(error); 64 | json = JSON.parse(body); 65 | console.log(url+": "+json['state']); 66 | if(json['state'] == 'failure') return callback(json); 67 | if(json['state'] != 'success') { 68 | setTimeout(function(){checkImport(url, import_id, callback)}, 500); 69 | } else { 70 | callback(null, body); 71 | } 72 | }) 73 | } 74 | 75 | getTables(function(error, uploaded_tables) { 76 | if(error) throw "Can't get existing CartoDB tables, check the variables in config.json"; 77 | missingTables = _.filter(wantedUrls, function(t) { 78 | // Clean names so they match the name they will have once imported in CartoDB 79 | cleanName = t.split("/").pop() 80 | .replace(/(\.zip$|\.json$)/,"") 81 | .replace(/-(complete|split)-3857/,"") 82 | .replace(/-/g,"_"); 83 | return (uploaded_tables.indexOf(cleanName) == -1 && uploaded_tables.indexOf(cleanName+"_shp") == -1 && t != "") 84 | }) 85 | console.log(missingTables.length+" files need to be imported:\n", missingTables); 86 | var reqs = []; 87 | missingTables.forEach(function(w) { 88 | reqs.push(startImport(w)); 89 | }); 90 | async.parallelLimit(reqs, 3, function(err, results) { 91 | if (err) console.log(err); 92 | }); 93 | }); 94 | -------------------------------------------------------------------------------- /data/imposm3_mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": { 3 | "load_all": true, 4 | "exclude": [ 5 | "created_by", 6 | "source" 7 | ] 8 | }, 9 | "tables": { 10 | "planet": { 11 | "columns": [ 12 | { 13 | "type": "id", 14 | "name": "osm_id", 15 | "key": null 16 | }, 17 | { 18 | "type": "geometry", 19 | "name": "the_geom", 20 | "key": null 21 | }, 22 | { 23 | "type": "hstore_tags", 24 | "name": "tags", 25 | "key": null 26 | } 27 | ], 28 | "type": "geometry", 29 | "type_mappings": { 30 | "points": { 31 | "access": ["__any__"], 32 | "addr:housename": ["__any__"], 33 | "addr:housenumber": ["__any__"], 34 | "addr:interpolation": ["__any__"], 35 | "admin_level": ["__any__"], 36 | "aerialway": ["__any__"], 37 | "aeroway": ["__any__"], 38 | "amenity": ["__any__"], 39 | "area": ["__any__"], 40 | "barrier": ["__any__"], 41 | "bicycle": ["__any__"], 42 | "brand": ["__any__"], 43 | "bridge": ["__any__"], 44 | "boundary": ["__any__"], 45 | "building": ["__any__"], 46 | "capital": ["__any__"], 47 | "construction": ["__any__"], 48 | "covered": ["__any__"], 49 | "culvert": ["__any__"], 50 | "cutting": ["__any__"], 51 | "denomination": ["__any__"], 52 | "disused": ["__any__"], 53 | "ele": ["__any__"], 54 | "embankment": ["__any__"], 55 | "foot": ["__any__"], 56 | "generator:source": ["__any__"], 57 | "harbour": ["__any__"], 58 | "highway": ["__any__"], 59 | "historic": ["__any__"], 60 | "horse": ["__any__"], 61 | "intermittent": ["__any__"], 62 | "junction": ["__any__"], 63 | "landuse": ["__any__"], 64 | "layer": ["__any__"], 65 | "leisure": ["__any__"], 66 | "lock": ["__any__"], 67 | "man_made": ["__any__"], 68 | "military": ["__any__"], 69 | "motorcar": ["__any__"], 70 | "name": ["__any__"], 71 | "natural": ["__any__"], 72 | "office": ["__any__"], 73 | "oneway": ["__any__"], 74 | "operator": ["__any__"], 75 | "place": ["__any__"], 76 | "poi": ["__any__"], 77 | "population": ["__any__"], 78 | "power": ["__any__"], 79 | "power_source": ["__any__"], 80 | "public_transport": ["__any__"], 81 | "railway": ["__any__"], 82 | "ref": ["__any__"], 83 | "religion": ["__any__"], 84 | "route": ["__any__"], 85 | "service": ["__any__"], 86 | "shop": ["__any__"], 87 | "sport": ["__any__"], 88 | "surface": ["__any__"], 89 | "toll": ["__any__"], 90 | "tourism": ["__any__"], 91 | "tower:type": ["__any__"], 92 | "tunnel": ["__any__"], 93 | "water": ["__any__"], 94 | "waterway": ["__any__"], 95 | "wetland": ["__any__"], 96 | "width": ["__any__"], 97 | "wood": ["__any__"] 98 | }, 99 | "linestrings": { 100 | "addr:interpolation": ["__any__"], 101 | "aerialway": ["__any__"], 102 | "aeroway": ["__any__"], 103 | "barrier": ["__any__"], 104 | "bicycle": ["__any__"], 105 | "bridge": ["__any__"], 106 | "boundary": ["__any__"], 107 | "culvert": ["__any__"], 108 | "cutting": ["__any__"], 109 | "embankment": ["__any__"], 110 | "foot": ["__any__"], 111 | "highway": ["__any__"], 112 | "horse": ["__any__"], 113 | "intermittent": ["__any__"], 114 | "junction": ["__any__"], 115 | "leisure": ["__any__"], 116 | "lock": ["__any__"], 117 | "man_made": ["__any__"], 118 | "motorcar": ["__any__"], 119 | "natural": ["__any__"], 120 | "oneway": ["__any__"], 121 | "operator": ["__any__"], 122 | "power": ["__any__"], 123 | "public_transport": ["__any__"], 124 | "railway": ["__any__"], 125 | "ref": ["__any__"], 126 | "route": ["__any__"], 127 | "service": ["__any__"], 128 | "sport": ["__any__"], 129 | "surface": ["__any__"], 130 | "toll": ["__any__"], 131 | "tower:type": ["__any__"], 132 | "tracktype": ["__any__"], 133 | "tunnel": ["__any__"], 134 | "waterway": ["__any__"] 135 | }, 136 | "polygons": { 137 | "aeroway": ["__any__"], 138 | "amenity": ["__any__"], 139 | "boundary": ["__any__"], 140 | "building": ["__any__"], 141 | "harbour": ["__any__"], 142 | "historic": ["__any__"], 143 | "landuse": ["__any__"], 144 | "leisure": ["__any__"], 145 | "man_made": ["__any__"], 146 | "military": ["__any__"], 147 | "natural": ["__any__"], 148 | "office": ["__any__"], 149 | "place": ["__any__"], 150 | "power": ["__any__"], 151 | "power_source": ["__any__"], 152 | "public_transport": ["__any__"], 153 | "religion": ["__any__"], 154 | "shop": ["__any__"], 155 | "sport": ["__any__"], 156 | "tourism": ["__any__"], 157 | "water": ["__any__"], 158 | "waterway": ["__any__"], 159 | "wetland": ["__any__"] 160 | } 161 | } 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /data/refresh.js: -------------------------------------------------------------------------------- 1 | // Converts yaml to sql 2 | 3 | var yaml = require('js-yaml'); 4 | var fs = require('fs'); 5 | 6 | function tname(table_name) { 7 | return table_name; 8 | } 9 | 10 | 11 | // Write SQL to STDOUT 12 | var doc = yaml.safeLoad(fs.readFileSync('generalizations.yml', 'utf8')); 13 | console.log("SET client_min_messages TO WARNING;"); 14 | console.log("SET statement_timeout = 0;\n") 15 | doc.forEach(function(view) { 16 | // Regular views require no refreshing 17 | if (view.materialized) { 18 | console.log("REFRESH MATERIALIZED VIEW CONCURRENTLY " + tname(view.name) + ";"); 19 | } 20 | }); 21 | console.log("\nRESET client_min_messages;"); 22 | -------------------------------------------------------------------------------- /data/replicate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This file is very closely based on the tile.openstreetmap.org update script, 4 | # but calls imposm instead 5 | # https://github.com/openstreetmap/chef/blob/master/cookbooks/tile/templates/default/replicate.erb 6 | # Licensed under the Apache 2.0 License 7 | # Before running updates, the replication needs to be set up with the timestamp 8 | # set to the day of the latest planet dump. Setting to midnight ensures we get 9 | # conistent data after first run. osmosis --read-replication-interval-init is 10 | # used to initially create the state file 11 | 12 | # Assumptions 13 | # The replication directory is /home/ubuntu/replicate 14 | # The mapping file is CartoDB-basemaps/data/imposm3_mapping.json 15 | # The presistent imposm3 cache is imposm3_cache 16 | # imposm3/imposm3 has a working imposm3 binary 17 | # configuration.txt and state.txt are already set up 18 | 19 | 20 | REPLICATE_HOME=/home/ubuntu/replicate 21 | IMPOSM3_MAPPING="${REPLICATE_HOME}/CartoDB-basemaps/data/imposm3_mapping.json" 22 | IMPOSM3_CACHE="/mnt/imposm3_cache" 23 | 24 | # Define exit handler 25 | function onexit { 26 | [ -f state-prev.txt ] && mv state-prev.txt state.txt 27 | } 28 | 29 | # Change to the replication state directory 30 | cd $REPLICATE_HOME 31 | 32 | # Send output to the log 33 | exec > replicate.log 2>&1 34 | 35 | # Install exit handler 36 | trap onexit EXIT 37 | 38 | # Read in initial state 39 | . state.txt 40 | 41 | # Loop indefinitely 42 | while true 43 | do 44 | # Work out the name of the next file 45 | file="changes-${sequenceNumber}.osm.gz" 46 | 47 | # Save state file so we can rollback if an error occurs 48 | cp state.txt state-prev.txt 49 | 50 | # Fetch the next set of changes 51 | osmosis --read-replication-interval --simc --write-xml-change file="${file}" compressionMethod="gzip" 52 | 53 | # Check for errors 54 | if [ $? -eq 0 ] 55 | then 56 | # Enable exit on error 57 | set -e 58 | 59 | # Remember the previous sequence number 60 | prevSequenceNumber=$sequenceNumber 61 | 62 | # Read in new state 63 | . state.txt 64 | 65 | # Did we get any new data? 66 | if [ "${sequenceNumber}" == "${prevSequenceNumber}" ] 67 | then 68 | # Log the lack of data 69 | echo "No new data available. Sleeping..." 70 | 71 | # Remove file, it will just be an empty changeset 72 | rm ${file} 73 | 74 | # No need to rollback now 75 | rm state-prev.txt 76 | 77 | # Sleep for a short while 78 | sleep 30 79 | else 80 | # Log the new data 81 | echo "Fetched new data from ${prevSequenceNumber} to ${sequenceNumber} into ${file}" 82 | 83 | # Apply the changes to the database 84 | imposm3/imposm3 diff -mapping="${IMPOSM3_MAPPING}" \ 85 | -cachedir="${IMPOSM3_CACHE}" -connection="postgis://?prefix=NONE" \ 86 | "${file}" 87 | 88 | # No need to rollback now 89 | rm state-prev.txt 90 | fi 91 | 92 | # Delete old downloads 93 | find . -name 'changes-*.gz' -mmin +300 -exec rm -f {} \; 94 | 95 | # Disable exit on error 96 | set +e 97 | else 98 | # Log our failure to fetch changes 99 | echo "Failed to fetch changes - waiting a few minutes before retry" 100 | 101 | # Wait five minutes and have another go 102 | sleep 300 103 | fi 104 | done 105 | -------------------------------------------------------------------------------- /data/small_shps/continents_900913.dbf: -------------------------------------------------------------------------------- 1 | _AQWnameCP North America South America Africa Australia Asia Europe Antarctica -------------------------------------------------------------------------------- /data/small_shps/continents_900913.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Google_Maps_Global_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator_2SP"],PARAMETER["standard_parallel_1",0],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /data/small_shps/continents_900913.shp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/data/small_shps/continents_900913.shp -------------------------------------------------------------------------------- /data/small_shps/continents_900913.shx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/data/small_shps/continents_900913.shx -------------------------------------------------------------------------------- /data/syncdatasets.txt: -------------------------------------------------------------------------------- 1 | http://data.openstreetmapdata.com/simplified-land-polygons-complete-3857.zip 2 | http://data.openstreetmapdata.com/water-polygons-split-3857.zip 3 | http://stamen.github.io/aries-magic-list/z4to10.json -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -x 4 | openssl aes-256-cbc -K $encrypted_dde8a6eeaa7c_key -iv $encrypted_dde8a6eeaa7c_iv -in config.json.enc -out config.json -d 5 | 6 | (cd data; node cartodb_sql.js -f global_functions.sql) 7 | # generalizations are not updated - they could take considerable time 8 | node create_named.js positron-all.yml light_all 9 | node create_named.js positron-no-labels.yml light_nolabels 10 | node create_named.js positron-labels-only.yml light_only_labels 11 | node create_named.js dark-matter-all.yml dark_all 12 | node create_named.js dark-matter-no-labels.yml dark_nolabels 13 | node create_named.js dark-matter-labels-only.yml dark_only_labels 14 | -------------------------------------------------------------------------------- /layers.yml: -------------------------------------------------------------------------------- 1 | global_variables: 2 | sql: | 3 | SELECT null::geometry AS the_geom_webmercator LIMIT 0 4 | 5 | false_background: 6 | sql: | 7 | SELECT the_geom_webmercator 8 | FROM false_background_zoomed('!scale_denominator!', !bbox!) AS _ 9 | 10 | land_positive: 11 | sql: | 12 | SELECT 13 | cartodb_id, 14 | the_geom_webmercator 15 | FROM land_positive_zoomed('!scale_denominator!', !bbox!) AS _ 16 | 17 | urban_areas: 18 | sql: | 19 | SELECT 20 | cartodb_id, 21 | scalerank, 22 | the_geom_webmercator 23 | FROM urban_areas_zoomed('!scale_denominator!',!bbox!) AS _ 24 | 25 | green_areas: 26 | sql: | 27 | SELECT the_geom_webmercator, area FROM green_areas_zoomed('!scale_denominator!',!bbox!) AS _ 28 | 29 | admin0boundaries: 30 | sql: | 31 | SELECT the_geom_webmercator, unit FROM admin0boundaries_zoomed('!scale_denominator!', !bbox!) AS _ 32 | 33 | admin1boundaries: 34 | sql: | 35 | SELECT scalerank, the_geom_webmercator FROM admin1boundaries_zoomed('!scale_denominator!', !bbox!) AS _ 36 | 37 | water: 38 | sql: | 39 | (SELECT id::bigint, the_geom_webmercator, name, type, is_lake, ne_scalerank, area FROM water_zoomed('!scale_denominator!', !bbox!) AS _) 40 | UNION ALL 41 | (SELECT cartodb_id::bigint, the_geom_webmercator, '' AS name, 'ocean' AS type, 1 AS is_lake, 0 AS ne_scalerank, 999999999 AS area FROM land_negative_zoomed('!scale_denominator!', !bbox!) AS _) 42 | 43 | aeroways: 44 | sql: | 45 | SELECT type, the_geom_webmercator FROM aeroways_zoomed('!scale_denominator!', !bbox!) AS _ 46 | 47 | ne10mroads: 48 | sql: | 49 | SELECT cartodb_id, the_geom_webmercator, type, scalerank FROM ne_10m_roads_zoomed('!scale_denominator!', !bbox!) AS _ 50 | 51 | # osm_id is used to call out a few special buildings 52 | buildings: 53 | sql: | 54 | SELECT osm_id, the_geom_webmercator, area FROM buildings_zoomed('!scale_denominator!',!bbox!) AS _ 55 | 56 | osmtunnels: 57 | sql: | 58 | select highway, railway, kind, the_geom_webmercator, is_link from tunnels('!scale_denominator!',!bbox!) as _ 59 | 60 | osmroads: 61 | sql: | 62 | select highway, railway, kind, the_geom_webmercator, is_link from high_road('!scale_denominator!',!bbox!) as _ 63 | 64 | osmbridges: 65 | sql: | 66 | select highway, railway, kind, the_geom_webmercator, is_link from bridges('!scale_denominator!',!bbox!) as _ 67 | 68 | country_city_labels: 69 | sql: | 70 | SELECT cartodb_id, name, the_geom_webmercator, scalerank, place, pop_est, country_city, is_capital FROM country_city_labels_zoomed('!scale_denominator!',!bbox!) AS _ 71 | 72 | country_city_labels_lowercase: 73 | sql: | 74 | SELECT cartodb_id, name, the_geom_webmercator, scalerank, place, pop_est, country_city, is_capital FROM country_city_labels_zoomed('!scale_denominator!',!bbox!) AS _ 75 | 76 | park_labels: 77 | sql: | 78 | SELECT name, area, the_geom_webmercator FROM green_areas_zoomed('!scale_denominator!',!bbox!) AS _ 79 | 80 | park_labels_lowercase: 81 | sql: | 82 | SELECT name, area, the_geom_webmercator FROM green_areas_zoomed('!scale_denominator!',!bbox!) AS _ 83 | 84 | water_labels: 85 | sql: | 86 | SELECT id, the_geom_webmercator, name, area, is_lake FROM water_zoomed('!scale_denominator!',!bbox!) AS _ 87 | 88 | water_labels_lowercase: 89 | sql: | 90 | SELECT id, the_geom_webmercator, name, area, is_lake FROM water_zoomed('!scale_denominator!',!bbox!) AS _ 91 | 92 | osm_roads_labels: 93 | sql: | 94 | SELECT name, highway, railway, kind, the_geom_webmercator FROM high_road_labels('!scale_denominator!',!bbox!) as _ 95 | 96 | osm_roads_labels_lowercase: 97 | sql: | 98 | SELECT name, highway, railway, kind, the_geom_webmercator FROM high_road_labels('!scale_denominator!',!bbox!) as _ 99 | 100 | marine_labels: 101 | sql: | 102 | SELECT cartodb_id, name, namealt, featurecla, the_geom_webmercator, scalerank FROM ne_marine_zoomed('!scale_denominator!',!bbox!) AS _ 103 | 104 | marine_labels_lowercase: 105 | sql: | 106 | SELECT cartodb_id, name, namealt, featurecla, the_geom_webmercator, scalerank FROM ne_marine_zoomed('!scale_denominator!',!bbox!) AS _ 107 | 108 | admin1boundary_labels: 109 | sql: | 110 | SELECT cartodb_id, name, scalerank, the_geom_webmercator, geomtype from admin1boundaries_zoomed('!scale_denominator!',!bbox!) as _ 111 | 112 | admin1boundary_labels_lowercase: 113 | sql: | 114 | SELECT cartodb_id, name, scalerank, the_geom_webmercator, geomtype from admin1boundaries_zoomed('!scale_denominator!',!bbox!) as _ 115 | 116 | admin1_labels: 117 | sql: | 118 | SELECT cartodb_id, name, scalerank, the_geom_webmercator FROM admin1_polygons_zoomed('!scale_denominator!',!bbox!) AS _ 119 | 120 | admin1_labels_lowercase: 121 | sql: | 122 | SELECT cartodb_id, name, scalerank, the_geom_webmercator FROM admin1_polygons_zoomed('!scale_denominator!',!bbox!) AS _ 123 | 124 | continent_labels: 125 | sql: | 126 | SELECT cartodb_id, name, the_geom_webmercator FROM continents_zoomed('!scale_denominator!',!bbox!) AS _ 127 | 128 | continent_labels_lowercase: 129 | sql: | 130 | SELECT cartodb_id, name, the_geom_webmercator FROM continents_zoomed('!scale_denominator!',!bbox!) AS _ 131 | -------------------------------------------------------------------------------- /migrations/v2.1.0.sql: -------------------------------------------------------------------------------- 1 | -- Migrates from 2.0.0 to 2.1.0 2 | \i ../data/core_functions.sql 3 | -- highroad_z15plus 4 | CREATE MATERIALIZED VIEW highroad_z15plus_new AS 5 | SELECT id, the_geom AS the_geom_webmercator, tags -> 'highway' as highway, tags -> 'railway' as railway, (CASE WHEN tags -> 'highway' IN ('motorway', 'motorway_link') THEN 'highway' WHEN tags -> 'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road' WHEN tags -> 'highway' IN ('footpath', 'track', 'footway', 'steps', 'pedestrian', 'path', 'cycleway') THEN 'path' WHEN tags -> 'railway' IN ('rail', 'tram', 'light_rail', 'narrow_guage', 'monorail') THEN 'rail' ELSE 'minor_road' END) AS kind, (CASE WHEN tags -> 'highway' IN ('motorway_link', 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link') THEN 'yes' ELSE 'no' END) AS is_link, (CASE WHEN tags ? 'tunnel' AND tags -> 'tunnel' != 'no' THEN 'yes' ELSE 'no' END) AS is_tunnel, (CASE WHEN tags ? 'bridge' AND tags -> 'bridge' != 'no' THEN 'yes' ELSE 'no' END) AS is_bridge, wayzorder(tags) as z_order , tags -> 'name' as name, tags -> 'ref' as ref 6 | FROM planet 7 | WHERE tags -> 'highway' IN ('motorway', 'motorway_link') OR tags -> 'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') OR tags -> 'highway' IN ('unclassified', 'residential', 'living_street', 'service', 'road') OR tags -> 'highway' IN ('footpath', 'track', 'footway', 'steps', 'pedestrian', 'path', 'cycleway') OR tags -> 'railway' IN ('rail', 'tram', 'light_rail', 'narrow_guage', 'monorail') 8 | ORDER BY ST_GeoHash(ST_Transform(ST_SetSRID(Box2D(the_geom), 3857), 4326)); 9 | CREATE INDEX highroad_z15plus_new_the_geom_webmercator_gist ON highroad_z15plus_new USING gist(the_geom_webmercator); 10 | CREATE UNIQUE INDEX ON highroad_z15plus_new (id); 11 | ANALYZE highroad_z15plus_new; 12 | 13 | ALTER INDEX highroad_z15plus_the_geom_webmercator_gist 14 | RENAME TO highroad_z15plus_old_the_geom_webmercator_gist; 15 | ALTER INDEX highroad_z15plus_id_idx 16 | RENAME TO highroad_z15plus_old_id_idx; 17 | 18 | BEGIN; 19 | ALTER MATERIALIZED VIEW highroad_z15plus 20 | RENAME TO highroad_z15plus_old; 21 | ALTER MATERIALIZED VIEW highroad_z15plus_new 22 | RENAME TO highroad_z15plus; 23 | COMMIT; 24 | 25 | ALTER INDEX highroad_z15plus_new_the_geom_webmercator_gist 26 | RENAME TO highroad_z15plus_the_geom_webmercator_gist; 27 | ALTER INDEX highroad_z15plus_new_id_idx 28 | RENAME TO highroad_z15plus_id_idx; 29 | 30 | -- highroad_z14 31 | CREATE MATERIALIZED VIEW highroad_z14_new AS 32 | SELECT id, generalize(the_geom_webmercator, 14) AS the_geom_webmercator, highway, railway, (CASE WHEN highway IN ('motorway', 'motorway_link') THEN 'highway' WHEN highway IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road' WHEN highway IN ('unclassified', 'residential', 'living_street', 'road') THEN 'minor_road' WHEN railway IN ('rail') THEN 'rail' ELSE 'unknown' END) AS kind, is_link, is_tunnel, is_bridge, z_order, name, ref 33 | FROM highroad_z15plus 34 | WHERE highway in ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'unclassified', 'residential', 'living_street', 'road') OR railway = 'rail' 35 | ORDER BY ST_GeoHash(ST_Transform(ST_SetSRID(Box2D(the_geom_webmercator), 3857), 4326)); 36 | CREATE INDEX highroad_z14_new_the_geom_webmercator_gist ON highroad_z14_new USING gist(the_geom_webmercator); 37 | CREATE UNIQUE INDEX ON highroad_z14_new (id); 38 | ANALYZE highroad_z14_new; 39 | 40 | ALTER INDEX highroad_z14_the_geom_webmercator_gist 41 | RENAME TO highroad_z14_old_the_geom_webmercator_gist; 42 | ALTER INDEX highroad_z14_id_idx 43 | RENAME TO highroad_z14_old_id_idx; 44 | 45 | BEGIN; 46 | ALTER MATERIALIZED VIEW highroad_z14 47 | RENAME TO highroad_z14_old; 48 | ALTER MATERIALIZED VIEW highroad_z14_new 49 | RENAME TO highroad_z14; 50 | COMMIT; 51 | 52 | ALTER INDEX highroad_z14_new_the_geom_webmercator_gist 53 | RENAME TO highroad_z14_the_geom_webmercator_gist; 54 | ALTER INDEX highroad_z14_new_id_idx 55 | RENAME TO highroad_z14_id_idx; 56 | 57 | -- highroad_z13 58 | CREATE MATERIALIZED VIEW highroad_z13_new AS 59 | SELECT id, generalize(the_geom_webmercator, 13) AS the_geom_webmercator, highway, railway, (CASE WHEN highway IN ('motorway', 'motorway_link') THEN 'highway' WHEN highway IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road' ELSE 'minor_road' END) AS kind, is_link, is_tunnel, is_bridge, z_order, name, ref 60 | FROM highroad_z14 61 | WHERE highway in ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'unclassified', 'residential', 'living_street', 'road') OR railway = 'rail' 62 | ORDER BY ST_GeoHash(ST_Transform(ST_SetSRID(Box2D(the_geom_webmercator), 3857), 4326)); 63 | CREATE INDEX highroad_z13_new_the_geom_webmercator_gist ON highroad_z13_new USING gist(the_geom_webmercator); 64 | CREATE UNIQUE INDEX ON highroad_z13_new (id); 65 | ANALYZE highroad_z13_new; 66 | 67 | ALTER INDEX highroad_z13_the_geom_webmercator_gist 68 | RENAME TO highroad_z13_old_the_geom_webmercator_gist; 69 | ALTER INDEX highroad_z13_id_idx 70 | RENAME TO highroad_z13_old_id_idx; 71 | 72 | BEGIN; 73 | ALTER MATERIALIZED VIEW highroad_z13 74 | RENAME TO highroad_z13_old; 75 | ALTER MATERIALIZED VIEW highroad_z13_new 76 | RENAME TO highroad_z13; 77 | COMMIT; 78 | 79 | ALTER INDEX highroad_z13_new_the_geom_webmercator_gist 80 | RENAME TO highroad_z13_the_geom_webmercator_gist; 81 | ALTER INDEX highroad_z13_new_id_idx 82 | RENAME TO highroad_z13_id_idx; 83 | 84 | -- highroad_z12 85 | CREATE MATERIALIZED VIEW highroad_z12_new AS 86 | SELECT id, generalize(the_geom_webmercator, 12) AS the_geom_webmercator, highway, railway, (CASE WHEN highway IN ('motorway') THEN 'highway' WHEN highway IN ('trunk', 'primary', 'secondary') THEN 'major_road' ELSE 'minor_road' END) AS kind, 'no'::text AS is_link, is_tunnel, is_bridge, z_order, name, ref 87 | FROM highroad_z13 88 | WHERE highway in ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'living_street', 'road') 89 | ORDER BY ST_GeoHash(ST_Transform(ST_SetSRID(Box2D(the_geom_webmercator), 3857), 4326)); 90 | CREATE INDEX highroad_z12_new_the_geom_webmercator_gist ON highroad_z12_new USING gist(the_geom_webmercator); 91 | CREATE UNIQUE INDEX ON highroad_z12_new (id); 92 | ANALYZE highroad_z12_new; 93 | 94 | ALTER INDEX highroad_z12_the_geom_webmercator_gist 95 | RENAME TO highroad_z12_old_the_geom_webmercator_gist; 96 | ALTER INDEX highroad_z12_id_idx 97 | RENAME TO highroad_z12_old_id_idx; 98 | 99 | BEGIN; 100 | ALTER MATERIALIZED VIEW highroad_z12 101 | RENAME TO highroad_z12_old; 102 | ALTER MATERIALIZED VIEW highroad_z12_new 103 | RENAME TO highroad_z12; 104 | COMMIT; 105 | 106 | ALTER INDEX highroad_z12_new_the_geom_webmercator_gist 107 | RENAME TO highroad_z12_the_geom_webmercator_gist; 108 | ALTER INDEX highroad_z12_new_id_idx 109 | RENAME TO highroad_z12_id_idx; 110 | 111 | -- highroad_z11 112 | CREATE MATERIALIZED VIEW highroad_z11_new AS 113 | SELECT id, generalize(the_geom_webmercator, 11) AS the_geom_webmercator, highway, railway, (CASE WHEN highway IN ('motorway') THEN 'highway' WHEN highway IN ('trunk', 'primary') THEN 'major_road' ELSE 'minor_road' END) AS kind, 'no'::text AS is_link, is_tunnel, is_bridge, z_order, name, ref 114 | FROM highroad_z12 115 | WHERE highway in ('motorway', 'trunk', 'primary', 'secondary', 'tertiary') 116 | ORDER BY ST_GeoHash(ST_Transform(ST_SetSRID(Box2D(the_geom_webmercator), 3857), 4326)); 117 | CREATE INDEX highroad_z11_new_the_geom_webmercator_gist ON highroad_z11_new USING gist(the_geom_webmercator); 118 | CREATE UNIQUE INDEX ON highroad_z11_new (id); 119 | ANALYZE highroad_z11_new; 120 | 121 | ALTER INDEX highroad_z11_the_geom_webmercator_gist 122 | RENAME TO highroad_z11_old_the_geom_webmercator_gist; 123 | ALTER INDEX highroad_z11_id_idx 124 | RENAME TO highroad_z11_old_id_idx; 125 | 126 | BEGIN; 127 | ALTER MATERIALIZED VIEW highroad_z11 128 | RENAME TO highroad_z11_old; 129 | ALTER MATERIALIZED VIEW highroad_z11_new 130 | RENAME TO highroad_z11; 131 | COMMIT; 132 | 133 | ALTER INDEX highroad_z11_new_the_geom_webmercator_gist 134 | RENAME TO highroad_z11_the_geom_webmercator_gist; 135 | ALTER INDEX highroad_z11_new_id_idx 136 | RENAME TO highroad_z11_id_idx; 137 | 138 | -- highroad_z10 139 | CREATE MATERIALIZED VIEW highroad_z10_new AS 140 | SELECT id, generalize(the_geom_webmercator, 10) AS the_geom_webmercator, highway, railway, (CASE WHEN highway IN ('motorway') THEN 'highway' WHEN highway IN ('trunk', 'primary') THEN 'major_road' ELSE 'minor_road' END) AS kind, 'no'::text AS is_link, is_tunnel, is_bridge, z_order, name, ref 141 | FROM highroad_z11 142 | WHERE highway in ('motorway', 'trunk', 'primary', 'secondary') 143 | ORDER BY ST_GeoHash(ST_Transform(ST_SetSRID(Box2D(the_geom_webmercator), 3857), 4326)); 144 | CREATE INDEX highroad_z10_new_the_geom_webmercator_gist ON highroad_z10_new USING gist(the_geom_webmercator); 145 | CREATE UNIQUE INDEX ON highroad_z10_new (id); 146 | ANALYZE highroad_z10_new; 147 | 148 | ALTER INDEX highroad_z10_the_geom_webmercator_gist 149 | RENAME TO highroad_z10_old_the_geom_webmercator_gist; 150 | ALTER INDEX highroad_z10_id_idx 151 | RENAME TO highroad_z10_old_id_idx; 152 | 153 | BEGIN; 154 | ALTER MATERIALIZED VIEW highroad_z10 155 | RENAME TO highroad_z10_old; 156 | ALTER MATERIALIZED VIEW highroad_z10_new 157 | RENAME TO highroad_z10; 158 | COMMIT; 159 | 160 | ALTER INDEX highroad_z10_new_the_geom_webmercator_gist 161 | RENAME TO highroad_z10_the_geom_webmercator_gist; 162 | ALTER INDEX highroad_z10_new_id_idx 163 | RENAME TO highroad_z10_id_idx; 164 | 165 | \i ../data/global_functions.sql 166 | 167 | DROP MATERIALIZED VIEW IF EXISTS highroad_z10_old; 168 | DROP MATERIALIZED VIEW IF EXISTS highroad_z11_old; 169 | DROP MATERIALIZED VIEW IF EXISTS highroad_z12_old; 170 | DROP MATERIALIZED VIEW IF EXISTS highroad_z13_old; 171 | DROP MATERIALIZED VIEW IF EXISTS highroad_z14_old; 172 | DROP MATERIALIZED VIEW IF EXISTS highroad_z15plus_old; 173 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "async": "^0.9.0", 4 | "underscore": "^1.7.0", 5 | "js-yaml": "^3.2.2", 6 | "pg": "^3.5.0", 7 | "request": "^2.40.0", 8 | "cartodb-yaml": "^0.1.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /positron-all-lowercase.yml: -------------------------------------------------------------------------------- 1 | name: Positron-all-lowercase 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: styles/global_variables_lowercase.mss 7 | - false_background: 8 | - land_positive: 9 | - urban_areas: 10 | - green_areas: 11 | - admin0boundaries: 12 | - admin1boundaries: 13 | - water: 14 | - aeroways: 15 | - ne10mroads: 16 | - buildings: 17 | - osmtunnels: 18 | - osmroads: 19 | - osmbridges: 20 | - country_city_labels_lowercase: 21 | - park_labels_lowercase: 22 | - water_labels_lowercase: 23 | - osm_roads_labels_lowercase: 24 | - marine_labels_lowercase: 25 | - admin1boundary_labels_lowercase: 26 | - admin1_labels_lowercase: 27 | - continent_labels_lowercase: 28 | -------------------------------------------------------------------------------- /positron-all.yml: -------------------------------------------------------------------------------- 1 | name: Positron-all 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: 7 | - false_background: 8 | - land_positive: 9 | - urban_areas: 10 | - green_areas: 11 | - admin0boundaries: 12 | - admin1boundaries: 13 | - water: 14 | - aeroways: 15 | - ne10mroads: 16 | - buildings: 17 | - osmtunnels: 18 | - osmroads: 19 | - osmbridges: 20 | - country_city_labels: 21 | - park_labels: 22 | - water_labels: 23 | - osm_roads_labels: 24 | - marine_labels: 25 | - admin1boundary_labels: 26 | - admin1_labels: 27 | - continent_labels: 28 | -------------------------------------------------------------------------------- /positron-labels-only.yml: -------------------------------------------------------------------------------- 1 | name: Positron-labels-only 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: styles/global_variables_only_labels.mss 7 | - country_city_labels: 8 | - park_labels: 9 | - water_labels: 10 | - osm_roads_labels: 11 | - marine_labels: 12 | - admin1boundary_labels: 13 | - admin1_labels: 14 | - continent_labels: 15 | -------------------------------------------------------------------------------- /positron-no-labels.yml: -------------------------------------------------------------------------------- 1 | name: Positron-no-labels 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: 7 | - false_background: 8 | - land_positive: 9 | - urban_areas: 10 | - green_areas: 11 | - admin0boundaries: 12 | - admin1boundaries: 13 | - water: 14 | - aeroways: 15 | - ne10mroads: 16 | - buildings: 17 | - osmtunnels: 18 | - osmroads: 19 | - osmbridges: 20 | -------------------------------------------------------------------------------- /positron.yml: -------------------------------------------------------------------------------- 1 | name: Positron 2 | minzoom: 0 3 | maxzoom: 20 4 | 5 | layers: 6 | - global_variables: 7 | - false_background: 8 | - land_positive: 9 | - admin0boundaries: 10 | - admin1boundaries: 11 | - water: 12 | - aeroways: 13 | - ne10mroads: 14 | - osmtunnels: 15 | - osmroads: 16 | - osmbridges: 17 | - country_city_labels: 18 | - park_labels: 19 | - water_labels: 20 | - osm_roads_labels: 21 | - marine_labels: 22 | - admin1boundary_labels: 23 | - admin1_labels: 24 | - continent_labels: 25 | -------------------------------------------------------------------------------- /styles/admin0boundaries.mss: -------------------------------------------------------------------------------- 1 | // Zooms 2-9 from Natural Earth, zoom 10+ from OSM 2 | 3 | #admin0boundaries { 4 | ::outline { 5 | line-width: 0; 6 | } 7 | line-color: @admin0_4; 8 | line-width: 0.5; 9 | 10 | [zoom=4] { 11 | line-color: @admin0_4; 12 | } 13 | 14 | [zoom>=5] { 15 | line-width: 0.5; 16 | line-color: @admin0_5; 17 | } 18 | 19 | [zoom=6] { 20 | ::outline { 21 | line-width: 8; 22 | line-color: @admin0_6; 23 | line-opacity: 0.5; 24 | } 25 | 26 | line-width: 0.5; 27 | line-color: @admin0_5; 28 | } 29 | 30 | [zoom>=7] { 31 | ::outline { 32 | line-width: 8; 33 | line-color: @admin0_6; 34 | line-opacity: 0.5; 35 | } 36 | 37 | line-color: @admin0_7; 38 | line-width: 1.5; 39 | } 40 | 41 | [unit=true] { 42 | // Only applies to "map units" from Natural Earth, aka national boundaries within the UK and Belgium, mainly.. 43 | line-dasharray: 2,2; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /styles/admin1_labels.mss: -------------------------------------------------------------------------------- 1 | // zooms 3-7 2 | 3 | #admin1_labels[zoom>=5][zoom<=7]{ 4 | text-name: "[name]"; 5 | text-halo-fill: @admin1_labels_halo; 6 | text-face-name: "Azo Sans Regular","DejaVu Sans Bold","unifont Medium"; 7 | text-transform: uppercase; 8 | 9 | [zoom=5][scalerank<3], 10 | [zoom=6][scalerank<4]{ 11 | text-size: @admin1_labels_size; 12 | text-halo-radius: @admin1_labels_halo_radius; 13 | text-fill: @admin1_labels; 14 | } 15 | 16 | [zoom=7][scalerank<99]{ 17 | text-size: @admin1_lowzoom_labels_size; 18 | text-halo-radius: @admin1_lowzoom_labels_halo_radius; 19 | text-fill: @admin1_lowzoom_labels; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /styles/admin1_labels_lowercase.mss: -------------------------------------------------------------------------------- 1 | // zooms 3-7 2 | 3 | #admin1_labels[zoom>=5][zoom<=7]{ 4 | text-name: "[name]"; 5 | text-halo-fill: @admin1_labels_halo; 6 | text-face-name: "Open Sans Regular","DejaVu Sans Bold","unifont Medium"; 7 | text-transform: uppercase; 8 | text-wrap-width: 10; 9 | 10 | [zoom=5][scalerank<3], 11 | [zoom=6][scalerank<4]{ 12 | text-size: 11; 13 | text-halo-radius: 1; 14 | text-fill: @admin1_labels; 15 | text-character-spacing: 0.5; 16 | 17 | [zoom=6]{text-size:12;} 18 | } 19 | 20 | [zoom=7][scalerank<99]{ 21 | text-size: @admin1_lowzoom_labels_size; 22 | text-halo-radius: @admin1_lowzoom_labels_halo_radius; 23 | text-fill: @admin1_lowzoom_labels; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /styles/admin1boundaries.mss: -------------------------------------------------------------------------------- 1 | // Zooms 2+ 2 | 3 | #admin1boundaries { 4 | [zoom=2], 5 | [zoom=3][scalerank<4], 6 | [zoom=4][scalerank<5], 7 | [zoom=5][scalerank<5], 8 | [zoom=6][scalerank<5], 9 | [zoom=7][scalerank<6], 10 | [zoom=8][scalerank<7], 11 | [zoom>8] 12 | { 13 | eraser/line-color: @landmass_fill; 14 | eraser/line-width: 0.5; 15 | line-width: 0.5; 16 | line-color: @admin1_lowzoom; 17 | [zoom>=6] { 18 | line-color: @admin1_highzoom; 19 | } 20 | 21 | [zoom>=7] { 22 | eraser/line-width: 1; 23 | line-width: 1; 24 | line-dasharray: 2,2; 25 | } 26 | [zoom>=9] { 27 | eraser/line-width: 2; 28 | line-width: 2; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /styles/admin1boundary_labels.mss: -------------------------------------------------------------------------------- 1 | #admin1boundary_labels[zoom>=13] { 2 | text-size: 12; 3 | text-name: "[name]"; 4 | text-fill: @admin1_highzoom; 5 | text-halo-radius: 1.4px; 6 | text-halo-fill: @landmass_fill; 7 | text-face-name: "Azo Sans Regular","DejaVu Sans Bold","unifont Medium"; 8 | text-character-spacing: 1.2; 9 | text-placement: line; 10 | text-transform: uppercase; 11 | text-dy: -10px; 12 | text-avoid-edges: true; 13 | } 14 | -------------------------------------------------------------------------------- /styles/admin1boundary_labels_lowercase.mss: -------------------------------------------------------------------------------- 1 | #admin1boundary_labels[zoom>=13] { 2 | text-size: 12; 3 | text-name: "[name]"; 4 | text-fill: @admin_boundary_labels; 5 | text-halo-radius: 1.4px; 6 | text-halo-fill: @admin_boundary_halo; 7 | text-face-name: "Open Sans Regular","DejaVu Sans Bold","unifont Medium"; 8 | text-character-spacing: 1.2; 9 | text-placement: line; 10 | text-transform: uppercase; 11 | text-dy: -10px; 12 | text-avoid-edges: true; 13 | } 14 | -------------------------------------------------------------------------------- /styles/aeroways.mss: -------------------------------------------------------------------------------- 1 | // Zooms 12 and up 2 | 3 | #aeroways { 4 | line-cap: square; 5 | line-join: miter; 6 | line-color: @aeroways; 7 | 8 | [type='runway'] { 9 | [zoom=12] { 10 | line-width: 2; 11 | } 12 | 13 | [zoom=13] { 14 | line-width: 4; 15 | } 16 | 17 | [zoom=14] { 18 | line-width: 8; 19 | } 20 | 21 | [zoom=15] { 22 | line-width: 16; 23 | } 24 | 25 | [zoom=16] { 26 | line-width: 32; 27 | } 28 | 29 | [zoom=17] { 30 | line-width: 64; 31 | } 32 | 33 | [zoom>=18] { 34 | line-width: 128; 35 | } 36 | } 37 | 38 | [type='taxiway'] { 39 | [zoom=13] { 40 | line-width: 1; 41 | } 42 | 43 | [zoom=14] { 44 | line-width: 2; 45 | } 46 | 47 | [zoom=15] { 48 | line-width: 4; 49 | } 50 | 51 | [zoom=16] { 52 | line-width: 8; 53 | } 54 | 55 | [zoom=17] { 56 | line-width: 16; 57 | } 58 | 59 | [zoom>=18] { 60 | line-width: 32; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /styles/buildings.mss: -------------------------------------------------------------------------------- 1 | // Zooms 12-18 2 | 3 | #buildings { 4 | [zoom=13][area>=10000], 5 | [zoom=14][area>=5000], 6 | [zoom=15][area>=2000], 7 | [zoom>=16] { 8 | polygon-fill: @buildings; 9 | } 10 | [zoom = 16] { 11 | line-color: @buildings_outline_16; 12 | } 13 | [zoom > 16] { 14 | line-color: @buildings_outline; 15 | } 16 | [zoom >= 18] { 17 | [osm_id = 140780178], // Madrid 18 | [osm_id = 279649784], // Brooklyn 19 | [osm_id = 260351411] // Stamen 20 | { 21 | ::red { 22 | line-width:2; 23 | line-color: red; 24 | line-offset: -8; 25 | } 26 | ::orange { 27 | line-width:2; 28 | line-color: orange; 29 | line-offset: -6; 30 | } 31 | ::yellow { 32 | line-width:2; 33 | line-color: yellow; 34 | line-offset: -4; 35 | } 36 | ::green { 37 | line-width:2; 38 | line-color: green; 39 | line-offset: -2; 40 | } 41 | ::blue { 42 | line-width:2; 43 | line-color: blue; 44 | } 45 | ::purple { 46 | line-width:2; 47 | line-color: purple; 48 | line-offset: 2; 49 | } 50 | ::halo { 51 | line-width:4; 52 | line-color: @landmass_fill; 53 | line-offset: 5; 54 | } 55 | } 56 | // For multipolygons, we have to put the rainbow on the outside of the building 57 | /* 58 | * The Brooklyn office moved and is no longer a MP 59 | [osm_id = -3720805] // Brooklyn 60 | { 61 | polygon-clip: false; 62 | ::red { 63 | line-width:2; 64 | line-color: red; 65 | line-offset: 6; 66 | } 67 | ::orange { 68 | line-width:2; 69 | line-color: orange; 70 | line-offset: 5; 71 | } 72 | ::yellow { 73 | line-width:2; 74 | line-color: yellow; 75 | line-offset: 4; 76 | } 77 | ::green { 78 | line-width:2; 79 | line-color: green; 80 | line-offset: 3; 81 | } 82 | ::blue { 83 | line-width:2; 84 | line-color: blue; 85 | line-offset: 2; 86 | } 87 | ::purple { 88 | line-width:2; 89 | line-color: purple; 90 | line-offset: 1; 91 | } 92 | ::refill { 93 | // paint over any artifacts 94 | polygon-fill: @buildings; 95 | } 96 | } 97 | */ 98 | } 99 | } 100 | 101 | -------------------------------------------------------------------------------- /styles/continent_labels.mss: -------------------------------------------------------------------------------- 1 | // Zooms 0-2 2 | 3 | #continent_labels { 4 | text-size: 12; 5 | text-name: "[name]"; 6 | text-halo-radius: 1.6px; 7 | text-halo-fill: @label_foreground_halo_fill; 8 | text-fill: @continent_labels; 9 | text-face-name: "Azo Sans Regular"; 10 | text-transform: uppercase; 11 | 12 | [zoom=2] { 13 | text-size: 14; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /styles/continent_labels_lowercase.mss: -------------------------------------------------------------------------------- 1 | // Zooms 0-2 2 | 3 | #continent_labels { 4 | text-size: 12; 5 | text-name: "[name]"; 6 | text-halo-radius: 1px; 7 | text-halo-fill: @label_foreground_halo_fill; 8 | text-fill: @continent_labels; 9 | text-face-name: "Open Sans Regular"; 10 | text-transform: uppercase; 11 | text-wrap-width: 100; 12 | } 13 | -------------------------------------------------------------------------------- /styles/country_city_labels.mss: -------------------------------------------------------------------------------- 1 | // Zooms 1-13 2 | 3 | #country_city_labels[country_city="city"] { 4 | [zoom=4][scalerank<=4], 5 | [zoom=5][scalerank<=5], 6 | [zoom=6][scalerank<=6], 7 | [zoom=7][scalerank<=7] { 8 | shield-name: "[name]"; 9 | shield-fill: @label_foreground_fill; 10 | shield-halo-fill: @labels_lowzoom_shield_halo_fill; 11 | shield-face-name: "Azo Sans Regular","DejaVu Sans Bold","unifont Medium"; 12 | shield-halo-radius: @labels_lowzoom_shield_halo_radius; 13 | shield-text-transform: uppercase; 14 | shield-min-distance: 5; 15 | [zoom=5] { 16 | shield-min-distance: 0; 17 | } 18 | shield-file: @city_shield_file_lowzoom; 19 | [is_capital=true] { 20 | shield-file: @capital_shield_file_lowzoom; 21 | } 22 | shield-character-spacing: 1.2; 23 | shield-line-spacing: -1; 24 | shield-placement-type: simple; 25 | 26 | shield-placements: "E,W,12"; 27 | [cartodb_id =~ '.*(0|2|4|6|8)$'] { 28 | shield-placements: "E,12"; 29 | } 30 | [cartodb_id =~ '.*(1|3|5|7|9)$'] { 31 | shield-placements: "W,12"; 32 | } 33 | shield-text-dx: 6; 34 | shield-text-dy: 0; 35 | shield-unlock-image: true; 36 | shield-wrap-width: 100; 37 | shield-wrap-before: true; 38 | 39 | [zoom=6][scalerank>4] { 40 | shield-fill: @labels_lowzoom_shield_fill; 41 | shield-file: @city_shield_file; 42 | [is_capital=true]{ 43 | shield-file: @capital_shield_file; 44 | } 45 | } 46 | [zoom=6][scalerank<=4], 47 | [zoom=6][is_capital=true] { 48 | shield-size: 14; 49 | shield-line-spacing: -2; 50 | } 51 | 52 | [zoom=7][scalerank>5] { 53 | shield-fill: @labels_lowzoom_shield_fill; 54 | shield-file: @city_shield_file; 55 | shield-min-distance: 20; 56 | [is_capital=true]{ 57 | shield-file: @capital_shield_file; 58 | } 59 | } 60 | [zoom=7][scalerank<=5], 61 | [zoom=7][is_capital=true] { 62 | shield-size: 14; 63 | shield-line-spacing: -2; 64 | } 65 | } 66 | 67 | // Transition from townpoints to plain text at z8 68 | 69 | [zoom=8][scalerank<=7], 70 | [zoom=9][scalerank<=9], 71 | [zoom=10][scalerank<=9], 72 | [zoom=11][scalerank<=10], 73 | [zoom=12][scalerank<=10], 74 | [zoom>=13][place='town'], 75 | [zoom>=13][place='village'], 76 | [zoom>=13][place='suburb'], 77 | [zoom>=13][place='neighbourhood'] { 78 | 79 | text-name: "[name]"; 80 | text-face-name: "Azo Sans Regular","DejaVu Sans Bold","unifont Medium"; 81 | text-transform: uppercase; 82 | 83 | text-wrap-width: 100; 84 | text-wrap-before: true; 85 | text-character-spacing: 1.2; 86 | text-halo-radius: @labels_highzoom_halo_radius; 87 | text-halo-fill: @labels_highzoom_halo_fill; 88 | text-fill: @labels_highzoom_text_fill; 89 | 90 | text-min-distance: 10; 91 | 92 | // class 1 (bigger) 93 | [zoom=8][scalerank<=6], 94 | [zoom=9][scalerank<=7], 95 | [zoom=10][scalerank<=7] { 96 | text-size: @labels_highzoom_class1_text_size; 97 | text-fill: @labels_highzoom_class1_text_fill; 98 | text-line-spacing: -2; 99 | } 100 | [zoom=11][scalerank<=7], 101 | [zoom=12][scalerank<=7] { 102 | text-size: 14; 103 | text-fill: @labels_highzoom_class1_text_fill; 104 | } 105 | 106 | // class 2 (biggest) 107 | [zoom=8][scalerank<=5], 108 | [zoom=9][scalerank<=5], 109 | [zoom=10][scalerank<=5] { 110 | text-size: 16; 111 | text-fill: @labels_highzoom_class2_text_fill; 112 | } 113 | [zoom=11][scalerank<=5], 114 | [zoom=12][scalerank<=5] 115 | { 116 | text-size: 18; 117 | text-fill: @label_foreground_fill; 118 | } 119 | 120 | // class 0 (default) 121 | text-size: @labels_highzoom_class1_text_size_default; 122 | 123 | // At this zoom cities disappear, and it's only neighborhoods 124 | [zoom>=13] { 125 | text-size: 11; 126 | text-fill: @label_foreground_fill; 127 | } 128 | } 129 | } 130 | 131 | #country_city_labels[country_city="country"]{ 132 | [zoom=3][scalerank<2][pop_est >= 2000000], 133 | [zoom=4][scalerank<3][pop_est >= 2000000], 134 | [zoom=5][scalerank<4] { 135 | text-size: 15; 136 | text-line-spacing: -3; 137 | text-wrap-width: 100; 138 | text-wrap-before: true; 139 | text-ratio: 0.5; 140 | text-name: "[name]"; 141 | [name="Falkland Islands"] { 142 | text-name: [name] + "\n(Malvinas)"; 143 | } 144 | 145 | text-halo-radius: @label_foreground_halo_radius; 146 | text-halo-fill: @label_foreground_halo_fill; 147 | text-face-name: "Azo Sans Regular","DejaVu Sans Bold","unifont Medium"; 148 | text-min-distance: 10; 149 | text-transform: uppercase; 150 | 151 | [zoom=3] { 152 | text-size: @countries_class2_label_size; 153 | text-fill: @countries_class2_text_fill; 154 | text-halo-radius: @countries_class2_text_halo_radius; 155 | 156 | [pop_est>20000000] { 157 | text-size: 14; 158 | text-fill: @countries_class1_text_fill; 159 | text-halo-radius: @label_foreground_halo_radius; 160 | text-halo-fill: @label_foreground_halo_fill; 161 | } 162 | } 163 | [zoom=4],[zoom=5] { 164 | text-size: 12; 165 | text-line-spacing: -3; 166 | 167 | text-fill: @countries_highzoom_class1_text_fill; 168 | text-halo-fill: @label_background_halo_fill; 169 | text-halo-radius: @label_foreground_halo_radius; 170 | text-face-name: "Azo Sans Regular","DejaVu Sans Bold","unifont Medium"; 171 | 172 | [pop_est>20000000] { 173 | text-size: 16; 174 | text-line-spacing: -4; 175 | text-wrap-width: 200; 176 | } 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /styles/country_city_labels_lowercase.mss: -------------------------------------------------------------------------------- 1 | // Zooms 1-13 2 | 3 | #country_city_labels[country_city="city"][zoom<=17] { 4 | [zoom=4][scalerank<=4], 5 | [zoom=5][scalerank<=5], 6 | [zoom=6][scalerank<=6], 7 | [zoom=7][scalerank<=7] { 8 | shield-size: 10; 9 | shield-name: "[name]"; 10 | shield-fill: darken(@label_foreground_fill,5); 11 | shield-halo-fill: @labels_lowzoom_shield_halo_fill; 12 | shield-face-name: "Open Sans Regular","DejaVu Sans Bold","unifont Medium"; 13 | shield-halo-radius: @labels_lowzoom_shield_halo_radius; 14 | //shield-text-transform: uppercase; 15 | shield-min-distance: 5; 16 | [zoom=5] { 17 | shield-min-distance: 0; 18 | } 19 | shield-file: @city_shield_file_lowzoom; 20 | [is_capital=true] { 21 | shield-file: @capital_shield_file_lowzoom; 22 | } 23 | shield-character-spacing: 1.2; 24 | shield-line-spacing: -1; 25 | shield-placement-type: simple; 26 | 27 | shield-placements: "E,W,12"; 28 | [cartodb_id =~ '.*(0|2|4|6|8)$'] { 29 | shield-placements: "E,12"; 30 | } 31 | [cartodb_id =~ '.*(1|3|5|7|9)$'] { 32 | shield-placements: "W,12"; 33 | } 34 | shield-text-dx: 6; 35 | shield-text-dy: 0; 36 | shield-unlock-image: true; 37 | shield-wrap-width: 150; 38 | shield-wrap-before: true; 39 | 40 | [zoom=6][scalerank>4] { 41 | shield-fill: @labels_lowzoom_shield_fill; 42 | shield-file: @city_shield_file; 43 | [is_capital=true]{ 44 | shield-file: @capital_shield_file; 45 | } 46 | } 47 | [zoom=6][scalerank<=4], 48 | [zoom=6][is_capital=true] { 49 | shield-size: 14; 50 | shield-line-spacing: -2; 51 | } 52 | 53 | [zoom=7][scalerank>5] { 54 | shield-fill: @labels_lowzoom_shield_fill; 55 | shield-file: @city_shield_file; 56 | shield-min-distance: 20; 57 | [is_capital=true]{ 58 | shield-file: @capital_shield_file; 59 | } 60 | } 61 | [zoom=7][scalerank<=5], 62 | [zoom=7][is_capital=true] { 63 | shield-size: 14; 64 | shield-line-spacing: -2; 65 | } 66 | } 67 | 68 | // Transition from townpoints to plain text at z8 69 | 70 | [zoom=8][scalerank<=7], 71 | [zoom=9][scalerank<=8], 72 | [zoom=10][scalerank<=9], 73 | [zoom=11][scalerank<=10], 74 | [zoom=12][scalerank<=10], 75 | [zoom>=13][place='town'], 76 | [zoom>=13][place='village'], 77 | [zoom>=13][place='suburb'], 78 | [zoom>=13][place='neighbourhood'] { 79 | 80 | text-name: "[name]"; 81 | text-face-name: "Open Sans Regular","DejaVu Sans Bold","unifont Medium"; 82 | //text-transform: uppercase; 83 | 84 | [zoom<=11]{text-wrap-width: 100;} 85 | [zoom=12]{text-wrap-width: 120;} 86 | text-wrap-before: true; 87 | text-character-spacing: 1; 88 | 89 | text-halo-radius: @labels_highzoom_halo_radius; 90 | text-halo-fill: @labels_highzoom_halo_fill; 91 | text-fill: @labels_highzoom_class1_small_text_fill; 92 | 93 | text-min-distance: 10; 94 | [zoom=10]{text-min-distance: 20;} 95 | [zoom>=11]{text-min-distance: 28;} 96 | 97 | 98 | [zoom>=11]{text-size: 10;} 99 | 100 | // class 1 (bigger) 101 | [zoom=8][scalerank<=6], 102 | [zoom=9][scalerank<=7], 103 | [zoom=10][scalerank<=7] { 104 | text-size: 11; 105 | text-fill: @labels_highzoom_class1_text_fill; 106 | text-line-spacing: -1; 107 | } 108 | [zoom=11][scalerank<=7], 109 | [zoom=12][scalerank<=7] { 110 | text-size: 12; 111 | text-fill: @labels_highzoom_class1_text_fill; 112 | } 113 | 114 | // class 2 (biggest) 115 | [zoom=8][scalerank<=5], 116 | [zoom=9][scalerank<=5], 117 | [zoom=10][scalerank<=5] { 118 | text-size: 16; 119 | text-fill: @labels_highzoom_class2_text_fill; 120 | text-wrap-width: 100; 121 | } 122 | [zoom=11][scalerank<=5], 123 | [zoom=12][scalerank<=5] 124 | { 125 | text-size: 18; 126 | text-fill: @label_foreground_fill; 127 | text-wrap-width: 100; 128 | } 129 | 130 | // class 0 (default) 131 | text-size: @labels_highzoom_class1_text_size_default; 132 | 133 | 134 | 135 | // At this zoom cities disappear, and it's only neighborhoods 136 | [zoom>=13] { 137 | text-size: 10.5; 138 | text-fill: @label_foreground_fill; 139 | text-wrap-width: 80; 140 | } 141 | 142 | [zoom>=14]{ 143 | text-size: 12; 144 | } 145 | } 146 | } 147 | 148 | #country_city_labels[country_city="country"]{ 149 | [zoom=3][scalerank<2][pop_est >= 2000000], 150 | [zoom=4][scalerank<3][pop_est >= 2000000], 151 | [zoom=5][scalerank<4] { 152 | text-size: 10; 153 | text-line-spacing: -3; 154 | text-wrap-width: 100; 155 | text-wrap-before: true; 156 | text-ratio: 0.5; 157 | text-name: "[name]"; 158 | [name="Falkland Islands"] { 159 | text-name: [name] + "\n(Malvinas)"; 160 | } 161 | 162 | text-halo-radius: @label_foreground_halo_radius; 163 | text-halo-fill: @label_foreground_halo_fill; 164 | text-face-name: "Open Sans Regular","DejaVu Sans Bold","unifont Medium"; 165 | text-min-distance: 10; 166 | text-transform: uppercase; 167 | 168 | [zoom=3] { 169 | text-character-spacing: 0.5; 170 | text-size: 10;//@countries_class2_label_size; 171 | text-fill: @countries_class1_text_fill; 172 | text-halo-radius: @countries_class2_text_halo_radius; 173 | 174 | [pop_est>20000000] { 175 | text-size: 10; 176 | text-fill: @countries_class1_text_fill; 177 | text-halo-radius: @label_foreground_halo_radius; 178 | text-halo-fill: @label_foreground_halo_fill; 179 | } 180 | } 181 | [zoom=4],[zoom=5] { 182 | text-size: 10; 183 | text-line-spacing: -3; 184 | text-character-spacing: 0.5; 185 | 186 | text-fill: @countries_class1_text_fill; 187 | text-halo-fill: @label_background_halo_fill; 188 | text-halo-radius: @label_foreground_halo_radius; 189 | text-face-name: "Open Sans Regular","DejaVu Sans Bold","unifont Medium"; 190 | 191 | [pop_est>20000000] { 192 | text-size: 11; 193 | text-line-spacing: -4; 194 | text-wrap-width: 200; 195 | } 196 | } 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /styles/false_background.mss: -------------------------------------------------------------------------------- 1 | #false_background { 2 | polygon-fill: @landmass_fill; 3 | } 4 | -------------------------------------------------------------------------------- /styles/global_variables.mss: -------------------------------------------------------------------------------- 1 | // Default colors for the light style ("positron") 2 | 3 | 4 | // this should be incremented when the data (queries, functions, features) changes: 5 | @cachebuster: #0000c7; 6 | 7 | @polygoncolor: #ffd479; 8 | @water: #cdd2d4; 9 | 10 | Map { 11 | background-color: @water; 12 | buffer-size: 256; 13 | } 14 | 15 | @landmass_fill: lighten(#e3e3dc, 8%); 16 | @landmass_line: darken(#bfc7c8, 10%); 17 | 18 | @greenareas_fill_low: lighten(#d4dad6,8%); 19 | @greenareas_fill_medium: lighten(#d4dad6,5%); 20 | @greenareas_fill_high: lighten(#d4dad6,6%); 21 | 22 | @buildings: lighten(#e3e3dc, 5%); 23 | @buildings_outline_16: #ddd; 24 | @buildings_outline: #ddd; 25 | 26 | @aeroways: #e8e8e8; 27 | 28 | @ne10roads_line_color: white; 29 | @ne10roads_line_outline: darken(#b4b2a3, 2%); 30 | @ne10roads_7_minor_color: darken(@ne10roads_line_color,12%); 31 | 32 | @ne_rivers_stroke: lighten(#346fa1,30%); 33 | @ne_rivers_casing: darken(#f5f5f3,1%); 34 | 35 | @urbanareas: darken(#f5f5f3, 4%); 36 | @urbanareas_highzoom: darken(#f5f5f3, 3%); 37 | 38 | 39 | @admin0_4: lighten(#c79297, 20%); 40 | @admin0_5: lighten(#c99297,10%); 41 | @admin0_6: mix(lighten(#c99297, 20%), lighten(#e3e3dc, 8%), 20); 42 | @admin0_7: lighten(#c99297,20%); 43 | 44 | @admin1_lowzoom: lighten(#6d6e71, 40%); 45 | @admin1_highzoom: lighten(#c79297, 15%); 46 | 47 | //osm roads 48 | @rail_line: #dddddd; 49 | @rail_dashline: #fafafa; 50 | 51 | @osm_roads_z9_highway_casing: #ccc; 52 | @osm_roads_z9_highway_stroke: white; 53 | @osm_roads_z9_major_stroke: #d3d3d3; 54 | 55 | @osm_roads_z10_highway_casing: #ccc; 56 | @osm_roads_z10_highway_stroke: white; 57 | @osm_roads_z10_major_stroke: #ccc; 58 | @osm_roads_z10_minor_stroke: #ddd; 59 | 60 | @osm_roads_z11_highway_casing: #ccc; 61 | @osm_roads_z11_highway_stroke: white; 62 | @osm_roads_z11_major_stroke: #d4d4d4; 63 | @osm_roads_z11_minor_stroke: #ddd; 64 | 65 | @osm_roads_z12_highway_casing: #c4c4c4; 66 | @osm_roads_z12_highway_stroke: white; 67 | @osm_roads_z12_major_casing: #d9d9d9; 68 | @osm_roads_z12_major_stroke: #fefefe; 69 | @osm_roads_z12_minor_stroke: #ddd; 70 | 71 | @osm_roads_z13_highway_casing: #c0c0c0; 72 | @osm_roads_z13_highway_stroke: white; 73 | @osm_roads_z13_major_casing: #ccc; 74 | @osm_roads_z13_major_stroke: #fcfcfc; 75 | @osm_roads_z13_minor_stroke: #ddd; 76 | 77 | @osm_roads_z14plus_highway_casing: #bbb; 78 | @osm_roads_z14plus_highway_stroke: white; 79 | @osm_roads_z14plus_major_casing: #c4c4c3; 80 | @osm_roads_z14plus_major_stroke: white; 81 | @osm_roads_z14plus_minor_casing: #ddd; 82 | @osm_roads_z14plus_minor_stroke: #f9f9f9; 83 | 84 | @osm_roads_path_stroke: #eee; 85 | @osm_tunnel_stroke: #eee; 86 | 87 | // labels 88 | @label_foreground_fill: #8494a1; 89 | @label_foreground_halo_fill: rgba(236,236,234,0.7); 90 | @label_foreground_halo_radius: 1.4px; 91 | 92 | @label_background_fill: #b6b6b6; 93 | @label_background_halo_fill: rgba(255,255,255,0.7); 94 | 95 | @labels_lowzoom_shield_fill: lighten(@label_foreground_fill, 7%); 96 | @labels_lowzoom_shield_halo_fill: lighten(@label_foreground_halo_fill,10%); 97 | @labels_lowzoom_shield_halo_radius: 1.3px; 98 | 99 | @labels_highzoom_text_fill: lighten(@label_foreground_fill,15%); 100 | @labels_highzoom_halo_fill: lighten(@label_foreground_halo_fill,10%); 101 | @labels_highzoom_halo_radius: 1.4px; 102 | 103 | @labels_highzoom_class1_text_fill: lighten(@label_foreground_fill,5%); 104 | @labels_highzoom_class2_text_fill: darken(@label_foreground_fill,5%); 105 | @labels_highzoom_class1_text_size: 12; 106 | @labels_highzoom_class1_text_size_default: 10; 107 | 108 | @labels_marine_fill: white; 109 | @labels_marine_halo_fill: lighten(@label_foreground_fill,10%); 110 | @labels_marine_halo_radius: 1.4px; 111 | 112 | @osm_roads_labels_fill: #bbb; 113 | @osm_roads_labels_halo: white; 114 | @osm_roads_labels_radius: 1.8px; 115 | 116 | @countries_class1_text_fill: lighten(@label_foreground_fill,5%); 117 | @countries_highzoom_class1_text_fill: darken(@label_background_fill,5%); 118 | 119 | @countries_class2_label_size: 10px; 120 | @countries_class2_text_fill: lighten(@label_foreground_fill,10%); 121 | @countries_class2_text_halo_radius: 1.8; 122 | 123 | @admin1_labels_size: 14; 124 | @admin1_labels: darken(#8494a1, 15%); 125 | @admin1_labels_halo: rgba(255,255,255,0.9); 126 | @admin1_labels_halo_radius: 1.6px; 127 | 128 | @admin1_lowzoom_labels_size: @admin1_labels_size; 129 | @admin1_lowzoom_labels: @admin1_labels; 130 | @admin1_lowzoom_labels_halo_radius: @admin1_labels_halo_radius; 131 | 132 | @label_park_fill: darken(#d4ded6, 30%); 133 | @label_park_halo_fill: lighten(#e3e3dc, 8%); 134 | @label_park_halo_radius: 1.4px; 135 | 136 | @label_water_fill: lighten(#6b8a95, 5%); 137 | @label_water_halo_fill: lighten(#e3e3dc, 8%); 138 | @label_water_halo_radius: 1.4px; 139 | 140 | @continent_labels: @label_foreground_fill; 141 | 142 | // assets 143 | @city_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_light.svg"); 144 | @city_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_light.svg"); 145 | @capital_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_light.png"); 146 | @capital_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_light.png"); 147 | 148 | @park_texture_opacity: 0.0; 149 | -------------------------------------------------------------------------------- /styles/global_variables_dark.mss: -------------------------------------------------------------------------------- 1 | // Default colors for the dark style ("dark matter") 2 | 3 | 4 | // this should be incremented when the data (queries, functions, features) changes: 5 | @cachebuster: #000096; 6 | 7 | @polygoncolor: #ffd479; 8 | @water: darken(#333336,6%); 9 | 10 | Map { 11 | background-color: @water; 12 | buffer-size: 256; 13 | } 14 | 15 | @landmass_fill: #0e0e0e; 16 | @landmass_line: #222; 17 | 18 | @greenareas: darken(#222, 8%); 19 | @greenareas_fill_low: @greenareas; 20 | @greenareas_fill_medium: @greenareas; 21 | @greenareas_fill_high: @greenareas; 22 | 23 | @buildings: darken(@landmass_fill, 2%); 24 | @buildings_outline_16: #141414; 25 | @buildings_outline: #242424; 26 | 27 | @aeroways: #111; 28 | 29 | @ne10roads_line_color: rgba(0,0,0,0.8); 30 | @ne10roads_line_outline: rgba(150,150,150,0.5); 31 | @ne10roads_7_minor_color: #262626; 32 | 33 | @ne_rivers_stroke: #1f1f1f; 34 | @ne_rivers_casing: rgba(0,0,0,0.1); 35 | 36 | @urbanareas: lighten(@landmass_fill,1%); 37 | @urbanareas_highzoom: lighten(@landmass_fill,1%); 38 | 39 | @admin0_4: #555; 40 | @admin0_5: #444; 41 | @admin0_6: #151515; 42 | @admin0_7: #444; 43 | 44 | @admin1_lowzoom: #333; 45 | @admin1_highzoom: #444; 46 | 47 | //osm roads 48 | @rail_line: #2f2f2f; 49 | @rail_dashline: #111; 50 | 51 | @highwaycasing: rgba(70,70,70,0.9); 52 | @highwaystroke: black; 53 | 54 | @osm_roads_z9_highway_casing: rgba(50,50,50,0.8); 55 | @osm_roads_z9_highway_stroke: @highwaystroke; 56 | @osm_roads_z9_major_stroke: #2a2a2a; 57 | 58 | @osm_roads_z10_highway_casing: rgba(60,60,60,0.8); 59 | @osm_roads_z10_highway_stroke: @highwaystroke; 60 | @osm_roads_z10_major_stroke: #2a2a2a; 61 | @osm_roads_z10_minor_stroke: #252525; 62 | 63 | @osm_roads_z11_highway_casing: @highwaycasing; 64 | @osm_roads_z11_highway_stroke: @highwaystroke; 65 | @osm_roads_z11_major_stroke: #333; 66 | @osm_roads_z11_minor_stroke: #2a2a2a; 67 | 68 | @osm_roads_z12_highway_casing: lighten(@highwaycasing,5%); 69 | @osm_roads_z12_highway_stroke: @highwaystroke; 70 | @osm_roads_z12_major_casing: darken(@highwaycasing,2%); 71 | @osm_roads_z12_major_stroke: lighten(@highwaystroke,2%); 72 | @osm_roads_z12_minor_stroke: #2a2a2a; 73 | 74 | @osm_roads_z13_highway_casing: lighten(@highwaycasing,5%); 75 | @osm_roads_z13_highway_stroke: @highwaystroke; 76 | @osm_roads_z13_major_casing: darken(@highwaycasing,7%); 77 | @osm_roads_z13_major_stroke: lighten(@highwaystroke,2%); 78 | @osm_roads_z13_minor_stroke: #2a2a2a; 79 | 80 | @osm_roads_z14plus_highway_casing: lighten(@highwaycasing,2%); 81 | @osm_roads_z14plus_highway_stroke: lighten(@highwaystroke,5%); 82 | @osm_roads_z14plus_major_casing: darken(@highwaycasing,2%); 83 | @osm_roads_z14plus_major_stroke: lighten(@highwaystroke,2%); 84 | 85 | @osm_roads_z14plus_minor_casing: darken(@highwaycasing,15%); 86 | @osm_roads_z14plus_minor_stroke: lighten(@highwaystroke,2%); 87 | 88 | @osm_roads_path_stroke: #181818; 89 | @osm_tunnel_stroke: #111; 90 | 91 | // labels 92 | @label_foreground_fill: #777; 93 | @label_foreground_halo_fill: rgba(0,0,0,0.7); 94 | @label_foreground_halo_radius: 1.2px; 95 | 96 | @label_background_fill: #444; 97 | @label_background_halo_fill: rgba(0,0,0,0.3); 98 | 99 | @labels_lowzoom_shield_fill: darken(@label_foreground_fill, 15%); 100 | @labels_lowzoom_shield_halo_fill: black; 101 | @labels_lowzoom_shield_halo_radius: 1.3px; 102 | 103 | @labels_highzoom_text_fill: #444; 104 | @labels_highzoom_halo_fill: darken(@label_foreground_halo_fill,10%); 105 | @labels_highzoom_halo_radius: 1.7px; 106 | 107 | 108 | @labels_highzoom_class1_text_fill: lighten(@labels_highzoom_text_fill,5%); 109 | @labels_highzoom_class2_text_fill: lighten(@labels_highzoom_text_fill,15%); 110 | @labels_highzoom_class1_text_size: 12; 111 | @labels_highzoom_class1_text_size_default: 9; 112 | 113 | @labels_marine_fill: darken(@label_foreground_fill,20%); 114 | @labels_marine_halo_fill: darken(@label_foreground_halo_fill,10%); 115 | @labels_marine_halo_radius: 1.2px; 116 | 117 | @osm_roads_labels_fill: #444; 118 | @osm_roads_labels_halo: black; 119 | @osm_roads_labels_radius: 1.7px; 120 | 121 | @countries_class1_text_fill: lighten(@label_foreground_fill,5%); 122 | @countries_highzoom_class1_text_fill: darken(@label_background_fill,5%); 123 | 124 | @countries_class2_label_size: 10px; 125 | @countries_class2_text_fill: @countries_class1_text_fill; 126 | @countries_class2_text_halo_radius: 1.8; 127 | 128 | @admin1_labels_size: 14; 129 | @admin1_labels: #333; 130 | @admin1_labels_halo: #111; 131 | @admin1_labels_halo_radius: 1px; 132 | 133 | @admin1_lowzoom_labels_size: @admin1_labels_size; 134 | @admin1_lowzoom_labels: @admin1_labels; 135 | @admin1_lowzoom_labels_halo_radius: @admin1_labels_halo_radius; 136 | 137 | @label_park_fill: darken(@label_foreground_fill,15%); 138 | @label_park_halo_fill: darken(@label_foreground_halo_fill,10%); 139 | @label_park_halo_radius: 1.2px; 140 | 141 | @label_water_fill: darken(@label_foreground_fill,20%); 142 | @label_water_halo_fill: darken(@label_foreground_halo_fill,5%); 143 | @label_water_halo_radius: 1.2px; 144 | 145 | @continent_labels: @label_foreground_fill; 146 | 147 | // assets 148 | @city_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_dark_444.png"); 149 | @city_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_dark_666.png"); 150 | @capital_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_dark_444.png"); 151 | @capital_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_dark_666.png"); 152 | 153 | @park_texture_opacity: 0.12; 154 | -------------------------------------------------------------------------------- /styles/global_variables_dark_lowercase.mss: -------------------------------------------------------------------------------- 1 | // Default colors for the dark style ("dark matter") 2 | 3 | 4 | // this should be incremented when the data (queries, functions, features) changes: 5 | @cachebuster: #000096; 6 | 7 | @polygoncolor: #ffd479; 8 | @water: darken(#333336,0%); 9 | 10 | Map { 11 | background-color: @water; 12 | buffer-size: 256; 13 | } 14 | 15 | @landmass_fill: #0e0e0e; 16 | @landmass_line: #222; 17 | 18 | @greenareas: darken(#222, 8%); 19 | @greenareas_fill_low: @greenareas; 20 | @greenareas_fill_medium: @greenareas; 21 | @greenareas_fill_high: @greenareas; 22 | 23 | @buildings: darken(@landmass_fill, 2%); 24 | @buildings_outline_16: #141414; 25 | @buildings_outline: #242424; 26 | 27 | @aeroways: #111; 28 | 29 | @ne10roads_line_color: rgba(0,0,0,0.8); 30 | @ne10roads_line_outline: rgba(150,150,150,0.5); 31 | @ne10roads_7_minor_color: #262626; 32 | 33 | @ne_rivers_stroke: #1f1f1f; 34 | @ne_rivers_casing: rgba(0,0,0,0.1); 35 | 36 | @urbanareas: lighten(@landmass_fill,1%); 37 | @urbanareas_highzoom: lighten(@landmass_fill,1%); 38 | 39 | @admin0_4: #555; 40 | @admin0_5: #444; 41 | @admin0_6: #151515; 42 | @admin0_7: #444; 43 | 44 | @admin1_lowzoom: #333; 45 | @admin1_highzoom: #444; 46 | 47 | //osm roads 48 | @rail_line: #2f2f2f; 49 | @rail_dashline: #111; 50 | 51 | @highwaycasing: rgba(70,70,70,0.9); 52 | @highwaystroke: black; 53 | 54 | @osm_roads_z9_highway_casing: rgba(50,50,50,0.8); 55 | @osm_roads_z9_highway_stroke: @highwaystroke; 56 | @osm_roads_z9_major_stroke: #2a2a2a; 57 | 58 | @osm_roads_z10_highway_casing: rgba(60,60,60,0.8); 59 | @osm_roads_z10_highway_stroke: @highwaystroke; 60 | @osm_roads_z10_major_stroke: #2a2a2a; 61 | @osm_roads_z10_minor_stroke: #252525; 62 | 63 | @osm_roads_z11_highway_casing: @highwaycasing; 64 | @osm_roads_z11_highway_stroke: @highwaystroke; 65 | @osm_roads_z11_major_stroke: #333; 66 | @osm_roads_z11_minor_stroke: #2a2a2a; 67 | 68 | @osm_roads_z12_highway_casing: lighten(@highwaycasing,5%); 69 | @osm_roads_z12_highway_stroke: @highwaystroke; 70 | @osm_roads_z12_major_casing: darken(@highwaycasing,2%); 71 | @osm_roads_z12_major_stroke: lighten(@highwaystroke,2%); 72 | @osm_roads_z12_minor_stroke: #2a2a2a; 73 | 74 | @osm_roads_z13_highway_casing: lighten(@highwaycasing,5%); 75 | @osm_roads_z13_highway_stroke: @highwaystroke; 76 | @osm_roads_z13_major_casing: darken(@highwaycasing,7%); 77 | @osm_roads_z13_major_stroke: lighten(@highwaystroke,2%); 78 | @osm_roads_z13_minor_stroke: #2a2a2a; 79 | 80 | @osm_roads_z14plus_highway_casing: lighten(@highwaycasing,2%); 81 | @osm_roads_z14plus_highway_stroke: lighten(@highwaystroke,5%); 82 | @osm_roads_z14plus_major_casing: darken(@highwaycasing,2%); 83 | @osm_roads_z14plus_major_stroke: lighten(@highwaystroke,2%); 84 | 85 | @osm_roads_z14plus_minor_casing: darken(@highwaycasing,15%); 86 | @osm_roads_z14plus_minor_stroke: lighten(@highwaystroke,2%); 87 | 88 | @osm_roads_path_stroke: #181818; 89 | @osm_tunnel_stroke: #111; 90 | 91 | // labels 92 | @label_foreground_fill: #ddd; 93 | @label_foreground_halo_fill: #333; 94 | @label_foreground_halo_radius: 1px; 95 | 96 | @label_background_fill: #666; 97 | @label_background_halo_fill: #333; 98 | 99 | @labels_lowzoom_shield_fill: #999; 100 | @labels_lowzoom_shield_halo_fill: #444; 101 | @labels_lowzoom_shield_halo_radius: 1; 102 | 103 | @labels_highzoom_text_fill: #ccc; 104 | @labels_highzoom_halo_fill: #444; 105 | @labels_highzoom_halo_radius: 1px; 106 | 107 | @labels_highzoom_class1_small_text_fill: #adadad; 108 | @labels_highzoom_class1_text_fill: lighten(@labels_highzoom_text_fill,5%); 109 | @labels_highzoom_class2_text_fill: lighten(@labels_highzoom_text_fill,15%); 110 | @labels_highzoom_class1_text_size: 12; 111 | @labels_highzoom_class1_text_size_default: 9; 112 | 113 | @labels_marine_fill: lighten(#333336,20%); 114 | @labels_marine_halo_fill: #333336; 115 | @labels_marine_halo_radius: 1px; 116 | 117 | @osm_roads_labels_fill: lighten(#666,10); 118 | @osm_roads_labels_halo: #222; 119 | @osm_roads_labels_radius: 1px; 120 | 121 | @countries_class1_text_fill: #888; 122 | @countries_highzoom_class1_text_fill: darken(@label_background_fill,5%); 123 | 124 | @countries_class2_label_size: 10px; 125 | @countries_class2_text_fill: @countries_class1_text_fill; 126 | @countries_class2_text_halo_radius: 1; 127 | 128 | //state labels and similar start at z5 129 | @admin1_labels_size: 14; 130 | @admin1_labels: #888; 131 | @admin1_labels_halo: #333; 132 | @admin1_labels_halo_radius: 1px; 133 | 134 | @admin1_lowzoom_labels_size: @admin1_labels_size; 135 | @admin1_lowzoom_labels: @admin1_labels; 136 | @admin1_lowzoom_labels_halo_radius: @admin1_labels_halo_radius; 137 | 138 | @admin_boundary_labels: lighten(@admin1_highzoom,10); 139 | @admin_boundary_halo: lighten(@landmass_fill,5); 140 | 141 | @label_park_fill: darken(@label_foreground_fill,15%); 142 | @label_park_halo_fill: darken(@label_foreground_halo_fill,10%); 143 | @label_park_halo_radius: 1px; 144 | 145 | @label_water_fill: lighten(#333336,30%); 146 | @label_water_halo_fill: #333336; 147 | @label_water_halo_radius: 1px; 148 | 149 | /* 150 | @label_water_fill: darken(@label_foreground_fill,20%); 151 | @label_water_halo_fill: darken(@label_foreground_halo_fill,10%); 152 | @label_water_halo_radius: 1px; 153 | */ 154 | 155 | @continent_labels: @label_foreground_fill; 156 | 157 | // assets 158 | @city_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_dark_444.png"); 159 | @city_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_dark_666.png"); 160 | @capital_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_dark_444.png"); 161 | @capital_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_dark_666.png"); 162 | 163 | @park_texture_opacity: 0.12; 164 | -------------------------------------------------------------------------------- /styles/global_variables_dark_only_labels.mss: -------------------------------------------------------------------------------- 1 | // Alternate colors for dark style ("dark matter") variants 2 | 3 | // We use this instead of global_variables.mss whenever we show a subset of features on a transparent background. 4 | // For example, labels, lines, buildings that need to have modified contrast when overlayed on top of data. 5 | 6 | 7 | // this should be incremented when the data (queries, functions, features) changes: 8 | @cachebuster: #000096; 9 | 10 | @polygoncolor: #ffd479; 11 | @water: darken(#333336,6%); 12 | 13 | Map { 14 | buffer-size: 256; 15 | } 16 | 17 | @landmass_fill: #0e0e0e; 18 | @landmass_line: #222; 19 | 20 | @greenareas: darken(#222, 8%); 21 | @greenareas_fill_low: @greenareas; 22 | @greenareas_fill_medium: @greenareas; 23 | @greenareas_fill_high: @greenareas; 24 | 25 | @buildings: darken(@landmass_fill, 2%); 26 | @buildings_outline_16: #141414; 27 | @buildings_outline: #242424; 28 | 29 | @aeroways: #111; 30 | 31 | @ne10roads_line_color: rgba(0,0,0,0.8); 32 | @ne10roads_line_outline: rgba(150,150,150,0.5); 33 | @ne10roads_7_minor_color: #262626; 34 | 35 | @ne_rivers_stroke: #1f1f1f; 36 | @ne_rivers_casing: rgba(0,0,0,0.1); 37 | 38 | @urbanareas: lighten(@landmass_fill,1%); 39 | @urbanareas_highzoom: lighten(@landmass_fill,1%); 40 | 41 | @admin0_4: #555; 42 | @admin0_5: #444; 43 | @admin0_6: #151515; 44 | @admin0_7: #444; 45 | 46 | @admin1_lowzoom: #333; 47 | @admin1_highzoom: #444; 48 | 49 | //osm roads 50 | @rail_line: #2f2f2f; 51 | @rail_dashline: #111; 52 | 53 | @highwaycasing: rgba(70,70,70,0.9); 54 | @highwaystroke: black; 55 | 56 | @osm_roads_z9_highway_casing: rgba(50,50,50,0.8); 57 | @osm_roads_z9_highway_stroke: @highwaystroke; 58 | @osm_roads_z9_major_stroke: #2a2a2a; 59 | 60 | @osm_roads_z10_highway_casing: rgba(60,60,60,0.8); 61 | @osm_roads_z10_highway_stroke: @highwaystroke; 62 | @osm_roads_z10_major_stroke: #2a2a2a; 63 | @osm_roads_z10_minor_stroke: #252525; 64 | 65 | @osm_roads_z11_highway_casing: @highwaycasing; 66 | @osm_roads_z11_highway_stroke: @highwaystroke; 67 | @osm_roads_z11_major_stroke: #333; 68 | @osm_roads_z11_minor_stroke: #2a2a2a; 69 | 70 | @osm_roads_z12_highway_casing: lighten(@highwaycasing,5%); 71 | @osm_roads_z12_highway_stroke: @highwaystroke; 72 | @osm_roads_z12_major_casing: darken(@highwaycasing,2%); 73 | @osm_roads_z12_major_stroke: lighten(@highwaystroke,2%); 74 | @osm_roads_z12_minor_stroke: #2a2a2a; 75 | 76 | @osm_roads_z13_highway_casing: lighten(@highwaycasing,5%); 77 | @osm_roads_z13_highway_stroke: @highwaystroke; 78 | @osm_roads_z13_major_casing: darken(@highwaycasing,7%); 79 | @osm_roads_z13_major_stroke: lighten(@highwaystroke,2%); 80 | @osm_roads_z13_minor_stroke: #2a2a2a; 81 | 82 | @osm_roads_z14plus_highway_casing: lighten(@highwaycasing,2%); 83 | @osm_roads_z14plus_highway_stroke: lighten(@highwaystroke,5%); 84 | @osm_roads_z14plus_major_casing: darken(@highwaycasing,2%); 85 | @osm_roads_z14plus_major_stroke: lighten(@highwaystroke,2%); 86 | 87 | @osm_roads_z14plus_minor_casing: darken(@highwaycasing,15%); 88 | @osm_roads_z14plus_minor_stroke: lighten(@highwaystroke,2%); 89 | 90 | @osm_roads_path_stroke: #181818; 91 | @osm_tunnel_stroke: #111; 92 | 93 | // labels 94 | @label_foreground_fill: lighten(#555,30%); 95 | @label_foreground_halo_fill: rgba(0,0,0,0.8); 96 | @label_foreground_halo_radius: 1.3px; 97 | 98 | @label_background_fill: lighten(#444,15%); 99 | @label_background_halo_fill: rgba(0,0,0,0.8); 100 | 101 | @labels_lowzoom_shield_fill: lighten(#555, 30%); 102 | @labels_lowzoom_shield_halo_fill: rgba(0,0,0,0.9); 103 | @labels_lowzoom_shield_halo_radius: 1.3px; 104 | 105 | @labels_highzoom_text_fill: lighten(#555, 30%); 106 | @labels_highzoom_halo_fill: darken(@label_foreground_halo_fill,10%); 107 | @labels_highzoom_halo_radius: 1.3px; 108 | 109 | @labels_highzoom_class1_text_fill: lighten(@labels_highzoom_text_fill,15%); 110 | @labels_highzoom_class2_text_fill: lighten(@labels_highzoom_text_fill,25%); 111 | @labels_highzoom_class1_text_size: 12; 112 | @labels_highzoom_class1_text_size_default: 9; 113 | 114 | @labels_marine_fill: darken(@label_foreground_fill,15%); 115 | @labels_marine_halo_fill: darken(@label_foreground_halo_fill,10%); 116 | @labels_marine_halo_radius: 1.2px; 117 | 118 | @osm_roads_labels_fill: lighten(#555, 25%); 119 | @osm_roads_labels_halo: rgba(0,0,0,0.8); 120 | @osm_roads_labels_radius: 1.8px; 121 | 122 | @countries_class1_text_fill: lighten(@label_foreground_fill,25%); 123 | @countries_highzoom_class1_text_fill: lighten(@label_foreground_fill,10%); 124 | 125 | @countries_class2_label_size: 0; 126 | @countries_class2_text_fill: transparent; 127 | @countries_class2_text_halo_radius: 0; 128 | 129 | @admin1_labels_size: 14; 130 | @admin1_labels: @label_foreground_fill; 131 | @admin1_labels_halo: rgba(0,0,0,0.9); 132 | @admin1_labels_halo_radius: 1.3px; 133 | 134 | @admin1_lowzoom_labels_size: 0; 135 | @admin1_lowzoom_labels: transparent; 136 | @admin1_lowzoom_labels_halo_radius: 0; 137 | 138 | @label_park_fill: lighten(#555, 20%); 139 | @label_park_halo_fill: @label_foreground_halo_fill; 140 | @label_park_halo_radius: 1.2px; 141 | 142 | @label_water_fill: lighten(#555, 20%); 143 | @label_water_halo_fill: darken(@label_foreground_halo_fill,5%); 144 | @label_water_halo_radius: 1.2px; 145 | 146 | @continent_labels: lighten(@label_foreground_fill,25%); 147 | 148 | // assets 149 | @city_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_dark_666.png"); 150 | @city_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_dark_666.png"); 151 | @capital_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_dark_666.png"); 152 | @capital_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_dark_666.png"); 153 | 154 | @park_texture_opacity: 0.12; 155 | -------------------------------------------------------------------------------- /styles/global_variables_lowercase.mss: -------------------------------------------------------------------------------- 1 | // Default colors for the light style ("positron") 2 | 3 | 4 | // this should be incremented when the data (queries, functions, features) changes: 5 | @cachebuster: #0000c7; 6 | 7 | @polygoncolor: #ffd479; 8 | @water: #cdd2d4; 9 | 10 | Map { 11 | background-color: @water; 12 | buffer-size: 256; 13 | } 14 | 15 | @landmass_fill: lighten(#e3e3dc, 8%); 16 | @landmass_line: lighten(#e3e3dc, 3%); 17 | 18 | @greenareas_fill_low: lighten(#d4dad6,8%); 19 | @greenareas_fill_medium: lighten(#d4dad6,5%); 20 | @greenareas_fill_high: lighten(#d4dad6,6%); 21 | 22 | @buildings: lighten(#e3e3dc, 5%); 23 | @buildings_outline_16: #ddd; 24 | @buildings_outline: #ddd; 25 | 26 | @aeroways: #e8e8e8; 27 | 28 | @ne10roads_line_color: white; 29 | @ne10roads_line_outline: darken(#b4b2a3, 2%); 30 | @ne10roads_7_minor_color: darken(@ne10roads_line_color,12%); 31 | 32 | @ne_rivers_stroke: lighten(#346fa1,30%); 33 | @ne_rivers_casing: darken(#f5f5f3,1%); 34 | 35 | @urbanareas: darken(#f5f5f3, 4%); 36 | @urbanareas_highzoom: darken(#f5f5f3, 3%); 37 | 38 | 39 | @admin0_4: lighten(#c79297, 20%); 40 | @admin0_5: lighten(#c99297,10%); 41 | @admin0_6: mix(lighten(#c99297, 20%), lighten(#e3e3dc, 8%), 20); 42 | @admin0_7: lighten(#c99297,20%); 43 | 44 | @admin1_lowzoom: lighten(#6d6e71, 40%); 45 | @admin1_highzoom: lighten(#c79297, 15%); 46 | 47 | //osm roads 48 | @rail_line: #dddddd; 49 | @rail_dashline: #fafafa; 50 | 51 | @osm_roads_z9_highway_casing: #ccc; 52 | @osm_roads_z9_highway_stroke: white; 53 | @osm_roads_z9_major_stroke: #d3d3d3; 54 | 55 | @osm_roads_z10_highway_casing: #ccc; 56 | @osm_roads_z10_highway_stroke: white; 57 | @osm_roads_z10_major_stroke: #ccc; 58 | @osm_roads_z10_minor_stroke: #ddd; 59 | 60 | @osm_roads_z11_highway_casing: #ccc; 61 | @osm_roads_z11_highway_stroke: white; 62 | @osm_roads_z11_major_stroke: #d4d4d4; 63 | @osm_roads_z11_minor_stroke: #ddd; 64 | 65 | @osm_roads_z12_highway_casing: #c4c4c4; 66 | @osm_roads_z12_highway_stroke: white; 67 | @osm_roads_z12_major_casing: #d9d9d9; 68 | @osm_roads_z12_major_stroke: #fefefe; 69 | @osm_roads_z12_minor_stroke: #ddd; 70 | 71 | @osm_roads_z13_highway_casing: #c0c0c0; 72 | @osm_roads_z13_highway_stroke: white; 73 | @osm_roads_z13_major_casing: #ccc; 74 | @osm_roads_z13_major_stroke: #fcfcfc; 75 | @osm_roads_z13_minor_stroke: #ddd; 76 | 77 | @osm_roads_z14plus_highway_casing: #bbb; 78 | @osm_roads_z14plus_highway_stroke: white; 79 | @osm_roads_z14plus_major_casing: #c4c4c3; 80 | @osm_roads_z14plus_major_stroke: white; 81 | @osm_roads_z14plus_minor_casing: #ddd; 82 | @osm_roads_z14plus_minor_stroke: #f9f9f9; 83 | 84 | @osm_roads_path_stroke: #eee; 85 | @osm_tunnel_stroke: #eee; 86 | 87 | // labels 88 | @label_foreground_fill: darken(#8494a1, 20%); 89 | @label_foreground_halo_fill: @landmass_fill; 90 | @label_foreground_halo_radius: 1px; 91 | 92 | @label_background_fill: darken(#8494a1,10);//#b6b6b6; 93 | @label_background_halo_fill: rgba(255,255,255,0.7); 94 | 95 | @labels_lowzoom_shield_fill: lighten(@label_foreground_fill, 5%); 96 | @labels_lowzoom_shield_halo_fill: lighten(@label_foreground_halo_fill,10%); 97 | @labels_lowzoom_shield_halo_radius: 1.2px; 98 | 99 | @labels_highzoom_text_fill: lighten(@label_foreground_fill,5%); 100 | @labels_highzoom_halo_fill: lighten(@label_foreground_halo_fill,0%); 101 | @labels_highzoom_halo_radius: 1.2px; 102 | 103 | @labels_highzoom_class1_small_text_fill: lighten(@label_foreground_fill,5%); 104 | @labels_highzoom_class1_text_fill: lighten(@label_foreground_fill,5%); 105 | @labels_highzoom_class2_text_fill: darken(@label_foreground_fill,5%); 106 | @labels_highzoom_class1_text_size: 12; 107 | @labels_highzoom_class1_text_size_default: 10; 108 | 109 | @labels_marine_fill: lighten(#6b8a95, 5%); 110 | @labels_marine_halo_fill: @water; 111 | @labels_marine_halo_radius: 1px; 112 | 113 | @osm_roads_labels_fill: #7a7a7a; 114 | @osm_roads_labels_halo: lighten(@landmass_fill,8); 115 | @osm_roads_labels_radius: 1px; 116 | 117 | @countries_class1_text_fill: lighten(@label_foreground_fill,5%); 118 | @countries_highzoom_class1_text_fill: darken(@label_background_fill,5%); 119 | 120 | @countries_class2_label_size: 10px; 121 | @countries_class2_text_fill: lighten(@label_foreground_fill,10%); 122 | @countries_class2_text_halo_radius: 1; 123 | 124 | @admin1_labels_size: 14; 125 | @admin1_labels: darken(#8494a1, 15%); 126 | @admin1_labels_halo: rgba(255,255,255,0.9); 127 | @admin1_labels_halo_radius: 1px; 128 | 129 | @admin1_lowzoom_labels_size: @admin1_labels_size; 130 | @admin1_lowzoom_labels: @admin1_labels; 131 | @admin1_lowzoom_labels_halo_radius: @admin1_labels_halo_radius; 132 | 133 | @admin_boundary_labels: @admin1_highzoom; 134 | @admin_boundary_halo: @landmass_fill; 135 | 136 | @label_park_fill: darken(#d4ded6, 30%); 137 | @label_park_halo_fill: lighten(#e3e3dc, 8%); 138 | @label_park_halo_radius: 1px; 139 | 140 | @label_water_fill: lighten(#6b8a95, 10%); 141 | @label_water_halo_fill: lighten(@water,5); 142 | @label_water_halo_radius: 1px; 143 | 144 | @continent_labels: @label_foreground_fill; 145 | 146 | // assets 147 | @city_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_light.svg"); 148 | @city_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_light.svg"); 149 | @capital_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_light.png"); 150 | @capital_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_light.png"); 151 | 152 | @park_texture_opacity: 0.0; 153 | -------------------------------------------------------------------------------- /styles/global_variables_only_labels.mss: -------------------------------------------------------------------------------- 1 | // Alternate colors for light style ("positron") variants 2 | // We use this instead of global_variables.mss whenever we show a subset of features on a transparent background. 3 | // For example, labels, lines, buildings that need to have modified contrast when overlayed on top of data. 4 | 5 | 6 | // this should be incremented when the data (queries, functions, features) changes: 7 | @cachebuster: #0000c7; 8 | 9 | @polygoncolor: #ffd479; 10 | @water: #cdd2d4; 11 | 12 | Map { 13 | buffer-size: 256; 14 | } 15 | 16 | @landmass_fill: lighten(#e3e3dc, 8%); 17 | @landmass_line: darken(#bfc7c8, 10%); 18 | 19 | @greenareas_fill_low: lighten(#d4dad6,8%); 20 | @greenareas_fill_medium: lighten(#d4dad6,5%); 21 | @greenareas_fill_high: lighten(#d4dad6,6%); 22 | 23 | @buildings: lighten(#e3e3dc, 5%); 24 | @buildings_outline_16: #ddd; 25 | @buildings_outline: #ddd; 26 | 27 | @aeroways: #e8e8e8; 28 | 29 | @ne10roads_line_color: white; 30 | @ne10roads_line_outline: darken(#b4b2a3, 2%); 31 | @ne10roads_7_minor_color: darken(@ne10roads_line_color,12%); 32 | 33 | @ne_rivers_stroke: lighten(#346fa1,30%); 34 | @ne_rivers_casing: darken(#f5f5f3,1%); 35 | 36 | @urbanareas: darken(#f5f5f3, 4%); 37 | @urbanareas_highzoom: darken(#f5f5f3, 3%); 38 | 39 | @admin0_4: lighten(#c79297, 20%); 40 | @admin0_5: lighten(#c99297,10%); 41 | @admin0_6: mix(lighten(#c99297, 20%), lighten(#e3e3dc, 8%), 20); 42 | @admin0_7: lighten(#c99297,20%); 43 | 44 | @admin1_lowzoom: lighten(#6d6e71, 40%); 45 | @admin1_highzoom: lighten(#c79297, 15%); 46 | 47 | //osm roads 48 | @rail_line: #dddddd; 49 | @rail_dashline: #fafafa; 50 | 51 | @osm_roads_z9_highway_casing: #ccc; 52 | @osm_roads_z9_highway_stroke: white; 53 | @osm_roads_z9_major_stroke: #d3d3d3; 54 | 55 | @osm_roads_z10_highway_casing: #ccc; 56 | @osm_roads_z10_highway_stroke: white; 57 | @osm_roads_z10_major_stroke: #ccc; 58 | @osm_roads_z10_minor_stroke: #ddd; 59 | 60 | @osm_roads_z11_highway_casing: #ccc; 61 | @osm_roads_z11_highway_stroke: white; 62 | @osm_roads_z11_major_stroke: #d4d4d4; 63 | @osm_roads_z11_minor_stroke: #ddd; 64 | 65 | @osm_roads_z12_highway_casing: #c4c4c4; 66 | @osm_roads_z12_highway_stroke: white; 67 | @osm_roads_z12_major_casing: #d9d9d9; 68 | @osm_roads_z12_major_stroke: #fefefe; 69 | @osm_roads_z12_minor_stroke: #ddd; 70 | 71 | @osm_roads_z13_highway_casing: #c0c0c0; 72 | @osm_roads_z13_highway_stroke: white; 73 | @osm_roads_z13_major_casing: #ccc; 74 | @osm_roads_z13_major_stroke: #fcfcfc; 75 | @osm_roads_z13_minor_stroke: #ddd; 76 | 77 | @osm_roads_z14plus_highway_casing: #bbb; 78 | @osm_roads_z14plus_highway_stroke: white; 79 | @osm_roads_z14plus_major_casing: #c4c4c3; 80 | @osm_roads_z14plus_major_stroke: white; 81 | @osm_roads_z14plus_minor_casing: #ddd; 82 | @osm_roads_z14plus_minor_stroke: #f9f9f9; 83 | 84 | @osm_roads_path_stroke: #eee; 85 | @osm_tunnel_stroke: #eee; 86 | 87 | // labels 88 | @label_foreground_fill: darken(#8494a1, 25%); 89 | @label_foreground_halo_fill: rgba(255,255,255,0.9); 90 | @label_foreground_halo_radius: 1.2px; 91 | 92 | @label_background_fill: darken(#8494a1, 25%); 93 | @label_background_halo_fill: rgba(255,255,255,0.9); 94 | 95 | @labels_lowzoom_shield_fill: darken(#8494a1, 25%); 96 | @labels_lowzoom_shield_halo_fill: rgba(255,255,255,0.9); 97 | @labels_lowzoom_shield_halo_radius: 1.3px; 98 | 99 | @labels_highzoom_text_fill: @label_foreground_fill; 100 | @labels_highzoom_halo_fill: @label_foreground_halo_fill; 101 | @labels_highzoom_halo_radius: 1.7px; 102 | 103 | @labels_highzoom_class1_text_fill: lighten(@label_foreground_fill,5%); 104 | @labels_highzoom_class2_text_fill: darken(@label_foreground_fill,5%); 105 | @labels_highzoom_class1_text_size: 12; 106 | @labels_highzoom_class1_text_size_default: 9; 107 | 108 | @labels_marine_fill: white; 109 | @labels_marine_halo_fill: lighten(@label_foreground_fill,30%); 110 | @labels_marine_halo_radius: 1.2px; 111 | 112 | @osm_roads_labels_fill: darken(#8494a1, 13%); 113 | @osm_roads_labels_halo: rgba(255,255,255,0.8); 114 | @osm_roads_labels_radius: 1.7px; 115 | 116 | @countries_class1_text_fill: @label_foreground_fill; 117 | @countries_highzoom_class1_text_fill: @label_foreground_fill; 118 | 119 | @countries_class2_label_size: 0; 120 | @countries_class2_text_fill: transparent; 121 | @countries_class2_text_halo_radius: 0; 122 | 123 | @admin1_labels_size: 14; 124 | @admin1_labels: darken(#8494a1, 15%); 125 | @admin1_labels_halo: rgba(255,255,255,0.9); 126 | @admin1_labels_halo_radius: 1.6px; 127 | 128 | @admin1_lowzoom_labels_size: 0; 129 | @admin1_lowzoom_labels: transparent; 130 | @admin1_lowzoom_labels_halo_radius: 0; 131 | 132 | @label_park_fill: darken(#d4ded6, 25%); 133 | @label_park_halo_fill: rgba(255,255,255,0.9); 134 | @label_park_halo_radius: 1.2px; 135 | 136 | @label_water_fill: darken(#6b8a95, 13%); 137 | @label_water_halo_fill: rgba(255,255,255, 0.9); 138 | @label_water_halo_radius: 1.2px; 139 | 140 | @continent_labels: darken(@label_foreground_fill,5%); 141 | 142 | // assets 143 | @city_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_light.svg"); 144 | @city_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/city_shield_light.svg"); 145 | @capital_shield_file: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_light.png"); 146 | @capital_shield_file_lowzoom: url("http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/capital_shield_light.png"); 147 | 148 | @park_texture_opacity: 0.0; 149 | -------------------------------------------------------------------------------- /styles/green_areas.mss: -------------------------------------------------------------------------------- 1 | // Zooms 9-18 2 | 3 | #greenareas { 4 | [zoom>=9][zoom<=10] { 5 | polygon-fill: @greenareas_fill_low; 6 | [zoom=9][area<500000000], 7 | [zoom=10][area<250000000] { 8 | polygon-fill: fadeout(@greenareas_fill_low,50%); 9 | } 10 | 11 | polygon-pattern-alignment: global; 12 | polygon-pattern-opacity: @park_texture_opacity; 13 | polygon-pattern-file: url(http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/park-halftone-1.png); 14 | } 15 | 16 | [zoom>=11] { 17 | polygon-fill: @greenareas_fill_medium; 18 | [zoom=11][area<100000000], 19 | [zoom=12][area<25000000], 20 | [zoom=13][area<2500000], 21 | [zoom=14][area<250000] { 22 | polygon-fill: fadeout(@greenareas_fill_medium,50%); 23 | } 24 | 25 | polygon-pattern-alignment: global; 26 | polygon-pattern-opacity: @park_texture_opacity; 27 | polygon-pattern-file: url(http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/park-halftone-1.png); 28 | } 29 | 30 | [zoom>=15]{ 31 | line-color: @greenareas_fill_high; 32 | line-width: 1; 33 | 34 | polygon-pattern-alignment: global; 35 | polygon-pattern-opacity: @park_texture_opacity; 36 | polygon-pattern-file: url(http://s3.amazonaws.com/libs.cartocdn.com/stamen-base/park-halftone-1.png); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /styles/images/bgnoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/bgnoise.png -------------------------------------------------------------------------------- /styles/images/capital_shield_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/capital_shield_dark.png -------------------------------------------------------------------------------- /styles/images/capital_shield_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /styles/images/capital_shield_dark_444.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/capital_shield_dark_444.png -------------------------------------------------------------------------------- /styles/images/capital_shield_dark_444.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /styles/images/capital_shield_dark_666.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/capital_shield_dark_666.png -------------------------------------------------------------------------------- /styles/images/capital_shield_dark_666.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /styles/images/capital_shield_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/capital_shield_light.png -------------------------------------------------------------------------------- /styles/images/circles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/circles.png -------------------------------------------------------------------------------- /styles/images/city_shield_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /styles/images/city_shield_dark_444.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/city_shield_dark_444.png -------------------------------------------------------------------------------- /styles/images/city_shield_dark_444.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /styles/images/city_shield_dark_666.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/city_shield_dark_666.png -------------------------------------------------------------------------------- /styles/images/city_shield_dark_666.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /styles/images/city_shield_light.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /styles/images/park-halftone-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/park-halftone-1.png -------------------------------------------------------------------------------- /styles/images/star.idraw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/star.idraw -------------------------------------------------------------------------------- /styles/images/star8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CartoDB/CartoDB-basemaps/3670f12efa0f0cc695842bdb67b14d74c4e6f8d7/styles/images/star8.png -------------------------------------------------------------------------------- /styles/land_negative.mss: -------------------------------------------------------------------------------- 1 | // Zooms 3-18 2 | 3 | #land_negative { 4 | ::outline { 5 | line-color: @landmass_line; 6 | line-width: 0; 7 | } 8 | 9 | // Natural Earth 10 | [zoom >= 3][zoom < 8] { 11 | ::outline { 12 | line-width: 0; 13 | line-color: @ne_rivers_casing; 14 | } 15 | 16 | [is_lake=0] { 17 | [zoom=4][ne_scalerank<3], 18 | [zoom=5][ne_scalerank<4], 19 | [zoom>5][ne_scalerank<5] { 20 | ::outline { 21 | line-width: 3; 22 | } 23 | 24 | line-color: @ne_rivers_stroke; 25 | line-width: 0.5; 26 | } 27 | } 28 | 29 | [is_lake=1] { 30 | polygon-fill: @water; 31 | 32 | ::outline { 33 | line-color: @landmass_line; 34 | line-width: 1; 35 | } 36 | } 37 | } 38 | 39 | // OSM 40 | [zoom >= 8] { 41 | [is_lake=0] { 42 | line-color: @water; 43 | line-width: 0.5; 44 | 45 | // to avoid excessive detail near Perpignan, France (10/42.6380/2.6944) 46 | [zoom<13][type='riverbank'] { 47 | line-width: 0; 48 | } 49 | } 50 | 51 | [is_lake=1] { 52 | polygon-fill: @water; 53 | 54 | ::outline[zoom=8][area>500000000] { line-width: 1; } 55 | ::outline[zoom=9][area>100000000] { line-width: 1.5; } 56 | ::outline[zoom=10][area>100000000] { line-width: 2; } 57 | ::outline[zoom=11][area>10000000] { line-width: 2.5; } 58 | ::outline[zoom=12][area>1000000] { line-width: 2.25; } 59 | ::outline[zoom=13][area>1000000] { line-width: 2.5; } 60 | ::outline[zoom=14][area>1000000] { line-width: 2.75; } 61 | ::outline[zoom=15][area>1000000] { line-width: 3; } 62 | ::outline[zoom=16][area>1000000] { line-width: 3.25; } 63 | ::outline[zoom=17][area>1000000] { line-width: 3.5; } 64 | ::outline[zoom=18][area>1000000] { line-width: 4; } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /styles/land_positive.mss: -------------------------------------------------------------------------------- 1 | // Zooms 0-8 2 | 3 | #land_positive { 4 | ::outline{ 5 | line-color: @landmass_line; 6 | line-width: 1; 7 | } 8 | polygon-fill: @landmass_fill; 9 | 10 | ::outline[zoom=5] { line-width: 1.5; } 11 | ::outline[zoom=6] { line-width: 2; } 12 | ::outline[zoom=7] { line-width: 2; } 13 | ::outline[zoom=8] { line-width: 2; line-miterlimit: 1; } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /styles/marine_labels.mss: -------------------------------------------------------------------------------- 1 | // zooms 2-8 2 | 3 | #marine_labels { 4 | [zoom=2][scalerank=0], 5 | [zoom>=3][zoom<=4][scalerank<2], 6 | [zoom>=5][zoom<=6][scalerank<4], 7 | [zoom=7][scalerank<8], 8 | [zoom=8] 9 | { 10 | 11 | [featurecla='ocean'] { 12 | text-transform: capitalize; 13 | } 14 | 15 | text-name: [name]; 16 | [namealt!=''] { 17 | text-name: [name] + '\n(' + [namealt] + ')'; 18 | } 19 | text-face-name: 'Azo Sans Italic'; 20 | text-wrap-width: 100; 21 | text-wrap-before: true; 22 | text-size: 12; 23 | 24 | text-line-spacing: -2; 25 | text-character-spacing: 1.1; 26 | 27 | text-placement: interior; 28 | text-fill: @labels_marine_fill; 29 | text-halo-radius: @labels_marine_halo_radius; 30 | text-halo-fill: @labels_marine_halo_fill; 31 | [zoom>=3][zoom<=8][featurecla='ocean'] { 32 | text-size: 14; 33 | 34 | [zoom>=4] { 35 | text-size: 18; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /styles/marine_labels_lowercase.mss: -------------------------------------------------------------------------------- 1 | // zooms 2-8 2 | 3 | #marine_labels { 4 | [zoom=2][scalerank=0], 5 | [zoom>=3][zoom<=4][scalerank<2], 6 | [zoom>=5][zoom<=6][scalerank<4], 7 | [zoom=7][scalerank<8], 8 | [zoom=8] 9 | { 10 | 11 | [featurecla='ocean'] { 12 | text-transform: capitalize; 13 | } 14 | 15 | text-name: [name]; 16 | [namealt!=''] { 17 | text-name: [name] + '\n(' + [namealt] + ')'; 18 | } 19 | text-face-name: 'Open Sans Italic'; 20 | text-wrap-width: 50; 21 | text-wrap-before: true; 22 | text-size: 10; 23 | 24 | text-line-spacing: -2; 25 | text-character-spacing: 1.1; 26 | 27 | text-placement: interior; 28 | text-fill: @labels_marine_fill; 29 | text-halo-radius: @labels_marine_halo_radius; 30 | text-halo-fill: @labels_marine_halo_fill; 31 | 32 | [zoom>=4]{text-size: 12;} 33 | 34 | [featurecla='ocean'][zoom>=2][zoom<=8] { 35 | text-size: 14; 36 | text-wrap-width:100; 37 | 38 | [zoom<=2] {text-size: 12;} 39 | 40 | [zoom>=4] { 41 | text-size: 18; 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /styles/ne10mroads.mss: -------------------------------------------------------------------------------- 1 | // Zooms 6-8 2 | 3 | #ne10mroads { 4 | ::underneath { 5 | line-color: @ne10roads_line_color; 6 | line-width: 0; 7 | } 8 | 9 | ::outline{ 10 | line-color: @ne10roads_line_outline; 11 | line-width: 0; 12 | } 13 | 14 | [zoom>=6][scalerank<7]{ 15 | line-color: @ne10roads_7_minor_color; 16 | line-width: 1; 17 | } 18 | 19 | [zoom>=7] { 20 | [scalerank<7] { 21 | ::outline{ 22 | line-color: @ne10roads_line_outline; 23 | line-width: 2.5; 24 | } 25 | line-color: @ne10roads_line_color; 26 | line-width: 1.8; 27 | } 28 | [scalerank>=7] { 29 | ::underneath { 30 | line-color: @ne10roads_7_minor_color; 31 | line-width: 1; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /styles/osm_roads_labels.mss: -------------------------------------------------------------------------------- 1 | #osmroads_labels[kind='major_road'] { 2 | text-name: "[name]"; 3 | text-placement: line; 4 | text-face-name: "Azo Sans Regular","DejaVu Sans Bold","unifont Medium"; 5 | text-fill: @osm_roads_labels_fill; 6 | text-transform: uppercase; 7 | text-halo-radius: @osm_roads_labels_radius; 8 | text-halo-fill: @osm_roads_labels_halo; 9 | text-size: 10px; 10 | text-character-spacing: 1.0; 11 | text-max-char-angle-delta: 30; 12 | text-min-distance: 14; 13 | text-avoid-edges: true; 14 | text-dy: 5; 15 | 16 | [zoom>=13] { 17 | text-size: 10px; 18 | } 19 | } 20 | 21 | #osmroads_labels[zoom>=16][kind='minor_road'] { 22 | text-name: "[name]"; 23 | text-placement: line; 24 | text-face-name: "Azo Sans Regular","DejaVu Sans Bold","unifont Medium"; 25 | text-fill: @osm_roads_labels_fill; 26 | text-transform: uppercase; 27 | text-halo-radius: @osm_roads_labels_radius; 28 | text-halo-fill: @osm_roads_labels_halo; 29 | text-size: 10px; 30 | text-character-spacing: 1.0; 31 | text-max-char-angle-delta: 30; 32 | text-min-distance: 14; 33 | text-avoid-edges: true; 34 | text-dy: 5; 35 | } 36 | -------------------------------------------------------------------------------- /styles/osm_roads_labels_lowercase.mss: -------------------------------------------------------------------------------- 1 | #osmroads_labels[kind='major_road'] { 2 | text-name: "[name]"; 3 | text-placement: line; 4 | text-face-name: "Open Sans Regular","DejaVu Sans Bold","unifont Medium"; 5 | text-fill: @osm_roads_labels_fill; 6 | //text-transform: uppercase; 7 | text-halo-radius: @osm_roads_labels_radius; 8 | text-halo-fill: @osm_roads_labels_halo; 9 | text-size: 10px; 10 | text-character-spacing: 1.0; 11 | text-max-char-angle-delta: 30; 12 | text-min-distance: 14; 13 | text-avoid-edges: true; 14 | text-dy: 5; 15 | 16 | [zoom>=13] { 17 | text-size: 10px; 18 | } 19 | 20 | [zoom>=16] { 21 | text-size: 11px; 22 | } 23 | } 24 | 25 | #osmroads_labels[zoom>=16][kind='minor_road'] { 26 | text-name: "[name]"; 27 | text-placement: line; 28 | text-face-name: "Open Sans Regular","DejaVu Sans Bold","unifont Medium"; 29 | text-fill: @osm_roads_labels_fill; 30 | //text-transform: uppercase; 31 | text-halo-radius: @osm_roads_labels_radius; 32 | text-halo-fill: @osm_roads_labels_halo; 33 | text-size: 10px; 34 | text-character-spacing: 1.0; 35 | text-max-char-angle-delta: 30; 36 | text-min-distance: 14; 37 | text-avoid-edges: true; 38 | text-dy: 5; 39 | } 40 | -------------------------------------------------------------------------------- /styles/osmbridges.mss: -------------------------------------------------------------------------------- 1 | // zoom 13+ 2 | 3 | #osmbridges { 4 | ::casing, ::outline { 5 | line-width: 0; 6 | } 7 | line-width: 0; 8 | 9 | [zoom=13] { 10 | [kind='highway'] { 11 | ::outline { 12 | line-color: @osm_roads_z13_highway_casing; 13 | line-width: 6; 14 | } 15 | line-width: 4; 16 | line-color: @osm_roads_z13_highway_stroke; 17 | 18 | [is_link='yes'] { 19 | ::outline { 20 | line-width: 4; 21 | } 22 | line-width: 2; 23 | } 24 | } 25 | [kind='major_road'] { 26 | ::outline { 27 | line-color: @osm_roads_z13_major_casing; 28 | line-width: 5; 29 | } 30 | line-width: 3; 31 | line-color: @osm_roads_z13_major_stroke; 32 | 33 | [is_link='yes'] { 34 | ::outline { 35 | line-width: 3; 36 | } 37 | line-width: 1; 38 | } 39 | } 40 | line-width: 1; 41 | line-color: @osm_roads_z13_minor_stroke; 42 | } 43 | 44 | [zoom>=14] { 45 | [kind='highway'] { 46 | ::outline { 47 | line-color: @osm_roads_z14plus_highway_casing; 48 | line-width: 6; 49 | } 50 | line-width: 4; 51 | line-color: @osm_roads_z14plus_highway_stroke; 52 | 53 | [is_link='yes'] { 54 | ::outline { 55 | line-width: 4; 56 | } 57 | line-width: 2; 58 | } 59 | } 60 | [kind='major_road'] { 61 | ::outline { 62 | line-color: @osm_roads_z14plus_major_casing; 63 | line-width: 5; 64 | } 65 | line-width: 3; 66 | line-color: @osm_roads_z14plus_major_stroke; 67 | 68 | [is_link='yes'] { 69 | ::outline { 70 | line-width: 4; 71 | } 72 | line-width: 2; 73 | } 74 | } 75 | 76 | ::outline { 77 | line-color: @osm_roads_z14plus_minor_casing; 78 | line-width: 3; 79 | } 80 | line-width: 1; 81 | line-color: @osm_roads_z14plus_minor_stroke; 82 | } 83 | 84 | [zoom=15] { 85 | [kind='highway'] { 86 | ::outline { 87 | line-width: 8; 88 | } 89 | line-width: 6; 90 | 91 | [is_link='yes'] { 92 | ::outline { 93 | line-width: 5; 94 | } 95 | line-width: 3; 96 | } 97 | } 98 | [kind='major_road'] { 99 | ::outline { 100 | line-width: 7; 101 | } 102 | line-width: 5; 103 | 104 | [is_link='yes'] { 105 | ::outline { 106 | line-width: 4; 107 | } 108 | line-width: 2; 109 | } 110 | } 111 | 112 | ::outline { 113 | line-width: 5; 114 | } 115 | line-width: 3; 116 | } 117 | 118 | [zoom=16] { 119 | [kind='highway'] { 120 | ::outline { 121 | line-width: 10; 122 | } 123 | line-width: 8; 124 | 125 | [is_link='yes'] { 126 | ::outline { 127 | line-width: 8; 128 | } 129 | line-width: 6; 130 | } 131 | } 132 | [kind='major_road'] { 133 | ::outline { 134 | line-width: 7; 135 | } 136 | line-width: 5; 137 | 138 | [is_link='yes'] { 139 | ::outline { 140 | line-width: 5; 141 | } 142 | line-width: 3; 143 | } 144 | } 145 | 146 | [kind='minor_road'] { 147 | ::outline { 148 | line-width: 6; 149 | } 150 | line-width: 4; 151 | } 152 | 153 | [kind='path'] { 154 | line-color: @osm_roads_path_stroke; 155 | line-width: 0.5; 156 | } 157 | } 158 | 159 | [zoom=17] { 160 | [kind='highway'] { 161 | ::outline { 162 | line-width: 12; 163 | } 164 | line-width: 10; 165 | 166 | [is_link='yes'] { 167 | ::outline { 168 | line-width: 10; 169 | } 170 | line-width: 8; 171 | } 172 | } 173 | [kind='major_road'] { 174 | ::outline { 175 | line-width: 10; 176 | } 177 | line-width: 8; 178 | 179 | [is_link='yes'] { 180 | ::outline { 181 | line-width: 8; 182 | } 183 | line-width: 6; 184 | } 185 | } 186 | 187 | [kind='minor_road'] { 188 | ::outline { 189 | line-width: 8; 190 | } 191 | line-width: 6; 192 | } 193 | 194 | [kind='path'] { 195 | line-color: @osm_roads_path_stroke; 196 | line-width: 0.5; 197 | } 198 | } 199 | 200 | [zoom=18] { 201 | [kind='highway'] { 202 | ::outline { 203 | line-width: 16; 204 | } 205 | line-width: 14; 206 | 207 | [is_link='yes'] { 208 | ::outline { 209 | line-width: 14; 210 | } 211 | line-width: 12; 212 | } 213 | } 214 | [kind='major_road'] { 215 | ::outline { 216 | line-width: 12; 217 | } 218 | line-width: 10; 219 | 220 | [is_link='yes'] { 221 | ::outline { 222 | line-width: 10; 223 | } 224 | line-width: 8; 225 | } 226 | } 227 | 228 | [kind='minor_road'] { 229 | ::outline { 230 | line-width: 10; 231 | } 232 | line-width: 8; 233 | } 234 | 235 | [kind='path'] { 236 | line-color: @osm_roads_path_stroke; 237 | line-width: 0.5; 238 | } 239 | } 240 | 241 | [railway='rail'] { 242 | line-width: 3; 243 | line-color: @rail_line; 244 | 245 | dash/line-width: 2; 246 | dash/line-color: @rail_dashline; 247 | dash/line-dasharray: 12,12; 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /styles/osmroads.mss: -------------------------------------------------------------------------------- 1 | // Zooms 9-18 2 | 3 | #osmroads { 4 | ::casing { 5 | line-width: 0; 6 | } 7 | ::outline { 8 | line-width: 0; 9 | } 10 | line-width: 0; 11 | 12 | [zoom=9][kind='highway'], 13 | [zoom=9][kind='major_road'] { 14 | [kind='highway'] { 15 | ::outline { 16 | line-color: @osm_roads_z9_highway_casing; 17 | line-width: 3; 18 | } 19 | line-width: 1; 20 | line-color: @osm_roads_z9_highway_stroke; 21 | } 22 | [kind='major_road'] { 23 | line-color: @osm_roads_z9_major_stroke; 24 | line-width: 0.5; 25 | } 26 | } 27 | 28 | [zoom=10] { 29 | [kind='highway'] { 30 | ::outline { 31 | line-color: @osm_roads_z10_highway_casing; 32 | line-width: 3; 33 | } 34 | line-width: 1; 35 | line-color: @osm_roads_z10_highway_stroke; 36 | } 37 | [kind='major_road'] { 38 | line-color: @osm_roads_z10_major_stroke; 39 | line-width: 0.5; 40 | } 41 | line-width: 0.5; 42 | line-color: @osm_roads_z10_minor_stroke; 43 | } 44 | 45 | [zoom=11] { 46 | [kind='highway'] { 47 | ::outline { 48 | line-color: @osm_roads_z11_highway_casing; 49 | line-width: 4; 50 | } 51 | line-width: 2; 52 | line-color: @osm_roads_z11_highway_stroke; 53 | } 54 | [kind='major_road'] { 55 | line-width: 1; 56 | line-color: @osm_roads_z11_major_stroke; 57 | } 58 | 59 | [kind='minor_road'] { 60 | line-width: 0.5; 61 | line-color: @osm_roads_z11_minor_stroke; 62 | line-cap: round; 63 | } 64 | } 65 | 66 | [zoom=12] { 67 | [kind='highway'][is_link='no'] { 68 | ::outline { 69 | line-color: @osm_roads_z12_highway_casing; 70 | line-width: 5; 71 | } 72 | line-width: 3; 73 | line-color: @osm_roads_z12_highway_stroke; 74 | } 75 | [kind='major_road'][is_link='no'] { 76 | ::outline { 77 | line-color: @osm_roads_z12_major_casing; 78 | line-width: 3; 79 | } 80 | line-width: 1; 81 | line-color: @osm_roads_z12_major_stroke; 82 | } 83 | 84 | [kind='minor_road'] { 85 | ::outline { 86 | line-width: 1.5; 87 | line-color: @landmass_fill; 88 | line-cap: round; 89 | } 90 | 91 | line-width: 0.5; 92 | line-color: @osm_roads_z12_minor_stroke; 93 | line-cap: round; 94 | } 95 | } 96 | 97 | [zoom=13] { 98 | [kind='highway'] { 99 | ::outline { 100 | line-color: @osm_roads_z13_highway_casing; 101 | line-width: 6; 102 | } 103 | line-width: 4; 104 | line-color: @osm_roads_z13_highway_stroke; 105 | 106 | [is_link='yes'] { 107 | ::outline { 108 | line-width: 4; 109 | } 110 | line-width: 2; 111 | } 112 | } 113 | [kind='major_road'] { 114 | ::outline { 115 | line-color: @osm_roads_z13_major_casing; 116 | line-width: 5; 117 | } 118 | line-width: 3; 119 | line-color: @osm_roads_z13_major_stroke; 120 | 121 | [is_link='yes'] { 122 | ::outline { 123 | line-width: 3; 124 | } 125 | line-width: 1; 126 | } 127 | } 128 | 129 | [kind='minor_road'] { 130 | ::outline { 131 | line-width: 3; 132 | line-color: @landmass_fill; 133 | line-cap: round; 134 | } 135 | 136 | line-width: 1; 137 | line-color: @osm_roads_z13_minor_stroke; 138 | line-cap: round; 139 | } 140 | } 141 | 142 | [zoom>=14] { 143 | [kind='highway'] { 144 | ::outline { 145 | line-color: @osm_roads_z14plus_highway_casing; 146 | line-width: 6; 147 | } 148 | line-width: 4; 149 | line-color: @osm_roads_z14plus_highway_stroke; 150 | 151 | [is_link='yes'] { 152 | ::outline { 153 | line-width: 4; 154 | } 155 | line-width: 2; 156 | } 157 | } 158 | [kind='major_road'] { 159 | ::outline { 160 | line-color: @osm_roads_z14plus_major_casing; 161 | line-width: 5; 162 | } 163 | line-width: 3; 164 | line-color: @osm_roads_z14plus_major_stroke; 165 | 166 | [is_link='yes'] { 167 | ::outline { 168 | line-width: 4; 169 | } 170 | line-width: 2; 171 | } 172 | } 173 | 174 | [kind='minor_road'] { 175 | ::outline { 176 | line-width: 3; 177 | line-color: @landmass_fill; 178 | line-cap: round; 179 | } 180 | 181 | line-width: 1; 182 | line-color: @osm_roads_z14plus_minor_casing; 183 | line-cap: round; 184 | } 185 | } 186 | 187 | 188 | [zoom=15] { 189 | [kind='highway'] { 190 | ::outline { 191 | line-width: 8; 192 | } 193 | line-width: 6; 194 | 195 | [is_link='yes'] { 196 | ::outline { 197 | line-width: 5; 198 | } 199 | line-width: 3; 200 | } 201 | } 202 | [kind='major_road'] { 203 | ::outline { 204 | line-width: 5; 205 | } 206 | line-width: 3; 207 | 208 | [is_link='yes'] { 209 | ::outline { 210 | line-width: 4; 211 | } 212 | line-width: 2; 213 | } 214 | } 215 | 216 | [kind='minor_road'] { 217 | ::outline { 218 | line-width: 4; 219 | } 220 | line-width: 2; 221 | } 222 | 223 | [kind='path'] { 224 | line-color: @osm_roads_path_stroke; 225 | line-width: 1.0; 226 | } 227 | } 228 | 229 | [zoom=16] { 230 | [kind='highway'] { 231 | ::outline { 232 | line-width: 10; 233 | } 234 | line-width: 8; 235 | 236 | [is_link='yes'] { 237 | ::outline { 238 | line-width: 8; 239 | } 240 | line-width: 6; 241 | } 242 | } 243 | [kind='major_road'] { 244 | ::outline { 245 | line-width: 7; 246 | } 247 | line-width: 5; 248 | 249 | [is_link='yes'] { 250 | ::outline { 251 | line-width: 5; 252 | } 253 | line-width: 3; 254 | } 255 | } 256 | 257 | [kind='minor_road'] { 258 | ::outline { 259 | line-width: 6; 260 | } 261 | line-width: 4; 262 | } 263 | 264 | [kind='path'] { 265 | line-color: @osm_roads_path_stroke; 266 | line-width: 1.0; 267 | } 268 | } 269 | 270 | [zoom=17] { 271 | [kind='highway'] { 272 | ::outline { 273 | line-width: 12; 274 | } 275 | line-width: 10; 276 | 277 | [is_link='yes'] { 278 | ::outline { 279 | line-width: 10; 280 | } 281 | line-width: 8; 282 | } 283 | } 284 | [kind='major_road'] { 285 | ::outline { 286 | line-width: 10; 287 | } 288 | line-width: 8; 289 | 290 | [is_link='yes'] { 291 | ::outline { 292 | line-width: 8; 293 | } 294 | line-width: 6; 295 | } 296 | } 297 | 298 | [kind='minor_road'] { 299 | ::outline { 300 | line-width: 8; 301 | } 302 | line-width: 6; 303 | } 304 | 305 | [kind='path'] { 306 | line-color: @osm_roads_path_stroke; 307 | line-width: 2.0; 308 | } 309 | } 310 | 311 | [zoom=18] { 312 | [kind='highway'] { 313 | ::outline { 314 | line-width: 16; 315 | } 316 | line-width: 14; 317 | 318 | [is_link='yes'] { 319 | ::outline { 320 | line-width: 14; 321 | } 322 | line-width: 12; 323 | } 324 | } 325 | [kind='major_road'] { 326 | ::outline { 327 | line-width: 12; 328 | } 329 | line-width: 10; 330 | 331 | [is_link='yes'] { 332 | ::outline { 333 | line-width: 10; 334 | } 335 | line-width: 8; 336 | } 337 | } 338 | 339 | [kind='minor_road'] { 340 | ::outline { 341 | line-width: 10; 342 | } 343 | line-width: 8; 344 | } 345 | 346 | [kind='path'] { 347 | line-color: @osm_roads_path_stroke; 348 | line-width: 4.0; 349 | } 350 | } 351 | 352 | //Railways. 353 | 354 | [railway='rail'][zoom>=13] { 355 | line-width: 3; 356 | line-color: @rail_line; 357 | 358 | dash/line-width: 2; 359 | dash/line-color: @rail_dashline; 360 | dash/line-dasharray: 12,12; 361 | } 362 | } 363 | -------------------------------------------------------------------------------- /styles/osmtunnels.mss: -------------------------------------------------------------------------------- 1 | // zoom 13+ 2 | 3 | #osmtunnels { 4 | ::outline { 5 | line-width: 0; 6 | } 7 | line-width: 0; 8 | line-color: @osm_tunnel_stroke; 9 | 10 | [zoom=13] { 11 | [kind='highway'] { 12 | ::outline { 13 | line-color: @osm_roads_z13_highway_casing; 14 | line-width: 6; 15 | } 16 | line-width: 4; 17 | } 18 | [kind='major_road'] { 19 | ::outline { 20 | line-color: @osm_roads_z13_major_casing; 21 | line-width: 5; 22 | } 23 | line-width: 3; 24 | } 25 | line-width: 1; 26 | } 27 | 28 | [zoom>=14] { 29 | [kind='highway'] { 30 | ::outline { 31 | line-color: @osm_roads_z14plus_highway_casing; 32 | line-width: 6; 33 | } 34 | line-width: 4; 35 | } 36 | [kind='major_road'] { 37 | ::outline { 38 | line-color: @osm_roads_z14plus_major_casing; 39 | line-width: 5; 40 | } 41 | line-width: 3; 42 | } 43 | 44 | ::outline { 45 | line-color: @osm_roads_z14plus_minor_casing; 46 | line-width: 3; 47 | } 48 | line-width: 1; 49 | } 50 | 51 | [zoom=15] { 52 | [kind='highway'] { 53 | ::outline { 54 | line-width: 8; 55 | } 56 | line-width: 6; 57 | } 58 | [kind='major_road'] { 59 | ::outline { 60 | line-width: 7; 61 | } 62 | line-width: 5; 63 | } 64 | 65 | ::outline { 66 | line-width: 5; 67 | } 68 | line-width: 3; 69 | } 70 | 71 | [zoom=16] { 72 | [kind='highway'] { 73 | ::outline { 74 | line-width: 10; 75 | } 76 | line-width: 8; 77 | } 78 | [kind='major_road'] { 79 | ::outline { 80 | line-width: 7; 81 | } 82 | line-width: 5; 83 | } 84 | 85 | [kind='minor_road'] { 86 | ::outline { 87 | line-width: 6; 88 | } 89 | line-width: 4; 90 | } 91 | 92 | [kind='path'] { 93 | line-color: @osm_roads_path_stroke; 94 | line-width: 0.5; 95 | } 96 | } 97 | 98 | [zoom=17] { 99 | [kind='highway'] { 100 | ::outline { 101 | line-width: 12; 102 | } 103 | line-width: 10; 104 | } 105 | [kind='major_road'] { 106 | ::outline { 107 | line-width: 10; 108 | } 109 | line-width: 8; 110 | } 111 | 112 | [kind='minor_road'] { 113 | ::outline { 114 | line-width: 8; 115 | } 116 | line-width: 6; 117 | } 118 | 119 | [kind='path'] { 120 | line-color: @osm_roads_path_stroke; 121 | line-width: 0.5; 122 | } 123 | } 124 | 125 | [zoom=18] { 126 | [kind='highway'] { 127 | ::outline { 128 | line-width: 16; 129 | } 130 | line-width: 14; 131 | } 132 | [kind='major_road'] { 133 | ::outline { 134 | line-width: 12; 135 | } 136 | line-width: 10; 137 | } 138 | 139 | [kind='minor_road'] { 140 | ::outline { 141 | line-width: 10; 142 | } 143 | line-width: 8; 144 | } 145 | 146 | [kind='path'] { 147 | line-color: @osm_roads_path_stroke; 148 | line-width: 0.5; 149 | } 150 | } 151 | 152 | [railway='rail'] { 153 | line-width: 3; 154 | line-color: @osm_tunnel_stroke; 155 | } 156 | } 157 | 158 | -------------------------------------------------------------------------------- /styles/park_labels.mss: -------------------------------------------------------------------------------- 1 | // zooms 10+ 2 | 3 | #park_labels { 4 | [zoom=10][area>100000000], 5 | [zoom=11][area>25000000], 6 | [zoom=12][area>5000000], 7 | [zoom=13][area>2000000], 8 | [zoom=14][area>200000], 9 | [zoom=15][area>50000], 10 | [zoom=16][area>10000], 11 | [zoom>=17] { 12 | text-size: 12; 13 | text-name: "[name]"; 14 | text-fill: @label_park_fill; 15 | text-halo-radius: @label_park_halo_radius; 16 | text-halo-fill: @label_park_halo_fill; 17 | text-face-name: "Azo Sans Italic","DejaVu Sans Bold","unifont Medium"; 18 | text-character-spacing: 1.0; 19 | text-wrap-width: 150; 20 | text-wrap-before: true; 21 | text-ratio: 0.5; 22 | [name=~".* Watershed"], 23 | [name=~".* Wilderness"], 24 | [name=~".* Wildlife Management Area"], 25 | [name=~".* Wildlife Refuge"] { 26 | text-name: ""; 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /styles/park_labels_lowercase.mss: -------------------------------------------------------------------------------- 1 | // zooms 10+ 2 | 3 | #park_labels [zoom<=17] { 4 | [zoom=10][area>100000000], 5 | [zoom=11][area>25000000], 6 | [zoom=12][area>5000000], 7 | [zoom=13][area>2000000], 8 | [zoom=14][area>200000], 9 | [zoom=15][area>50000], 10 | [zoom=16][area>10000], 11 | [zoom>=17] { 12 | text-size: 11; 13 | text-name: "[name]"; 14 | text-fill: @label_park_fill; 15 | text-halo-radius: @label_park_halo_radius; 16 | text-halo-fill: @label_park_halo_fill; 17 | text-face-name: "Open Sans Italic","DejaVu Sans Bold","unifont Medium"; 18 | text-character-spacing: 1.0; 19 | text-wrap-width: 150; 20 | [zoom>=11]{text-wrap-width: 120;} 21 | [zoom>=15]{text-wrap-width: 100;} 22 | text-wrap-before: true; 23 | text-ratio: 0.5; 24 | [name=~".* Watershed"], 25 | [name=~".* Wilderness"], 26 | [name=~".* Wildlife Management Area"], 27 | [name=~".* Wildlife Refuge"] { 28 | text-name: ""; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /styles/urban_areas.mss: -------------------------------------------------------------------------------- 1 | // Zooms 4-7 2 | 3 | #urban_areas { 4 | [zoom>=5][zoom<=6] { 5 | polygon-fill: @urbanareas; 6 | [scalerank>2] { polygon-fill: fadeout(@urbanareas,50%); } 7 | [scalerank>4] { polygon-fill: fadeout(@urbanareas,75%); } 8 | } 9 | [zoom=7] { 10 | polygon-fill: fadeout(@urbanareas,30%); 11 | [scalerank>2] { polygon-fill: fadeout(@urbanareas,60%); } 12 | [scalerank>4] { polygon-fill: fadeout(@urbanareas,80%); } 13 | } 14 | [zoom=8] { 15 | polygon-fill: fadeout(@urbanareas,50%); 16 | [scalerank>2] { polygon-fill: fadeout(@urbanareas,70%); } 17 | [scalerank>4] { polygon-fill: fadeout(@urbanareas,85%); } 18 | } 19 | [zoom=9] { 20 | polygon-fill: fadeout(@urbanareas,70%); 21 | [scalerank>4] { polygon-fill: fadeout(@urbanareas,85%); } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /styles/water.mss: -------------------------------------------------------------------------------- 1 | // Zooms 3-18 2 | 3 | #water { 4 | ::outline { 5 | line-color: @landmass_line; 6 | line-width: 0; 7 | } 8 | 9 | // Natural Earth 10 | [zoom >= 3][zoom < 8] { 11 | ::outline { 12 | line-width: 0; 13 | line-color: @ne_rivers_casing; 14 | } 15 | 16 | [is_lake=0] { 17 | [zoom=4][ne_scalerank<3], 18 | [zoom=5][ne_scalerank<4], 19 | [zoom>5][ne_scalerank<5] { 20 | ::outline { 21 | line-width: 3; 22 | } 23 | 24 | line-color: @ne_rivers_stroke; 25 | line-width: 0.5; 26 | } 27 | } 28 | 29 | [is_lake=1] { 30 | polygon-fill: @water; 31 | 32 | ::outline { 33 | line-color: @landmass_line; 34 | line-width: 1; 35 | } 36 | } 37 | } 38 | 39 | // OSM 40 | [zoom >= 8] { 41 | [is_lake=0] { 42 | line-color: @water; 43 | line-width: 0.5; 44 | 45 | // to avoid excessive detail near Perpignan, France (10/42.6380/2.6944) 46 | [zoom<13][type='riverbank'] { 47 | line-width: 0; 48 | } 49 | } 50 | 51 | [is_lake=1] { 52 | polygon-fill: @water; 53 | 54 | ::outline[zoom=8][area>500000000] { line-width: 1; } 55 | ::outline[zoom=9][area>100000000] { line-width: 1.5; } 56 | ::outline[zoom=10][area>100000000] { line-width: 2; } 57 | ::outline[zoom=11][area>10000000] { line-width: 2.5; } 58 | ::outline[zoom=12][area>1000000] { line-width: 2.25; } 59 | ::outline[zoom=13][area>1000000] { line-width: 2.5; } 60 | ::outline[zoom=14][area>1000000] { line-width: 2.75; } 61 | ::outline[zoom=15][area>1000000] { line-width: 3; } 62 | ::outline[zoom=16][area>1000000] { line-width: 3.25; } 63 | ::outline[zoom=17][area>1000000] { line-width: 3.5; } 64 | ::outline[zoom=18][area>1000000] { line-width: 4; } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /styles/water_labels.mss: -------------------------------------------------------------------------------- 1 | // zooms 10+ 2 | 3 | #water_labels { 4 | [is_lake=1] { 5 | [zoom=9][area>100000000], 6 | [zoom=10][area>100000000], 7 | [zoom=11][area>25000000], 8 | [zoom=12][area>5000000], 9 | [zoom=13][area>0], 10 | [zoom=14][area>200000], 11 | [zoom=15][area>50000], 12 | [zoom=16][area>10000], 13 | [zoom>=17] { 14 | text-size: 11; 15 | text-name: "[name]"; 16 | text-fill: @label_water_fill; 17 | text-halo-fill: @label_water_halo_fill; 18 | text-halo-radius: @label_water_halo_radius; 19 | text-face-name: "Azo Sans Italic","DejaVu Sans Bold","unifont Medium"; 20 | text-placement: interior; 21 | text-min-distance: 20; 22 | } 23 | } 24 | [is_lake=0] { 25 | [zoom>=9] { 26 | text-size: 11; 27 | text-name: "[name]"; 28 | text-fill: @label_water_fill; 29 | text-halo-fill: @label_water_halo_fill; 30 | text-halo-radius: @label_water_halo_radius; 31 | text-face-name: "Azo Sans Italic","DejaVu Sans Bold","unifont Medium"; 32 | text-placement: line; 33 | text-min-distance: 100; 34 | text-avoid-edges: true; 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /styles/water_labels_lowercase.mss: -------------------------------------------------------------------------------- 1 | // zooms 10+ 2 | 3 | #water_labels [zoom<=17] { 4 | [is_lake=1] { 5 | [zoom=9][area>100000000], 6 | [zoom=10][area>100000000], 7 | [zoom=11][area>25000000], 8 | [zoom=12][area>5000000], 9 | [zoom=13][area>0], 10 | [zoom=14][area>200000], 11 | [zoom=15][area>50000], 12 | [zoom=16][area>10000], 13 | [zoom>=17] { 14 | text-size: 11; 15 | text-name: "[name]"; 16 | text-fill: @label_water_fill; 17 | text-halo-fill: @label_water_halo_fill; 18 | text-halo-radius: @label_water_halo_radius; 19 | text-face-name: "Open Sans Italic","DejaVu Sans Bold","unifont Medium"; 20 | text-placement: interior; 21 | text-min-distance: 20; 22 | text-wrap-width: 100; 23 | } 24 | } 25 | [is_lake=0] { 26 | [zoom>=9] { 27 | text-size: 11; 28 | text-name: "[name]"; 29 | text-fill: @label_water_fill; 30 | text-halo-fill: @label_water_halo_fill; 31 | text-halo-radius: @label_water_halo_radius; 32 | text-face-name: "Open Sans Italic","DejaVu Sans Bold","unifont Medium"; 33 | text-placement: line; 34 | text-min-distance: 100; 35 | text-avoid-edges: true; 36 | 37 | [zoom>=13]{text-size: 13;} 38 | } 39 | } 40 | } 41 | --------------------------------------------------------------------------------