From 978399dc399ea2a11deb0dd790d274825ba1ffc4 Mon Sep 17 00:00:00 2001 From: Eugene Alvin Villar Date: Fri, 23 Sep 2016 07:51:43 +0800 Subject: [PATCH] Resolve #716: Add DigitalGlobe Vivid layer --- cadasta/config/settings/default.py | 60 ++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/cadasta/config/settings/default.py b/cadasta/config/settings/default.py index 3d076f0d6..4681ccd75 100644 --- a/cadasta/config/settings/default.py +++ b/cadasta/config/settings/default.py @@ -159,22 +159,52 @@ ACCOUNT_LOGOUT_ON_GET = True ACCOUNT_LOGOUT_REDIRECT_URL = LOGIN_URL +OSM_ATTRIBUTION = _( + "Base map data © " + "OpenStreetMap contributors under " + "ODbL" +) +DIGITALGLOBE_ATTRIBUTION = _("Imagery © DigitalGlobe ") +DIGITALGLOBE_TILESET_URL_FORMAT = ( + 'https://{{s}}.tiles.mapbox.com/v4/digitalglobe.{}' + '/{{z}}/{{x}}/{{y}}.png?access_token=' + 'pk.eyJ1IjoiZGlnaXRhbGdsb2JlIiwiYSI6ImNpaHhtenBmZjAzYW1' + '1a2tvY2p3MnpjcGcifQ.vF1gH0mGgK31yeHC1k1Tqw' +) + LEAFLET_CONFIG = { - 'TILES': [('OpenStreetMap', - 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - {'attribution': - _('Map data © ' - 'OpenStreetMap contributors, ' - '' - 'CC-BY-SA'), - 'maxZoom': 19}), - ('DigitalGlobe Satellite', - 'https://{s}.tiles.mapbox.com/v4/digitalglobe.nal0g75k' - '/{z}/{x}/{y}.png?access_token=' - 'pk.eyJ1IjoiZGlnaXRhbGdsb2JlIiwiYSI6ImNpaHhtenBmZjAzYW1' - '1a2tvY2p3MnpjcGcifQ.vF1gH0mGgK31yeHC1k1Tqw', - {'attribution': 'DigitalGlobe', - 'maxZoom': 22})], + 'TILES': [ + ( + "OpenStreetMap", + 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', + {'attribution': OSM_ATTRIBUTION, + 'maxZoom': 19} + ), + ( + "Vivid Imagery", + DIGITALGLOBE_TILESET_URL_FORMAT.format('n6ngnadl'), + {'attribution': DIGITALGLOBE_ATTRIBUTION, + 'maxZoom': 22} + ), + ( + "Recent Imagery", + DIGITALGLOBE_TILESET_URL_FORMAT.format('nal0g75k'), + {'attribution': DIGITALGLOBE_ATTRIBUTION, + 'maxZoom': 22} + ), + ( + "Vivid Imagery with OpenStreetMap", + DIGITALGLOBE_TILESET_URL_FORMAT.format('n6nhclo2'), + {'attribution': (OSM_ATTRIBUTION, DIGITALGLOBE_ATTRIBUTION), + 'maxZoom': 22} + ), + ( + "Recent Imagery with OpenStreetMap", + DIGITALGLOBE_TILESET_URL_FORMAT.format('nal0mpda'), + {'attribution': (OSM_ATTRIBUTION, DIGITALGLOBE_ATTRIBUTION), + 'maxZoom': 22} + ), + ], 'RESET_VIEW': False, 'PLUGINS': { 'draw': {