Skip to content

Commit

Permalink
adds carto basemap layers
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbattista committed Jul 27, 2018
1 parent 63dbfbc commit 9d4590e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 9 deletions.
53 changes: 49 additions & 4 deletions app/assets/javascripts/geoblacklight/basemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,62 @@

GeoBlacklight.Basemaps = {
darkMatter: L.tileLayer(
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
'http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
maxZoom: 18,
worldCopyJump: true,
retina: '@2x',
detectRetina: false
}
),
positron: L.tileLayer(
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
maxZoom: 18,
worldCopyJump: true,
retina: '@2x',
detectRetina: false
}
),
positronLite: L.tileLayer(
'http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
maxZoom: 18,
worldCopyJump: true,
retina: '@2x',
detectRetina: false
}
),
worldAntique: L.tileLayer(
'https://cartocdn_{s}.global.ssl.fastly.net/base-antique/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
maxZoom: 18,
worldCopyJump: true,
retina: '@2x',
detectRetina: false
}
),
worldEco: L.tileLayer(
'https://cartocdn_{s}.global.ssl.fastly.net/base-eco/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
maxZoom: 18,
worldCopyJump: true,
retina: '@2x',
detectRetina: false
}
),
flatBlue: L.tileLayer(
'https://cartocdn_{s}.global.ssl.fastly.net/base-flatblue/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
maxZoom: 18,
worldCopyJump: true,
retina: '@2x',
detectRetina: false
}
),
midnightCommander: L.tileLayer(
'https://cartocdn_{s}.global.ssl.fastly.net/base-midnight/{z}/{x}/{y}{retina}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://carto.com/attributions">Carto</a>',
maxZoom: 18,
worldCopyJump: true,
retina: '@2x',
Expand Down
10 changes: 8 additions & 2 deletions lib/generators/geoblacklight/templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,14 @@ class CatalogController < ApplicationController
# Configure basemap provider for GeoBlacklight maps (uses https only basemap
# providers with open licenses)
# Valid basemaps include:
# 'positron' http://cartodb.com/basemaps/
# 'darkMatter' http://cartodb.com/basemaps/
# 'positron'
# 'darkMatter'
# 'positronLite'
# 'worldAntique'
# 'worldEco'
# 'flatBlue'
# 'midnightCommander'

config.basemap_provider = 'positron'

# Configuration for autocomplete suggestor
Expand Down
6 changes: 3 additions & 3 deletions spec/features/configurable_basemap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
feature 'Configurable basemap', js: true do
scenario 'defaults to positron' do
visit root_path
expect(page).to have_css "img[src*='cartodb']"
expect(page).to have_css "img[src*='carto']"
end
feature 'without provided basemap config' do
before do
CatalogController.blacklight_config.basemap_provider = nil
end
scenario 'has CartoDB map' do
scenario 'has Carto map' do
visit root_path
expect(page).to have_css "img[src*='cartodb']"
expect(page).to have_css "img[src*='carto']"
end
end
feature 'using darkMatter' do
Expand Down

0 comments on commit 9d4590e

Please sign in to comment.