From e868c071ac329accc8cfa19d4db800186660d536 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 6 Feb 2013 17:16:00 -0500 Subject: [PATCH] Remove more unreliable or slow layers, select the right layer initially, fix null tooltips --- css/app.css | 6 +++ data/imagery.js | 77 ++++++--------------------------------- data/imagery.json | 77 ++++++--------------------------------- data/imagery_convert.js | 10 ++++- js/id/renderer/layers.js | 1 + js/id/ui/layerswitcher.js | 8 +++- 6 files changed, 44 insertions(+), 135 deletions(-) diff --git a/css/app.css b/css/app.css index a43133f3d..ef42bb28c 100644 --- a/css/app.css +++ b/css/app.css @@ -186,6 +186,8 @@ ul.toggle-list li a { border-top: 1px solid white; display:block; border-top: 1px solid rgba(0, 0, 0, .5); + text-wrap:no-wrap; + overflow:hidden; } ul.toggle-list li a:hover { background-color: #ececec;} @@ -687,6 +689,10 @@ a.selected:hover .toggle.icon { background-position: -40px -180px;} top:190px; } +.layerswitcher-control .map-overlay { + width:250px; +} + .nudge-container { margin-top: 10px; } diff --git a/data/imagery.js b/data/imagery.js index fb6f3f020..6c232b626 100644 --- a/data/imagery.js +++ b/data/imagery.js @@ -42,55 +42,8 @@ iD.data.imagery = [ ] }, { - "name": "OSM - Tiger Edited Map", - "template": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", - "extent": [ - [ - -124.81, - 24.055 - ], - [ - -66.865, - 49.386 - ] - ] - }, - { - "name": "OSM - Tiger Edited Map", - "template": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", - "extent": [ - [ - -179.754, - 50.858 - ], - [ - -129.899, - 71.463 - ] - ] - }, - { - "name": "OSM - Tiger Edited Map", - "template": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", - "extent": [ - [ - -174.46, - 18.702 - ], - [ - -154.516, - 26.501 - ] - ] - }, - { - "name": "OSM US TIGER 2012 Roads Overlay", + "name": " TIGER 2012 Roads Overlay", "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "description": "Public domain road data from the US Government.", - "scaleExtent": [ - 0, - 17 - ], "subdomains": [ "a", "b", @@ -108,13 +61,8 @@ iD.data.imagery = [ ] }, { - "name": "OSM US TIGER 2012 Roads Overlay", + "name": " TIGER 2012 Roads Overlay", "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "description": "Public domain road data from the US Government.", - "scaleExtent": [ - 0, - 17 - ], "subdomains": [ "a", "b", @@ -132,13 +80,8 @@ iD.data.imagery = [ ] }, { - "name": "OSM US TIGER 2012 Roads Overlay", + "name": " TIGER 2012 Roads Overlay", "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "description": "Public domain road data from the US Government.", - "scaleExtent": [ - 0, - 17 - ], "subdomains": [ "a", "b", @@ -156,7 +99,7 @@ iD.data.imagery = [ ] }, { - "name": "OSM US USGS Topographic Maps", + "name": " USGS Topographic Maps", "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", "subdomains": [ "a", @@ -175,7 +118,7 @@ iD.data.imagery = [ ] }, { - "name": "OSM US USGS Topographic Maps", + "name": " USGS Topographic Maps", "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", "subdomains": [ "a", @@ -194,7 +137,7 @@ iD.data.imagery = [ ] }, { - "name": "OSM US USGS Topographic Maps", + "name": " USGS Topographic Maps", "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", "subdomains": [ "a", @@ -213,7 +156,7 @@ iD.data.imagery = [ ] }, { - "name": "OSM US USGS Large Scale Aerial Imagery", + "name": " USGS Large Scale Aerial Imagery", "template": "http://{t}.tile.openstreetmap.us/usgs_large_scale/{z}/{x}/{y}.jpg", "subdomains": [ "a", @@ -453,8 +396,9 @@ iD.data.imagery = [ "sourcetag": "Haiti streetnames" }, { - "name": "National Agriculture Imagery Program", + "name": "NAIP", "template": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png", + "description": "National Agriculture Imagery Program", "extent": [ [ -125.8, @@ -468,8 +412,9 @@ iD.data.imagery = [ "sourcetag": "NAIP" }, { - "name": "National Agriculture Imagery Program", + "name": "NAIP", "template": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png", + "description": "National Agriculture Imagery Program", "extent": [ [ -168.5, diff --git a/data/imagery.json b/data/imagery.json index e4497fc9d..ee9906d31 100644 --- a/data/imagery.json +++ b/data/imagery.json @@ -42,55 +42,8 @@ ] }, { - "name": "OSM - Tiger Edited Map", - "template": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", - "extent": [ - [ - -124.81, - 24.055 - ], - [ - -66.865, - 49.386 - ] - ] - }, - { - "name": "OSM - Tiger Edited Map", - "template": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", - "extent": [ - [ - -179.754, - 50.858 - ], - [ - -129.899, - 71.463 - ] - ] - }, - { - "name": "OSM - Tiger Edited Map", - "template": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", - "extent": [ - [ - -174.46, - 18.702 - ], - [ - -154.516, - 26.501 - ] - ] - }, - { - "name": "OSM US TIGER 2012 Roads Overlay", + "name": " TIGER 2012 Roads Overlay", "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "description": "Public domain road data from the US Government.", - "scaleExtent": [ - 0, - 17 - ], "subdomains": [ "a", "b", @@ -108,13 +61,8 @@ ] }, { - "name": "OSM US TIGER 2012 Roads Overlay", + "name": " TIGER 2012 Roads Overlay", "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "description": "Public domain road data from the US Government.", - "scaleExtent": [ - 0, - 17 - ], "subdomains": [ "a", "b", @@ -132,13 +80,8 @@ ] }, { - "name": "OSM US TIGER 2012 Roads Overlay", + "name": " TIGER 2012 Roads Overlay", "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "description": "Public domain road data from the US Government.", - "scaleExtent": [ - 0, - 17 - ], "subdomains": [ "a", "b", @@ -156,7 +99,7 @@ ] }, { - "name": "OSM US USGS Topographic Maps", + "name": " USGS Topographic Maps", "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", "subdomains": [ "a", @@ -175,7 +118,7 @@ ] }, { - "name": "OSM US USGS Topographic Maps", + "name": " USGS Topographic Maps", "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", "subdomains": [ "a", @@ -194,7 +137,7 @@ ] }, { - "name": "OSM US USGS Topographic Maps", + "name": " USGS Topographic Maps", "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", "subdomains": [ "a", @@ -213,7 +156,7 @@ ] }, { - "name": "OSM US USGS Large Scale Aerial Imagery", + "name": " USGS Large Scale Aerial Imagery", "template": "http://{t}.tile.openstreetmap.us/usgs_large_scale/{z}/{x}/{y}.jpg", "subdomains": [ "a", @@ -453,8 +396,9 @@ "sourcetag": "Haiti streetnames" }, { - "name": "National Agriculture Imagery Program", + "name": "NAIP", "template": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png", + "description": "National Agriculture Imagery Program", "extent": [ [ -125.8, @@ -468,8 +412,9 @@ "sourcetag": "NAIP" }, { - "name": "National Agriculture Imagery Program", + "name": "NAIP", "template": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png", + "description": "National Agriculture Imagery Program", "extent": [ [ -168.5, diff --git a/data/imagery_convert.js b/data/imagery_convert.js index 5dc36c502..abc5cbef6 100644 --- a/data/imagery_convert.js +++ b/data/imagery_convert.js @@ -14,14 +14,16 @@ var censor = { }; var replace = { - 'OSM - Mapnik': 'OpenStreetMap' + 'OSM - Mapnik': 'OpenStreetMap', + 'National Agriculture Imagery Program': 'NAIP' }; var description = { 'MapBox Satellite': 'Satellite and aerial imagery', 'OpenStreetMap': 'The default OpenStreetMap layer.', 'OSM US TIGER 2012 Roads Overlay': 'Public domain road data from the US Government.', - 'Bing aerial imagery': 'Satellite imagery.' + 'Bing aerial imagery': 'Satellite imagery.', + 'NAIP': 'National Agriculture Imagery Program' }; var scaleExtent = { @@ -39,8 +41,12 @@ $('set').each(function(i) { template: $(this).find('url').first().text() }; + // no luck with mapquest servers currently... + if (im.template.match(/mapquest/g)) return; if (censor[im.name]) return; + im.name = im.name.replace('OSM US', ''); + if (replace[im.name]) im.name = replace[im.name]; if (description[im.name]) im.description = description[im.name]; diff --git a/js/id/renderer/layers.js b/js/id/renderer/layers.js index 773e8011e..966e16bb8 100644 --- a/js/id/renderer/layers.js +++ b/js/id/renderer/layers.js @@ -4,6 +4,7 @@ iD.layers.push((function() { function custom() { var template = window.prompt('Enter a tile template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.'); if (!template) return null; + if (template.match(/google/g)) return null; return iD.BackgroundSource.template({ template: template, name: 'Custom (customized)' diff --git a/js/id/ui/layerswitcher.js b/js/id/ui/layerswitcher.js index 88ee45f49..f788322b1 100644 --- a/js/id/ui/layerswitcher.js +++ b/js/id/ui/layerswitcher.js @@ -122,10 +122,16 @@ iD.ui.layerswitcher = function(context) { .text(function(d) { return d.data.name; }) - .call(bootstrap.tooltip().placement('right')) + .each(function(d) { + // only set tooltips for layers with tooltips + if (d.data.description) { + d3.select(this).call(bootstrap.tooltip().placement('right')); + } + }) .on('click.set-source', clickSetSource) .insert('span') .attr('class','icon toggle'); + selectLayer(context.background().source()); } context.map().on('move.layerswitcher-update', _.debounce(update, 1000));