Update to iD v1.7.0
authorBryan Housel <bryan@7thposition.com>
Thu, 12 Feb 2015 10:41:04 +0000 (05:41 -0500)
committerBryan Housel <bryan@7thposition.com>
Thu, 12 Feb 2015 10:41:04 +0000 (05:41 -0500)
63 files changed:
Vendorfile
vendor/assets/iD/iD.css.erb
vendor/assets/iD/iD.js
vendor/assets/iD/iD/img/sprite.svg
vendor/assets/iD/iD/locales/af.json
vendor/assets/iD/iD/locales/ar.json
vendor/assets/iD/iD/locales/ast.json
vendor/assets/iD/iD/locales/bg-BG.json
vendor/assets/iD/iD/locales/bn.json
vendor/assets/iD/iD/locales/bs.json
vendor/assets/iD/iD/locales/ca.json
vendor/assets/iD/iD/locales/cs.json
vendor/assets/iD/iD/locales/da.json
vendor/assets/iD/iD/locales/de-DE.json [new file with mode: 0644]
vendor/assets/iD/iD/locales/de.json
vendor/assets/iD/iD/locales/el.json
vendor/assets/iD/iD/locales/en-DE.json [new file with mode: 0644]
vendor/assets/iD/iD/locales/en-GB.json
vendor/assets/iD/iD/locales/en.json
vendor/assets/iD/iD/locales/eo.json
vendor/assets/iD/iD/locales/es.json
vendor/assets/iD/iD/locales/et.json
vendor/assets/iD/iD/locales/fa.json
vendor/assets/iD/iD/locales/fi.json
vendor/assets/iD/iD/locales/fr.json
vendor/assets/iD/iD/locales/gl.json
vendor/assets/iD/iD/locales/hi-IN.json [new file with mode: 0644]
vendor/assets/iD/iD/locales/hr.json
vendor/assets/iD/iD/locales/hu.json
vendor/assets/iD/iD/locales/id.json
vendor/assets/iD/iD/locales/is.json
vendor/assets/iD/iD/locales/it.json
vendor/assets/iD/iD/locales/ja.json
vendor/assets/iD/iD/locales/kn.json
vendor/assets/iD/iD/locales/ko-KR.json
vendor/assets/iD/iD/locales/ko.json
vendor/assets/iD/iD/locales/lt.json
vendor/assets/iD/iD/locales/lv.json
vendor/assets/iD/iD/locales/nl.json
vendor/assets/iD/iD/locales/no.json
vendor/assets/iD/iD/locales/pl.json
vendor/assets/iD/iD/locales/pt-BR.json
vendor/assets/iD/iD/locales/pt.json
vendor/assets/iD/iD/locales/ro-RO.json
vendor/assets/iD/iD/locales/ru-RU.json [new file with mode: 0644]
vendor/assets/iD/iD/locales/ru.json
vendor/assets/iD/iD/locales/sk.json
vendor/assets/iD/iD/locales/sl.json
vendor/assets/iD/iD/locales/sr.json
vendor/assets/iD/iD/locales/sv.json
vendor/assets/iD/iD/locales/ta.json
vendor/assets/iD/iD/locales/te.json
vendor/assets/iD/iD/locales/tl.json
vendor/assets/iD/iD/locales/tr.json
vendor/assets/iD/iD/locales/uk.json
vendor/assets/iD/iD/locales/vi.json
vendor/assets/iD/iD/locales/yue.json
vendor/assets/iD/iD/locales/zh-CN.json
vendor/assets/iD/iD/locales/zh-HK.json
vendor/assets/iD/iD/locales/zh-TW.json
vendor/assets/iD/iD/locales/zh.json
vendor/assets/iD/imagery.js [new file with mode: 0644]
vendor/assets/iD/presets.js [new file with mode: 0644]

index 6468d506745b675f06103faad2dbe0aa43a34516..2d31a3cbd6247929a3f0ee580b4de859d3960b79 100644 (file)
@@ -49,6 +49,8 @@ folder 'vendor/assets' do
         rewrite(path) { |content| content.gsub(/url\('?(img\/[^')]+)'?\)/, 'url(<%= asset_path("iD/\1") %>)') }
       end
       file 'iD.js', 'dist/iD.js'
+      file 'presets.js', 'dist/presets.js'
+      file 'imagery.js', 'dist/imagery.js'
     end
   end
 
index b45cf221afb43263e4f4c1e0204dfcc6e4112b1f..9e35dc634bff6381bce7865e244975ab9665a20a 100644 (file)
@@ -343,6 +343,8 @@ path.area.stroke {
     stroke-width: 1;
 }
 path.area.fill {
+    stroke-width: 0;
+    stroke: rgba(255, 255, 255, 0.3);
     fill: rgba(255, 255, 255, 0.3);
     fill-rule: evenodd;
 }
@@ -355,6 +357,7 @@ path.stroke.tag-natural {
     stroke: rgb(182, 225, 153);
 }
 path.fill.tag-natural {
+    stroke: rgba(182, 225, 153, 0.3);
     fill: rgba(182, 225, 153, 0.3);
 }
 .preset-icon-fill-area.tag-natural {
@@ -362,12 +365,52 @@ path.fill.tag-natural {
     background-color: rgba(182, 225, 153, 0.3);
 }
 
-path.stroke.tag-natural-water {
+path.stroke.tag-landuse,
+path.stroke.tag-natural-wood,
+path.stroke.tag-natural-tree,
+path.stroke.tag-natural-grassland,
+path.stroke.tag-natural-grass,
+path.stroke.tag-leisure-nature_reserve,
+path.stroke.tag-leisure-pitch,
+path.stroke.tag-leisure-park {
+    stroke: rgb(140, 208, 95);
+}
+path.fill.tag-landuse,
+path.fill.tag-natural-wood,
+path.fill.tag-natural-tree,
+path.fill.tag-natural-grassland,
+path.fill.tag-natural-grass,
+path.fill.tag-leisure-nature_reserve,
+path.fill.tag-leisure-pitch,
+path.fill.tag-leisure-park {
+    stroke: rgba(140, 208, 95, 0.3);
+    fill: rgba(140, 208, 95, 0.3);
+}
+.preset-icon-fill-area.tag-landuse,
+.preset-icon-fill-area.tag-natural-wood,
+.preset-icon-fill-area.tag-natural-tree,
+.preset-icon-fill-area.tag-natural-grassland,
+.preset-icon-fill-area.tag-natural-grass,
+.preset-icon-fill-area.tag-leisure-nature_reserve,
+.preset-icon-fill-area.tag-leisure-pitch,
+.preset-icon-fill-area.tag-leisure-park {
+    border-color: rgb(140, 208, 95);
+    background-color: rgba(140, 208, 95, 0.3);
+}
+
+path.stroke.tag-natural-water,
+path.stroke.tag-landuse-basin,
+path.stroke.tag-landuse-reservoir {
     stroke: rgb(119, 211, 222);
 }
+path.fill.tag-landuse-basin,
+path.fill.tag-landuse-reservoir,
 path.fill.tag-natural-water {
+    stroke: rgba(119, 211, 222, 0.3);
     fill: rgba(119, 211, 222, 0.3);
 }
+.preset-icon-fill-area.tag-landuse-basin,
+.preset-icon-fill-area.tag-landuse-reservoir,
 .preset-icon-fill-area.tag-natural-water {
     border-color: rgb(119, 211, 222);
     background-color: rgba(119, 211, 222, 0.3);
@@ -385,6 +428,7 @@ path.fill.tag-amenity-kindergarten,
 path.fill.tag-amenity-school,
 path.fill.tag-amenity-college,
 path.fill.tag-amenity-university {
+    stroke: rgba(255, 255, 148, 0.15);
     fill: rgba(255, 255, 148, 0.15);
 }
 .preset-icon-fill-area.tag-amenity-childcare,
@@ -396,48 +440,12 @@ path.fill.tag-amenity-university {
     background-color: rgba(255, 255, 148, 0.15);
 }
 
-path.stroke.tag-landuse,
-path.stroke.tag-natural-wood,
-path.stroke.tag-natural-tree,
-path.stroke.tag-natural-grassland,
-path.stroke.tag-natural-grass,
-path.stroke.tag-leisure-pitch,
-path.stroke.tag-leisure-park {
-    stroke: rgb(140, 208, 95);
-}
-path.fill.tag-landuse,
-path.fill.tag-natural-wood,
-path.fill.tag-natural-tree,
-path.fill.tag-natural-grassland,
-path.fill.tag-natural-grass,
-path.fill.tag-leisure-pitch,
-path.fill.tag-leisure-park {
-    fill: rgba(140, 208, 95, 0.2);
-}
-.preset-icon-fill-area.tag-landuse,
-.preset-icon-fill-area.tag-natural-wood,
-.preset-icon-fill-area.tag-natural-tree,
-.preset-icon-fill-area.tag-natural-grassland,
-.preset-icon-fill-area.tag-natural-grass,
-.preset-icon-fill-area.tag-leisure-pitch,
-.preset-icon-fill-area.tag-leisure-park {
-    border-color: rgb(140, 208, 95);
-    background-color: rgba(140, 208, 95, 0.2);
-}
-
-path.fill.tag-landuse-residential,
-path.fill.tag-landuse-retail,
-path.fill.tag-landuse-commercial,
-path.fill.tag-landuse-industrial {
-    fill: none;
-    stroke-width: 60px;
-}
-
 path.stroke.tag-landuse-residential {
     stroke: rgb(196, 189, 25);
 }
 path.fill.tag-landuse-residential {
     stroke: rgba(196, 189, 25, 0.3);
+    fill: rgba(196, 189, 25, 0.3);
 }
 .preset-icon-fill-area.tag-landuse-residential {
     border-color: rgb(196, 189, 25);
@@ -452,6 +460,7 @@ path.stroke.tag-landuse-commercial {
 path.fill.tag-landuse-retail,
 path.fill.tag-landuse-commercial {
     stroke: rgba(214, 136, 26, 0.3);
+    fill: rgba(214, 136, 26, 0.3);
 }
 .preset-icon-fill-area.tag-landuse-retail,
 .preset-icon-fill-area.tag-landuse-commercial {
@@ -465,6 +474,7 @@ path.stroke.tag-landuse-industrial {
 }
 path.fill.tag-landuse-industrial {
     stroke: rgba(228, 164, 245, 0.3);
+    fill: rgba(228, 164, 245, 0.3);
 }
 .preset-icon-fill-area.tag-landuse-industrial {
     border-color: rgb(228, 164, 245);
@@ -472,24 +482,11 @@ path.fill.tag-landuse-industrial {
     box-shadow: inset 0 0 0 5px rgba(228, 164, 245, 0.3);
 }
 
-path.stroke.tag-landuse-basin,
-path.stroke.tag-landuse-reservoir {
-    stroke: rgb(119, 211, 222);
-}
-path.fill.tag-landuse-basin,
-path.fill.tag-landuse-reservoir {
-    fill: rgba(119, 211, 222, 0.3);
-}
-.preset-icon-fill-area.tag-landuse-basin,
-.preset-icon-fill-area.tag-landuse-reservoir {
-    border-color: rgb(119, 211, 222);
-    background-color: rgba(119, 211, 222, 0.3);
-}
-
 path.stroke.tag-landuse-quarry {
     stroke: rgb(166, 149, 123);
 }
 path.fill.tag-landuse-quarry {
+    stroke: rgba(166, 149, 123, 0.2);
     fill: rgba(166, 149, 123, 0.2);
 }
 .preset-icon-fill-area.tag-landuse-quarry {
@@ -501,6 +498,7 @@ path.stroke.tag-landuse-landfill {
     stroke: rgb(255, 153, 51);
 }
 path.fill.tag-landuse-landfill {
+    stroke: rgba(255, 153, 51, 0.2);
     fill: rgba(255, 153, 51, 0.2);
 }
 .preset-icon-fill-area.tag-landuse-landfill {
@@ -508,12 +506,12 @@ path.fill.tag-landuse-landfill {
     background-color: rgba(255, 153, 51, 0.2);
 }
 
-path.stroke.tag-landuse-construction {
-    stroke: rgb(196, 189, 25);
-}
 .pattern-color-construction {
     fill: rgba(196, 189, 25, 0.2);
 }
+path.stroke.tag-landuse-construction {
+    stroke: rgb(196, 189, 25);
+}
 .preset-icon-fill-area.tag-landuse-construction {
     border-color: rgb(196, 189, 25);
     background-color: rgba(196, 189, 25, 0.2);
@@ -522,50 +520,54 @@ path.stroke.tag-landuse-construction {
 path.stroke.tag-landuse-military {
     stroke: rgb(214, 136, 26);
 }
+path.fill.tag-landuse-military {
+    stroke: rgba(214, 136, 26, 0.2);
+    fill: rgba(214, 136, 26, 0.2);
+}
 .preset-icon-fill-area.tag-landuse-military {
     border-color: rgb(214, 136, 26);
     background-color: rgba(214, 136, 26, 0.2);
 }
 
-path.stroke.tag-natural-wetland {
-    stroke: rgb(182, 225, 153);
-}
 .pattern-color-wetland {
     fill: rgba(182, 225, 153, 0.2);
 }
+path.stroke.tag-natural-wetland {
+    stroke: rgb(182, 225, 153);
+}
 .preset-icon-fill-area.tag-natural-wetland {
     border-color: rgb(182, 225, 153);
     background-color: rgba(182, 225, 153, 0.2);
 }
 
-path.stroke.tag-landuse-meadow {
-    stroke: rgb(182, 225, 153);
-}
 .pattern-color-meadow {
     fill: rgba(182, 225, 153, 0.2);
 }
+path.stroke.tag-landuse-meadow {
+    stroke: rgb(182, 225, 153);
+}
 .preset-icon-fill-area.tag-landuse-meadow {
     border-color: rgb(182, 225, 153);
     background-color: rgba(182, 225, 153, 0.2);
 }
 
-path.stroke.tag-natural-beach {
-    stroke: rgb(255, 255, 126);
-}
 .pattern-color-beach {
     fill: rgba(255, 255, 126, 0.2);
 }
+path.stroke.tag-natural-beach {
+    stroke: rgb(255, 255, 126);
+}
 .preset-icon-fill-area.tag-natural-beach {
     border-color: rgb(255, 255, 126);
     background-color: rgba(255, 255, 126, 0.2);
 }
 
-path.stroke.tag-natural-scrub {
-    stroke: rgb(219, 240, 139);
-}
 .pattern-color-scrub {
     fill: rgba(219, 240, 139, 0.2);
 }
+path.stroke.tag-natural-scrub {
+    stroke: rgb(219, 240, 139);
+}
 .preset-icon-fill-area.tag-natural-scrub {
     border-color: rgb(219, 240, 139);
     background-color: rgba(219, 240, 139, 0.2);
@@ -575,29 +577,33 @@ path.stroke.tag-natural-scrub {
 .pattern-color-farmland {
     fill: rgba(140, 208, 95, 0.2);
 }
+path.stroke.tag-landuse-farm,
+path.stroke.tag-landuse-farmland {
+    stroke: rgb(140, 208, 95);
+}
 .preset-icon-fill-area.tag-landuse-farm,
 .preset-icon-fill-area.tag-landuse-farmland {
     background-color: rgba(140, 208, 95, 0.2);
 }
 
-.pattern-color-cemetery {
-    fill: rgba(140, 208, 95, 0.2)
-}
-.preset-icon-fill-area.tag-landuse-cemetery {
-    background-color: rgba(140, 208, 95, 0.2);
-}
-
+.pattern-color-cemetery,
 .pattern-color-orchard {
-    fill: rgba(140, 208, 95, 0.2)
+    fill: rgba(140, 208, 95, 0.2);
+}
+path.stroke.tag-landuse-cemetery,
+path.stroke.tag-landuse-orchard {
+    stroke: rgb(140, 208, 95);
 }
+.preset-icon-fill-area.tag-landuse-cemetery,
 .preset-icon-fill-area.tag-landuse-orchard {
-    background-color: rgba(140, 208, 95, 0.8);
+    background-color: rgba(140, 208, 95, 0.2);
 }
 
 path.stroke.tag-amenity-parking {
     stroke: rgb(170, 170, 170);
 }
 path.fill.tag-amenity-parking {
+    stroke: rgba(170, 170, 170, 0.3);
     fill: rgba(170, 170, 170, 0.3);
 }
 .preset-icon-fill-area.tag-amenity-parking {
@@ -717,18 +723,18 @@ path.casing.tag-highway-living_street {
     stroke-width:6;
 }
 
-path.stroke.line.tag-highway-pedestrian {
+path.stroke.tag-highway-pedestrian {
     stroke:#fff;
     stroke-dasharray: 2, 8;
-    stroke-width:4 !important;
-    shapeRendering: auto;
+    stroke-width:4;
 }
-path.casing.line.tag-highway-pedestrian {
+path.casing.tag-highway-pedestrian {
     stroke:#8cd05f;
-    stroke-width:6 !important;
+    stroke-width:6;
 }
 path.stroke.area.tag-highway-pedestrian {
     stroke:#fff;
+    stroke-dasharray: none;
     stroke-width: 2;
 }
 
@@ -842,12 +848,14 @@ path.casing.tag-aeroway-runway {
     stroke-linecap: square;
 }
 path.fill.tag-aeroway-runway {
+    stroke: rgba(0, 0, 0, 0.6);
     fill: rgba(0, 0, 0, 0.6);
 }
 path.stroke.tag-aeroway-apron {
     stroke: #805C80;
 }
 path.fill.tag-aeroway-apron {
+    stroke: rgba(128, 92, 128, 0.2);
     fill: rgba(128, 92, 128, 0.2);
 }
 
@@ -901,6 +909,7 @@ path.casing.tag-railway-platform {
 /* waterways */
 
 path.fill.tag-waterway {
+    stroke: rgba(119, 211, 222, 0.3);
     fill: rgba(119, 211, 222, 0.3);
 }
 
@@ -1035,8 +1044,6 @@ path.shadow.tag-highway-bridleway.tag-bridge {
     stroke-width: 13;
 }
 
-
-
 /* tunnels */
 
 path.stroke.tag-tunnel {
@@ -1116,6 +1123,7 @@ path.stroke.tag-amenity-shelter {
 }
 path.fill.tag-building,
 path.fill.tag-amenity-shelter {
+    stroke: rgba(224, 110, 95, 0.3);
     fill: rgba(224, 110, 95, 0.3);
 }
 .preset-icon-fill-area.tag-building,
@@ -1291,16 +1299,18 @@ g.turn circle {
 }
 
 /* GPX Paths */
+div.layer-gpx {
+    pointer-events: none;
+}
+
 path.gpx {
     stroke: #FF26D4;
     stroke-width: 2;
     fill: none;
-    pointer-events: none;
 }
 
-/* GPS Labels */
 text.gpx {
-    fill:#FF26D4;
+    fill: #FF26D4;
 }
 
 /* Mapillary Layer */
@@ -1356,6 +1366,42 @@ text.gpx {
 .mode-drag-node .area.fill {
     pointer-events: none;
 }
+
+
+/* Fill Styles */
+.low-zoom.fill-wireframe path.stroke,
+.fill-wireframe path.stroke {
+    stroke-width: 1;
+    stroke-opacity: 0.5;
+    stroke-dasharray: none;
+    fill: none;
+}
+
+.low-zoom.fill-wireframe path.shadow,
+.fill-wireframe path.shadow {
+    stroke-width: 8;
+}
+
+.fill-wireframe path.shadow.hover:not(.selected) {
+    stroke-opacity: 0.2;
+}
+.fill-wireframe path.shadow.selected {
+    stroke-opacity: 0.4;
+}
+
+.fill-wireframe .point,
+.fill-wireframe .icon,
+.fill-wireframe path.casing,
+.fill-wireframe path.fill,
+.fill-wireframe path.oneway {
+    display: none;
+}
+
+.fill-partial path.fill {
+    fill-opacity: 0;
+    stroke-width: 60px;
+    pointer-events: visibleStroke;
+}
 /* Basics
 ------------------------------------------------------- */
 
@@ -1633,18 +1679,6 @@ ul li { list-style: none;}
     background: #E8EBFF;
 }
 
-.link-list li {
-    float: right;
-    border-left: 1px solid rgba(255,255,255,.5);
-    padding: 5px 0 5px 5px;
-    margin-left: 5px;
-}
-
-ul.link-list li:last-child {
-    border-left: 0;
-    margin-left: 0;
-    padding-left: 0;
-}
 
 /* Utility Classes
 ------------------------------------------------------- */
@@ -1674,7 +1708,8 @@ ul.link-list li:last-child {
 div.hide,
 form.hide,
 button.hide,
-a.hide {
+a.hide,
+li.hide {
     display: none;
 }
 
@@ -1897,6 +1932,7 @@ button.save.has-count .count::before {
 .icon.relation.route         { background-position: -540px 0;}
 .icon.relation.multipolygon  { background-position: -560px 0;}
 .icon.vertex     { background-position: -580px 0;}
+.icon.data       { background-position: -600px 0;}
 
 .icon.inspect.light    { background-position: -220px -20px;}
 .icon.plus.light       { background-position: -240px -20px;}
@@ -1909,6 +1945,7 @@ button.save.has-count .count::before {
 .icon.geolocate.light  { background-position: -360px -20px;}
 .icon.bug.light        { background-position: -400px -20px;}
 .icon.help.light       { background-position: -460px -20px;}
+.icon.data.light       { background-position: -600px -20px;}
 
 .icon.back.blue        { background-position: -420px -20px;}
 .icon.forward.blue     { background-position: -440px -20px;}
@@ -1930,6 +1967,7 @@ button[disabled] .icon.geocode    { background-position: -280px -40px;}
 button[disabled] .icon.layers     { background-position: -300px -40px;}
 button[disabled] .icon.avatar     { background-position: -320px -40px;}
 button[disabled] .icon.nearby     { background-position: -340px -40px;}
+button[disabled] .icon.data       { background-position: -600px -40px;}
 
 .icon.point.deleted  { background-position: -302px -80px;}
 .icon.line.deleted   { background-position: -320px -80px;}
@@ -2360,7 +2398,7 @@ a:hover .icon.out-link   { background-position: -500px -14px;}
 
 .inspector-preset .preset-form {
     padding: 10px;
-    margin: 0 10px 20px 10px;
+    margin: 0 10px 10px 10px;
     border-radius: 8px;
 }
 
@@ -2494,7 +2532,7 @@ a:hover .icon.out-link   { background-position: -500px -14px;}
 .inspector-hover .entity-editor-pane .header button,
 .inspector-hover .spin-control,
 .inspector-hover .hide-toggle:before,
-.inspector-hover .more-buttons,
+.inspector-hover .more-fields,
 .inspector-hover .form-label-button-wrap,
 .inspector-hover .tag-reference-button,
 .inspector-hover .view-on-osm {
@@ -2519,9 +2557,9 @@ a:hover .icon.out-link   { background-position: -500px -14px;}
     border-bottom-left-radius: 4px;
 }
 
-.inspector-hover .inspector-body .more-buttons {
+.inspector-hover .more-fields {
     max-height: 0;
-    padding-bottom: 0;
+    margin-bottom: -10px;
 }
 
 /* Unstyle button fields */
@@ -2589,7 +2627,7 @@ input,
 .entity-editor-pane .header button,
 .toggle-list label span,
 .spin-control,
-.more-buttons,
+.more-fields,
 .view-on-osm,
 .hide-toggle:before,
 .entity-editor-pane .toggle-list label::before,
@@ -2623,75 +2661,17 @@ input,
 
 /* adding additional preset fields */
 
-.inspector-body .more-buttons {
-    max-height: 100px;
-    padding-top: 0;
+.more-fields {
+    padding: 0 20px 20px 20px;
+    font-weight: bold;
     -webkit-transition: padding 200ms 200ms, max-height 200ms 200ms;
        -moz-transition: padding 200ms 200ms, max-height 200ms 200ms;
          -o-transition: padding 200ms 200ms, max-height 200ms 200ms;
             transition: padding 200ms 200ms, max-height 200ms 200ms;
 }
 
-button.preset-add-field {
-    background: #f6f6f6;
-    width: 25%;
-    height: 40px;
-    -webkit-transition: width 200ms;
-       -moz-transition: width 200ms;
-         -o-transition: width 200ms;
-            transition: width 200ms;
-}
-
-button.preset-add-field:hover {
-    background: #ececec;
-}
-
-/* set width based on # of buttons */
-
-button.preset-add-field:only-child {
-    width: 100%;
-}
-
-button.preset-add-field:nth-last-child(2),
-button.preset-add-field:nth-last-child(2) ~ button.preset-add-field {
-    width: 50%;
-}
-
-button.preset-add-field:nth-last-child(3),
-button.preset-add-field:nth-last-child(3) ~ button.preset-add-field {
-    width: 33.3333%;
-}
-
-button.preset-add-field:nth-last-child(4),
-button.preset-add-field:nth-last-child(4) ~ button.preset-add-field {
-    width: 25%;
-}
-
-button.preset-add-field:nth-last-child(5),
-button.preset-add-field:nth-last-child(5) ~ button.preset-add-field {
-    width: 20%;
-}
-
-button.preset-add-field:nth-last-child(6),
-button.preset-add-field:nth-last-child(6) ~ button.preset-add-field {
-    width: 16.6666%;
-}
-
-button.preset-add-field:nth-last-child(7),
-button.preset-add-field:nth-last-child(7) ~ button.preset-add-field {
-    width: 14.2857%;
-}
-
-button.preset-add-field:nth-last-child(8),
-button.preset-add-field:nth-last-child(8) ~ button.preset-add-field {
-    width: 12.5%;
-}
-
-.preset-fav button.fav {
-    height: 30px;
-    margin: 5px;
-    padding: 0 10px;
-}
+.more-fields label { padding: 5px 10px 5px 0; }
+.more-fields input { width: 50%;}
 
 /* preset form access */
 
@@ -3244,12 +3224,18 @@ img.wiki-image {
     border-radius: 4px 0 0 0;
 }
 
-/* Background Settings */
+/* Background / Map Data Settings */
+
+
+.map-data-control button {
+    border-radius: 0;
+}
 
 .background-control button {
     border-radius: 4px 0 0 0;
 }
 
+.map-data-control,
 .background-control {
     position: relative;
 }
@@ -3262,7 +3248,8 @@ img.wiki-image {
     border: 0;
 }
 
-.background-control .hide-toggle  {
+.map-data-control .hide-toggle,
+.background-control .hide-toggle {
     padding-bottom: 10px;
 }
 
@@ -3407,6 +3394,8 @@ img.wiki-image {
     z-index: 9999;
 }
 
+.map-data-control li:hover .select-box,
+.map-data-control li.selected .select-box,
 .background-control li:hover .select-box,
 .background-control li.selected .select-box {
     border: 2px solid #7092ff;
@@ -3414,6 +3403,8 @@ img.wiki-image {
     opacity: .5;
 }
 
+.map-data-control li.selected:hover .select-box,
+.map-data-control li.selected .select-box,
 .background-control li.selected:hover .select-box,
 .background-control li.selected .select-box {
     opacity: 1;
@@ -3426,6 +3417,7 @@ img.wiki-image {
     height:18px;
 }
 
+.map-data-control .layer-list button,
 .background-control .layer-list button {
     float: right;
     height: 100%;
@@ -3434,14 +3426,23 @@ img.wiki-image {
     border-radius: 0;
 }
 
+.map-data-control .layer-list button .icon,
 .background-control .layer-list button .icon {
     opacity: 0.5;
 }
 
+.map-data-control .layer-list button:first-of-type,
 .background-control .layer-list button:first-of-type {
     border-radius: 0 3px 3px 0;
 }
 
+.map-data-control .map-overlay,
+.background-control .map-overlay,
+.help-control .map-overlay {
+    z-index: -1;
+}
+
+
 /* Geolocator */
 
 .geolocate-control {
@@ -3461,9 +3462,6 @@ img.wiki-image {
     overflow: auto;
 }
 
-.background-control .map-overlay {
-    z-index: -1;
-}
 /* Help */
 
 .help-control button {
@@ -3582,20 +3580,49 @@ img.wiki-image {
 /* About Section
 ------------------------------------------------------- */
 
-#footer {
+#about {
     width: 100%;
     position: absolute;
     right:0;
     bottom:0;
     border-radius: 0;
-    opacity: .625;
-    -webkit-transition: opacity 200ms;
-    -moz-transition: opacity 200ms;
-    transition: opacity 200ms;
 }
 
-#footer:hover {
-    opacity: 1;
+#attrib {
+    width: 100%;
+    height: 20px;
+    float: left;
+    clear: both;
+}
+
+.base-layer-attribution,
+.overlay-layer-attribution {
+    position: absolute;
+    color: #888;
+    font-size: 10px;
+}
+
+.base-layer-attribution {
+    left: 10px;
+}
+
+.overlay-layer-attribution {
+    right: 10px;
+}
+
+.overlay-layer-attribution .attribution:not(:last-child):after {
+    content: '; ';
+}
+
+.source-image {
+    height:20px;
+    vertical-align:top;
+}
+
+#footer {
+    width: 100%;
+    float: left;
+    clear: both;
 }
 
 #scale-block {
@@ -3637,6 +3664,19 @@ img.wiki-image {
     clear: right;
 }
 
+#about-list li {
+    float: right;
+    border-left: 1px solid rgba(255,255,255,.5);
+    padding: 5px 0 5px 5px;
+    margin-left: 5px;
+}
+
+#about-list li:last-child {
+    border-left: 0;
+    margin-left: 0;
+    padding-left: 0;
+}
+
 .source-switch a {
     padding: 2px 4px 4px 4px;
     border-radius: 2px;
@@ -3646,30 +3686,11 @@ img.wiki-image {
     color:#fff;
 }
 
-/* Attribution overlay */
-.base-layer-attribution,
-.overlay-layer-attribution {
-    position: absolute;
-    bottom: 35px;
-    color: #888;
-    font-size: 10px;
-}
-
-.base-layer-attribution {
-    left: 10px;
-}
-
-.overlay-layer-attribution {
-    right: 10px;
-}
-
-.overlay-layer-attribution .attribution:not(:last-child):after {
-    content: '; ';
-}
-
-.source-image {
-    height:20px;
-    vertical-align:top;
+.feature-warning a {
+    background: #1e90ff;
+    padding: 2px 4px 4px 4px;
+    border-radius: 2px;
+    color: #eee;
 }
 
 .user-list a:not(:last-child):after {
@@ -3681,13 +3702,13 @@ img.wiki-image {
     clear: both;
     text-align: right;
     width: 100%;
+    padding: 0px 5px;
 }
 
 .api-status.offline,
 .api-status.readonly,
 .api-status.error {
     background: red;
-    padding: 0px 5px;
 }
 
 /* Modals
@@ -3986,6 +4007,7 @@ img.wiki-image {
 
 .tooltip-inner {
     display: inline-block;
+    border-radius: 3px;
     max-width: 200px;
     min-width: 80px;
     padding: 10px;
@@ -4018,6 +4040,7 @@ img.wiki-image {
 }
 
 .tail div {
+    border-radius: 3px;
     padding: 10px;
     background: white;
     position: absolute;
@@ -4085,6 +4108,7 @@ img.wiki-image {
     background: #F6F6F6;
     padding: 10px;
     margin: 10px -10px -10px;
+    border-radius: 0 0 3px 3px;
 }
 
 .tooltip-inner .keyhint {
@@ -4140,6 +4164,7 @@ img.wiki-image {
 }
 
 .map-overlay .tooltip-inner,
+.map-overlay .keyhint-wrap,
 .entity-editor-pane .tooltip-inner,
 .warning-section .tooltip-inner {
     background: #000;
@@ -4210,6 +4235,19 @@ img.wiki-image {
     #bar .save .label { display: block;}
 }
 
+@media screen and (max-width: 1200px) {
+    .user-list { display: none !important; }
+}
+
+@media screen and (max-width: 1000px) {
+    #userLink { display: none !important; }
+}
+
+@media screen and (max-width: 900px) {
+    #scale-block { display: none !important; }
+}
+
+
 /* Scrollbars
  ----------------------------------------------------- */
 
index e38326bb73d2f44b45e6e578a1a7515fed7be962..4d1d147775c85c970273a0c9b1aea1d417698a15 100644 (file)
@@ -16193,6 +16193,16 @@ window.iD = function () {
         }
     };
 
+    /* Accessor for setting minimum zoom for editing features. */
+
+    var minEditableZoom = 16;
+    context.minEditableZoom = function(_) {
+        if (!arguments.length) return minEditableZoom;
+        minEditableZoom = _;
+        connection.tileZoom(_);
+        return context;
+    };
+
     var history = iD.History(context),
         dispatch = d3.dispatch('enter', 'exit'),
         mode,
@@ -16260,6 +16270,7 @@ window.iD = function () {
 
     context.flush = function() {
         connection.flush();
+        features.reset();
         history.reset();
         return context;
     };
@@ -16346,9 +16357,6 @@ window.iD = function () {
         });
     };
 
-    context.editable = function() {
-        return map.editable() && mode && mode.id !== 'save';
-    };
 
     /* Behaviors */
     context.install = function(behavior) {
@@ -16359,6 +16367,14 @@ window.iD = function () {
         context.surface().call(behavior.off);
     };
 
+    /* Copy/Paste */
+    var copiedIDs = [];
+    context.copiedIDs = function(_) {
+        if (!arguments.length) return copiedIDs;
+        copiedIDs = _;
+        return context;
+    };
+
     /* Projection */
     context.projection = iD.geo.RawMercator();
 
@@ -16366,11 +16382,21 @@ window.iD = function () {
     var background = iD.Background(context);
     context.background = function() { return background; };
 
+    /* Features */
+    var features = iD.Features(context);
+    context.features = function() { return features; };
+    context.hasHiddenConnections = function(id) {
+        var graph = history.graph(),
+            entity = graph.entity(id);
+        return features.hasHiddenConnections(entity, graph);
+    };
+
     /* Map */
     var map = iD.Map(context);
     context.map = function() { return map; };
     context.layers = function() { return map.layers; };
     context.surface = function() { return map.surface; };
+    context.editable = function() { return map.editable(); };
     context.mouse = map.mouse;
     context.extent = map.extent;
     context.pan = map.pan;
@@ -16385,11 +16411,18 @@ window.iD = function () {
     };
 
     /* Presets */
-    var presets = iD.presets()
-        .load(iD.data.presets);
+    var presets = iD.presets();
 
-    context.presets = function() {
-        return presets;
+    context.presets = function(_) {
+        if (!arguments.length) return presets;
+        presets.load(_);
+        iD.areaKeys = presets.areaKeys();
+        return context;
+    };
+
+    context.imagery = function(_) {
+        background.load(_);
+        return context;
     };
 
     context.container = function(_) {
@@ -16399,6 +16432,14 @@ window.iD = function () {
         return context;
     };
 
+    /* Taginfo */
+    var taginfo;
+    context.taginfo = function(_) {
+        if (!arguments.length) return taginfo;
+        taginfo = _;
+        return context;
+    };
+
     var embed = false;
     context.embed = function(_) {
         if (!arguments.length) return embed;
@@ -16428,7 +16469,7 @@ window.iD = function () {
     return d3.rebind(context, dispatch, 'on');
 };
 
-iD.version = '1.6.2';
+iD.version = '1.6.3';
 
 (function() {
     var detected = {};
@@ -17154,6 +17195,13 @@ iD.geo.Extent = function geoExtent(min, max) {
 iD.geo.Extent.prototype = new Array(2);
 
 _.extend(iD.geo.Extent.prototype, {
+    equals: function (obj) {
+        return this[0][0] === obj[0][0] &&
+            this[0][1] === obj[0][1] &&
+            this[1][0] === obj[1][0] &&
+            this[1][1] === obj[1][1];
+    },
+
     extend: function(obj) {
         if (!(obj instanceof iD.geo.Extent)) obj = new iD.geo.Extent(obj);
         return iD.geo.Extent([Math.min(obj[0][0], this[0][0]),
@@ -17876,6 +17924,25 @@ iD.actions.Connect = function(nodeIds) {
         return graph;
     };
 };
+iD.actions.CopyEntity = function(entity, deep) {
+    var newEntities = [];
+
+    var action = function(graph) {
+        newEntities = entity.copy(deep, graph);
+
+        for (var i = 0; i < newEntities.length; i++) {
+            graph = graph.replace(newEntities[i]);
+        }
+
+        return graph;
+    };
+
+    action.newEntities = function() {
+        return newEntities;
+    };
+
+    return action;
+};
 iD.actions.DeleteMember = function(relationId, memberIndex) {
     return function(graph) {
         var relation = graph.entity(relationId)
@@ -19134,6 +19201,84 @@ iD.behavior.AddWay = function(context) {
 
     return d3.rebind(addWay, event, 'on');
 };
+iD.behavior.Copy = function(context) {
+    var keybinding = d3.keybinding('copy');
+
+    function groupEntities(ids, graph) {
+        var entities = ids.map(function (id) { return graph.entity(id); });
+        return _.extend({relation: [], way: [], node: []},
+            _.groupBy(entities, function(entity) { return entity.type; }));
+    }
+
+    function getDescendants(id, graph, descendants) {
+        var entity = graph.entity(id),
+            i, children;
+
+        descendants = descendants || {};
+
+        if (entity.type === 'relation') {
+            children = _.pluck(entity.members, 'id');
+        } else if (entity.type === 'way') {
+            children = entity.nodes;
+        } else {
+            children = [];
+        }
+
+        for (i = 0; i < children.length; i++) {
+            if (!descendants[children[i]]) {
+                descendants[children[i]] = true;
+                descendants = getDescendants(children[i], graph, descendants);
+            }
+        }
+
+        return descendants;
+    }
+
+    function doCopy() {
+        d3.event.preventDefault();
+
+        var graph = context.graph(),
+            selected = groupEntities(context.selectedIDs(), graph),
+            canCopy = [],
+            skip = {},
+            i, entity;
+
+        for (i = 0; i < selected.relation.length; i++) {
+            entity = selected.relation[i];
+            if (!skip[entity.id] && entity.isComplete(graph)) {
+                canCopy.push(entity.id);
+                skip = getDescendants(entity.id, graph, skip);
+            }
+        }
+        for (i = 0; i < selected.way.length; i++) {
+            entity = selected.way[i];
+            if (!skip[entity.id]) {
+                canCopy.push(entity.id);
+                skip = getDescendants(entity.id, graph, skip);
+            }
+        }
+        for (i = 0; i < selected.node.length; i++) {
+            entity = selected.node[i];
+            if (!skip[entity.id]) {
+                canCopy.push(entity.id);
+            }
+        }
+
+        context.copiedIDs(canCopy);
+    }
+
+    function copy() {
+        keybinding.on(iD.ui.cmd('⌘C'), doCopy);
+        d3.select(document).call(keybinding);
+        return copy;
+    }
+
+    copy.off = function() {
+        d3.select(document).call(keybinding.off);
+    };
+
+    return copy;
+};
 /*
     `iD.behavior.drag` is like `d3.behavior.drag`, with the following differences:
 
@@ -19680,7 +19825,7 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
 iD.behavior.Edit = function(context) {
     function edit() {
         context.map()
-            .minzoom(16);
+            .minzoom(context.minEditableZoom());
     }
 
     edit.off = function() {
@@ -19975,6 +20120,81 @@ iD.behavior.Lasso = function(context) {
 
     return behavior;
 };
+iD.behavior.Paste = function(context) {
+    var keybinding = d3.keybinding('paste');
+
+    function omitTag(v, k) {
+        return (
+            k === 'phone' ||
+            k === 'fax' ||
+            k === 'email' ||
+            k === 'website' ||
+            k === 'url' ||
+            k === 'note' ||
+            k === 'description' ||
+            k.indexOf('name') !== -1 ||
+            k.indexOf('wiki') === 0 ||
+            k.indexOf('addr:') === 0 ||
+            k.indexOf('contact:') === 0
+        );
+    }
+
+    function doPaste() {
+        d3.event.preventDefault();
+
+        var mouse = context.mouse(),
+            projection = context.projection,
+            viewport = iD.geo.Extent(projection.clipExtent()).polygon();
+
+        if (!iD.geo.pointInPolygon(mouse, viewport)) return;
+
+        var graph = context.graph(),
+            extent = iD.geo.Extent(),
+            oldIDs = context.copiedIDs(),
+            newIDs = [],
+            i, j;
+
+        for (i = 0; i < oldIDs.length; i++) {
+            var oldEntity = graph.entity(oldIDs[i]),
+                action = iD.actions.CopyEntity(oldEntity, true),
+                newEntities;
+
+            extent._extend(oldEntity.extent(graph));
+            context.perform(action);
+
+            // First element in `newEntities` contains the copied Entity,
+            // Subsequent array elements contain any descendants..
+            newEntities = action.newEntities();
+            newIDs.push(newEntities[0].id);
+
+            for (j = 0; j < newEntities.length; j++) {
+                var newEntity = newEntities[j],
+                    tags = _.omit(newEntity.tags, omitTag);
+
+                context.perform(iD.actions.ChangeTags(newEntity.id, tags));
+            }
+        }
+
+        // Put pasted objects where mouse pointer is..
+        var center = projection(extent.center()),
+            delta = [ mouse[0] - center[0], mouse[1] - center[1] ];
+
+        context.perform(iD.actions.Move(newIDs, delta, projection));
+        context.enter(iD.modes.Move(context, newIDs));
+    }
+
+    function paste() {
+        keybinding.on(iD.ui.cmd('⌘V'), doPaste);
+        d3.select(document).call(keybinding);
+        return paste;
+    }
+
+    paste.off = function() {
+        d3.select(document).call(keybinding.off);
+    };
+
+    return paste;
+};
 iD.behavior.Select = function(context) {
     function keydown() {
         if (d3.event && d3.event.shiftKey) {
@@ -20310,6 +20530,7 @@ iD.modes.Browse = function(context) {
     }, sidebar;
 
     var behaviors = [
+        iD.behavior.Paste(context),
         iD.behavior.Hover(context)
             .on('hover', context.ui().sidebar.hover),
         iD.behavior.Select(context),
@@ -20401,7 +20622,9 @@ iD.modes.DragNode = function(context) {
     }
 
     function start(entity) {
-        cancelled = d3.event.sourceEvent.shiftKey;
+        cancelled = d3.event.sourceEvent.shiftKey ||
+            context.features().hasHiddenConnections(entity, context.graph());
+
         if (cancelled) return behavior.cancel();
 
         wasMidpoint = entity.type === 'midpoint';
@@ -20931,6 +21154,8 @@ iD.modes.Select = function(context, selectedIDs) {
     var keybinding = d3.keybinding('select'),
         timeout = null,
         behaviors = [
+            iD.behavior.Copy(context),
+            iD.behavior.Paste(context),
             iD.behavior.Hover(context),
             iD.behavior.Select(context),
             iD.behavior.Lasso(context),
@@ -20945,26 +21170,43 @@ iD.modes.Select = function(context, selectedIDs) {
     var wrap = context.container()
         .select('.inspector-wrap');
 
+
     function singular() {
         if (selectedIDs.length === 1) {
             return context.entity(selectedIDs[0]);
         }
     }
 
+    function closeMenu() {
+        if (radialMenu) {
+            context.surface().call(radialMenu.close);
+        }
+    }
+
     function positionMenu() {
-        var entity = singular();
+        if (suppressMenu || !radialMenu) { return; }
 
-        if (entity && entity.type === 'node') {
+        var entity = singular();
+        if (entity && context.geometry(entity.id) === 'relation') {
+            suppressMenu = true;
+        } else if (entity && entity.type === 'node') {
             radialMenu.center(context.projection(entity.loc));
         } else {
-            radialMenu.center(context.mouse());
+            var point = context.mouse(),
+                viewport = iD.geo.Extent(context.projection.clipExtent()).polygon();
+            if (iD.geo.pointInPolygon(point, viewport)) {
+                radialMenu.center(point);
+            } else {
+                suppressMenu = true;
+            }
         }
     }
 
     function showMenu() {
-        context.surface()
-            .call(radialMenu.close)
-            .call(radialMenu);
+        closeMenu();
+        if (!suppressMenu && radialMenu) {
+            context.surface().call(radialMenu);
+        }
     }
 
     mode.selectedIDs = function() {
@@ -20994,49 +21236,14 @@ iD.modes.Select = function(context, selectedIDs) {
     };
 
     mode.enter = function() {
-        behaviors.forEach(function(behavior) {
-            context.install(behavior);
-        });
-
-        var operations = _.without(d3.values(iD.operations), iD.operations.Delete)
-            .map(function(o) { return o(selectedIDs, context); })
-            .filter(function(o) { return o.available(); });
-        operations.unshift(iD.operations.Delete(selectedIDs, context));
-
-        keybinding.on('⎋', function() {
-            context.enter(iD.modes.Browse(context));
-        }, true);
-
-        operations.forEach(function(operation) {
-            operation.keys.forEach(function(key) {
-                keybinding.on(key, function() {
-                    if (!operation.disabled()) {
-                        operation();
-                    }
-                });
-            });
-        });
-
-        context.ui().sidebar
-            .select(singular() ? singular().id : null, newFeature);
-
-        context.history()
-            .on('undone.select', update)
-            .on('redone.select', update);
-
         function update() {
-            context.surface().call(radialMenu.close);
-
+            closeMenu();
             if (_.any(selectedIDs, function(id) { return !context.hasEntity(id); })) {
                 // Exit mode if selected entity gets undone
                 context.enter(iD.modes.Browse(context));
             }
         }
 
-        context.map().on('move.select', function() {
-            context.surface().call(radialMenu.close);
-        });
-
         function dblclick() {
             var target = d3.select(d3.event.target),
                 datum = target.datum();
@@ -21057,19 +21264,69 @@ iD.modes.Select = function(context, selectedIDs) {
             }
         }
 
+        function selectElements(drawn) {
+            var entity = singular();
+            if (entity && context.geometry(entity.id) === 'relation') {
+                suppressMenu = true;
+                return;
+            }
+
+            var selection = context.surface()
+                    .selectAll(iD.util.entityOrMemberSelector(selectedIDs, context.graph()));
+
+            if (selection.empty()) {
+                if (drawn) {  // Exit mode if selected DOM elements have disappeared..
+                    context.enter(iD.modes.Browse(context));
+                }
+            } else {
+                selection
+                    .classed('selected', true);
+            }
+        }
+
+
+        behaviors.forEach(function(behavior) {
+            context.install(behavior);
+        });
+
+        var operations = _.without(d3.values(iD.operations), iD.operations.Delete)
+                .map(function(o) { return o(selectedIDs, context); })
+                .filter(function(o) { return o.available(); });
+
+        operations.unshift(iD.operations.Delete(selectedIDs, context));
+
+        keybinding.on('⎋', function() {
+            context.enter(iD.modes.Browse(context));
+        }, true);
+
+        operations.forEach(function(operation) {
+            operation.keys.forEach(function(key) {
+                keybinding.on(key, function() {
+                    if (!operation.disabled()) {
+                        operation();
+                    }
+                });
+            });
+        });
+
         d3.select(document)
             .call(keybinding);
 
-        function selectElements() {
-            context.surface()
-                .selectAll(iD.util.entityOrMemberSelector(selectedIDs, context.graph()))
-                .classed('selected', true);
-        }
+        radialMenu = iD.ui.RadialMenu(context, operations);
+
+        context.ui().sidebar
+            .select(singular() ? singular().id : null, newFeature);
+
+        context.history()
+            .on('undone.select', update)
+            .on('redone.select', update);
+
+        context.map()
+            .on('move.select', closeMenu)
+            .on('drawn.select', selectElements);
 
-        context.map().on('drawn.select', selectElements);
         selectElements();
 
-        radialMenu = iD.ui.RadialMenu(context, operations);
         var show = d3.event && !suppressMenu;
 
         if (show) {
@@ -21101,13 +21358,14 @@ iD.modes.Select = function(context, selectedIDs) {
         });
 
         keybinding.off();
+        closeMenu();
+        radialMenu = undefined;
 
         context.history()
             .on('undone.select', null)
             .on('redone.select', null);
 
         context.surface()
-            .call(radialMenu.close)
             .on('dblclick.select', null)
             .selectAll('.selected')
             .classed('selected', false);
@@ -21141,6 +21399,8 @@ iD.operations.Circularize = function(selectedIDs, context) {
         var reason;
         if (extent.percentContainedIn(context.extent()) < 0.8) {
             reason = 'too_large';
+        } else if (context.hasHiddenConnections(entityId)) {
+            reason = 'connected_to_hidden';
         }
         return action.disabled(context.graph()) || reason;
     };
@@ -21183,7 +21443,8 @@ iD.operations.Continue = function(selectedIDs, context) {
     };
 
     operation.available = function() {
-        return geometries.vertex.length === 1 && geometries.line.length <= 1;
+        return geometries.vertex.length === 1 && geometries.line.length <= 1 &&
+            !context.features().hasHiddenConnections(vertex, context.graph());
     };
 
     operation.disabled = function() {
@@ -21261,7 +21522,11 @@ iD.operations.Delete = function(selectedIDs, context) {
     };
 
     operation.disabled = function() {
-        return action.disabled(context.graph());
+        var reason;
+        if (_.any(selectedIDs, context.hasHiddenConnections)) {
+            reason = 'connected_to_hidden';
+        }
+        return action.disabled(context.graph()) || reason;
     };
 
     operation.tooltip = function() {
@@ -21298,7 +21563,11 @@ iD.operations.Disconnect = function(selectedIDs, context) {
     };
 
     operation.disabled = function() {
-        return action.disabled(context.graph());
+        var reason;
+        if (_.any(selectedIDs, context.hasHiddenConnections)) {
+            reason = 'connected_to_hidden';
+        }
+        return action.disabled(context.graph()) || reason;
     };
 
     operation.tooltip = function() {
@@ -21387,6 +21656,8 @@ iD.operations.Move = function(selectedIDs, context) {
         var reason;
         if (extent.area() && extent.percentContainedIn(context.extent()) < 0.8) {
             reason = 'too_large';
+        } else if (_.any(selectedIDs, context.hasHiddenConnections)) {
+            reason = 'connected_to_hidden';
         }
         return iD.actions.Move(selectedIDs).disabled(context.graph()) || reason;
     };
@@ -21427,6 +21698,8 @@ iD.operations.Orthogonalize = function(selectedIDs, context) {
         var reason;
         if (extent.percentContainedIn(context.extent()) < 0.8) {
             reason = 'too_large';
+        } else if (context.hasHiddenConnections(entityId)) {
+            reason = 'connected_to_hidden';
         }
         return action.disabled(context.graph()) || reason;
     };
@@ -21496,6 +21769,8 @@ iD.operations.Rotate = function(selectedIDs, context) {
     operation.disabled = function() {
         if (extent.percentContainedIn(context.extent()) < 0.8) {
             return 'too_large';
+        } else if (context.hasHiddenConnections(entityId)) {
+            return 'connected_to_hidden';
         } else {
             return false;
         }
@@ -21545,7 +21820,11 @@ iD.operations.Split = function(selectedIDs, context) {
     };
 
     operation.disabled = function() {
-        return action.disabled(context.graph());
+        var reason;
+        if (_.any(selectedIDs, context.hasHiddenConnections)) {
+            reason = 'connected_to_hidden';
+        }
+        return action.disabled(context.graph()) || reason;
     };
 
     operation.tooltip = function() {
@@ -21586,7 +21865,11 @@ iD.operations.Straighten = function(selectedIDs, context) {
     };
 
     operation.disabled = function() {
-        return action.disabled(context.graph());
+        var reason;
+        if (context.hasHiddenConnections(entityId)) {
+            reason = 'connected_to_hidden';
+        }
+        return action.disabled(context.graph()) || reason;
     };
 
     operation.tooltip = function() {
@@ -21602,98 +21885,7 @@ iD.operations.Straighten = function(selectedIDs, context) {
 
     return operation;
 };
-/* jshint -W109 */
-iD.areaKeys = {
-    "aeroway": {
-        "gate": true,
-        "taxiway": true
-    },
-    "amenity": {
-        "atm": true,
-        "bbq": true,
-        "bench": true,
-        "bureau_de_change": true,
-        "clock": true,
-        "drinking_water": true,
-        "parking_entrance": true,
-        "post_box": true,
-        "telephone": true,
-        "vending_machine": true,
-        "waste_basket": true
-    },
-    "area": {},
-    "barrier": {
-        "block": true,
-        "bollard": true,
-        "cattle_grid": true,
-        "cycle_barrier": true,
-        "entrance": true,
-        "fence": true,
-        "gate": true,
-        "kissing_gate": true,
-        "lift_gate": true,
-        "stile": true,
-        "toll_booth": true
-    },
-    "building": {
-        "entrance": true
-    },
-    "craft": {},
-    "emergency": {
-        "fire_hydrant": true,
-        "phone": true
-    },
-    "golf": {
-        "hole": true
-    },
-    "historic": {
-        "boundary_stone": true
-    },
-    "landuse": {},
-    "leisure": {
-        "picnic_table": true,
-        "track": true,
-        "slipway": true
-    },
-    "man_made": {
-        "cutline": true,
-        "embankment": true,
-        "flagpole": true,
-        "pipeline": true,
-        "survey_point": true
-    },
-    "military": {},
-    "natural": {
-        "coastline": true,
-        "peak": true,
-        "spring": true,
-        "tree": true
-    },
-    "office": {},
-    "piste:type": {},
-    "place": {},
-    "power": {
-        "line": true,
-        "minor_line": true,
-        "pole": true,
-        "tower": true
-    },
-    "public_transport": {
-        "stop_position": true
-    },
-    "shop": {},
-    "tourism": {
-        "viewpoint": true
-    },
-    "waterway": {
-        "canal": true,
-        "ditch": true,
-        "drain": true,
-        "river": true,
-        "stream": true,
-        "weir": true
-    }
-};iD.Connection = function() {
+iD.Connection = function() {
 
     var event = d3.dispatch('authenticating', 'authenticated', 'auth', 'loading', 'load', 'loaded'),
         url = 'http://www.openstreetmap.org',
@@ -22316,7 +22508,11 @@ iD.Entity.prototype = {
             var source = sources[i];
             for (var prop in source) {
                 if (Object.prototype.hasOwnProperty.call(source, prop)) {
-                    this[prop] = source[prop];
+                    if (source[prop] === undefined) {
+                        delete this[prop];
+                    } else {
+                        this[prop] = source[prop];
+                    }
                 }
             }
         }
@@ -22337,6 +22533,12 @@ iD.Entity.prototype = {
         return this;
     },
 
+    copy: function() {
+        // Returns an array so that we can support deep copying ways and relations.
+        // The first array element will contain this.copy, followed by any descendants.
+        return [iD.Entity(this, {id: undefined, user: undefined, version: undefined})];
+    },
+
     osmId: function() {
         return iD.Entity.id.toOSM(this.id);
     },
@@ -22457,7 +22659,15 @@ iD.Graph.prototype = {
     },
 
     parentWays: function(entity) {
-        return _.map(this._parentWays[entity.id], this.entity, this);
+        var parents = this._parentWays[entity.id],
+            result = [];
+
+        if (parents) {
+            for (var i = 0, imax = parents.length; i !== imax; i++) {
+                result.push(this.entity(parents[i]));
+            }
+        }
+        return result;
     },
 
     isPoi: function(entity) {
@@ -22471,7 +22681,15 @@ iD.Graph.prototype = {
     },
 
     parentRelations: function(entity) {
-        return _.map(this._parentRels[entity.id], this.entity, this);
+        var parents = this._parentRels[entity.id],
+            result = [];
+
+        if (parents) {
+            for (var i = 0, imax = parents.length; i !== imax; i++) {
+                result.push(this.entity(parents[i]));
+            }
+        }
+        return result;
     },
 
     childNodes: function(entity) {
@@ -22479,8 +22697,10 @@ iD.Graph.prototype = {
             return this._childNodes[entity.id];
 
         var nodes = [];
-        for (var i = 0, l = entity.nodes.length; i < l; i++) {
-            nodes[i] = this.entity(entity.nodes[i]);
+        if (entity.nodes) {
+            for (var i = 0, l = entity.nodes.length; i < l; i++) {
+                nodes[i] = this.entity(entity.nodes[i]);
+            }
         }
 
         if (iD.debug) Object.freeze(nodes);
@@ -22911,7 +23131,9 @@ iD.History = function(context) {
                     // this merges originals for changed entities into the base of
                     // the stack even if the current stack doesn't have them (for
                     // example when iD has been restarted in a different region)
-                    var baseEntities = h.baseEntities.map(iD.Entity);
+                    var baseEntities = h.baseEntities.map(function(entity) {
+                        return iD.Entity(entity);
+                    });
                     stack[0].graph.rebase(baseEntities, _.pluck(stack, 'graph'));
                     tree.rebase(baseEntities);
                 }
@@ -23120,6 +23342,34 @@ _.extend(iD.Relation.prototype, {
     type: 'relation',
     members: [],
 
+    copy: function(deep, resolver, replacements) {
+        var copy = iD.Entity.prototype.copy.call(this);
+        if (!deep || !resolver || !this.isComplete(resolver)) {
+            return copy;
+        }
+
+        var members = [],
+            i, oldmember, oldid, newid, children;
+
+        replacements = replacements || {};
+        replacements[this.id] = copy[0].id;
+
+        for (i = 0; i < this.members.length; i++) {
+            oldmember = this.members[i];
+            oldid = oldmember.id;
+            newid = replacements[oldid];
+            if (!newid) {
+                children = resolver.entity(oldid).copy(true, resolver, replacements);
+                newid = replacements[oldid] = children[0].id;
+                copy = copy.concat(children);
+            }
+            members.push({id: newid, type: oldmember.type, role: oldmember.role});
+        }
+
+        copy[0] = copy[0].update({members: members});
+        return copy;
+    },
+
     extent: function(resolver, memo) {
         return resolver.transient(this, 'extent', function() {
             if (memo && memo[this.id]) return iD.geo.Extent();
@@ -23455,6 +23705,32 @@ _.extend(iD.Way.prototype, {
     type: 'way',
     nodes: [],
 
+    copy: function(deep, resolver) {
+        var copy = iD.Entity.prototype.copy.call(this);
+
+        if (!deep || !resolver) {
+            return copy;
+        }
+
+        var nodes = [],
+            replacements = {},
+            i, oldid, newid, child;
+
+        for (i = 0; i < this.nodes.length; i++) {
+            oldid = this.nodes[i];
+            newid = replacements[oldid];
+            if (!newid) {
+                child = resolver.entity(oldid).copy();
+                newid = replacements[oldid] = child[0].id;
+                copy = copy.concat(child);
+            }
+            nodes.push(newid);
+        }
+
+        copy[0] = copy[0].update({nodes: nodes});
+        return copy;
+    },
+
     extent: function(resolver) {
         return resolver.transient(this, 'extent', function() {
             var extent = iD.geo.Extent();
@@ -23692,15 +23968,7 @@ iD.Background = function(context) {
         mapillaryLayer = iD.MapillaryLayer(context),
         overlayLayers = [];
 
-    var backgroundSources = iD.data.imagery.map(function(source) {
-        if (source.type === 'bing') {
-            return iD.BackgroundSource.Bing(source, dispatch);
-        } else {
-            return iD.BackgroundSource(source);
-        }
-    });
-
-    backgroundSources.unshift(iD.BackgroundSource.None());
+    var backgroundSources;
 
     function findSource(id) {
         return _.find(backgroundSources, function(d) {
@@ -23757,19 +24025,11 @@ iD.Background = function(context) {
 
         base.call(baseLayer);
 
-        var gpx = selection.selectAll('.gpx-layer')
-            .data([0]);
-
-        gpx.enter().insert('div', '.layer-data')
-            .attr('class', 'layer-layer gpx-layer');
-
-        gpx.call(gpxLayer);
-
-        var overlays = selection.selectAll('.overlay-layer')
+        var overlays = selection.selectAll('.layer-overlay')
             .data(overlayLayers, function(d) { return d.source().name(); });
 
         overlays.enter().insert('div', '.layer-data')
-            .attr('class', 'layer-layer overlay-layer');
+            .attr('class', 'layer-layer layer-overlay');
 
         overlays.each(function(layer) {
             d3.select(this).call(layer);
@@ -23778,6 +24038,14 @@ iD.Background = function(context) {
         overlays.exit()
             .remove();
 
+        var gpx = selection.selectAll('.layer-gpx')
+            .data([0]);
+
+        gpx.enter().insert('div')
+            .attr('class', 'layer-layer layer-gpx');
+
+        gpx.call(gpxLayer);
+
         var mapillary = selection.selectAll('.layer-mapillary')
             .data([0]);
 
@@ -23916,36 +24184,48 @@ iD.Background = function(context) {
         return background;
     };
 
-    var q = iD.util.stringQs(location.hash.substring(1)),
-        chosen = q.background || q.layer;
+    background.load = function(imagery) {
+        backgroundSources = imagery.map(function(source) {
+            if (source.type === 'bing') {
+                return iD.BackgroundSource.Bing(source, dispatch);
+            } else {
+                return iD.BackgroundSource(source);
+            }
+        });
 
-    if (chosen && chosen.indexOf('custom:') === 0) {
-        background.baseLayerSource(iD.BackgroundSource.Custom(chosen.replace(/^custom:/, '')));
-    } else {
-        background.baseLayerSource(findSource(chosen) || findSource('Bing'));
-    }
+        backgroundSources.unshift(iD.BackgroundSource.None());
 
-    var locator = _.find(backgroundSources, function(d) {
-        return d.overlay && d.default;
-    });
+        var q = iD.util.stringQs(location.hash.substring(1)),
+            chosen = q.background || q.layer;
 
-    if (locator) {
-        background.toggleOverlayLayer(locator);
-    }
+        if (chosen && chosen.indexOf('custom:') === 0) {
+            background.baseLayerSource(iD.BackgroundSource.Custom(chosen.replace(/^custom:/, '')));
+        } else {
+            background.baseLayerSource(findSource(chosen) || findSource('Bing') || backgroundSources[1]);
+        }
 
-    var overlays = (q.overlays || '').split(',');
-    overlays.forEach(function(overlay) {
-        overlay = findSource(overlay);
-        if (overlay) background.toggleOverlayLayer(overlay);
-    });
+        var locator = _.find(backgroundSources, function(d) {
+            return d.overlay && d.default;
+        });
 
-    var gpx = q.gpx;
-    if (gpx) {
-        d3.text(gpx, function(err, gpxTxt) {
-            gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt)));
-            dispatch.change();
+        if (locator) {
+            background.toggleOverlayLayer(locator);
+        }
+
+        var overlays = (q.overlays || '').split(',');
+        overlays.forEach(function(overlay) {
+            overlay = findSource(overlay);
+            if (overlay) background.toggleOverlayLayer(overlay);
         });
-    }
+
+        var gpx = q.gpx;
+        if (gpx) {
+            d3.text(gpx, function(err, gpxTxt) {
+                gpxLayer.geojson(toGeoJSON.gpx(toDom(gpxTxt)));
+                dispatch.change();
+            });
+        }
+    };
 
     return d3.rebind(background, dispatch, 'on');
 };
@@ -24094,6 +24374,409 @@ iD.BackgroundSource.Custom = function(template) {
 
     return source;
 };
+iD.Features = function(context) {
+    var major_roads = {
+        'motorway': true,
+        'motorway_link': true,
+        'trunk': true,
+        'trunk_link': true,
+        'primary': true,
+        'primary_link': true,
+        'secondary': true,
+        'secondary_link': true,
+        'tertiary': true,
+        'tertiary_link': true,
+        'residential': true
+    };
+
+    var minor_roads = {
+        'service': true,
+        'living_street': true,
+        'road': true,
+        'unclassified': true,
+        'track': true
+    };
+
+    var paths = {
+        'path': true,
+        'footway': true,
+        'cycleway': true,
+        'bridleway': true,
+        'steps': true,
+        'pedestrian': true
+    };
+
+    var past_futures = {
+        'proposed': true,
+        'construction': true,
+        'abandoned': true,
+        'dismantled': true,
+        'disused': true,
+        'razed': true,
+        'demolished': true,
+        'obliterated': true
+    };
+
+    var dispatch = d3.dispatch('change', 'redraw'),
+        _cullFactor = 1,
+        _cache = {},
+        _features = {},
+        _stats = {},
+        _keys = [],
+        _hidden = [];
+
+    function update() {
+        _hidden = features.hidden();
+        dispatch.change();
+        dispatch.redraw();
+    }
+
+    function defineFeature(k, filter, max) {
+        _keys.push(k);
+        _features[k] = {
+            filter: filter,
+            enabled: true,   // whether the user wants it enabled..
+            count: 0,
+            currentMax: (max || Infinity),
+            defaultMax: (max || Infinity),
+            enable: function() { this.enabled = true; this.currentMax = this.defaultMax; },
+            disable: function() { this.enabled = false; this.currentMax = 0; },
+            hidden: function() { return !context.editable() || this.count > this.currentMax * _cullFactor; },
+            autoHidden: function() { return this.hidden() && this.currentMax > 0; }
+        };
+    }
+
+
+    defineFeature('points', function isPoint(entity, resolver, geometry) {
+        return geometry === 'point';
+    }, 200);
+
+    defineFeature('major_roads', function isMajorRoad(entity) {
+        return major_roads[entity.tags.highway];
+    });
+
+    defineFeature('minor_roads', function isMinorRoad(entity) {
+        return minor_roads[entity.tags.highway];
+    });
+
+    defineFeature('paths', function isPath(entity) {
+        return paths[entity.tags.highway];
+    });
+
+    defineFeature('buildings', function isBuilding(entity) {
+        return (
+            !!entity.tags['building:part'] ||
+            (!!entity.tags.building && entity.tags.building !== 'no') ||
+            entity.tags.amenity === 'shelter' ||
+            entity.tags.parking === 'multi-storey' ||
+            entity.tags.parking === 'sheds' ||
+            entity.tags.parking === 'carports' ||
+            entity.tags.parking === 'garage_boxes'
+        );
+    }, 250);
+
+    defineFeature('landuse', function isLanduse(entity, resolver, geometry) {
+        return geometry === 'area' &&
+            !_features.buildings.filter(entity) &&
+            !_features.water.filter(entity);
+    });
+
+    defineFeature('boundaries', function isBoundary(entity) {
+        return !!entity.tags.boundary;
+    });
+
+    defineFeature('water', function isWater(entity) {
+        return (
+            !!entity.tags.waterway ||
+            entity.tags.natural === 'water' ||
+            entity.tags.natural === 'coastline' ||
+            entity.tags.natural === 'bay' ||
+            entity.tags.landuse === 'pond' ||
+            entity.tags.landuse === 'basin' ||
+            entity.tags.landuse === 'reservoir' ||
+            entity.tags.landuse === 'salt_pond'
+        );
+    });
+
+    defineFeature('rail', function isRail(entity) {
+        return (
+            !!entity.tags.railway ||
+            entity.tags.landuse === 'railway'
+        ) && !(
+            major_roads[entity.tags.highway] ||
+            minor_roads[entity.tags.highway] ||
+            paths[entity.tags.highway]
+        );
+    });
+
+    defineFeature('power', function isPower(entity) {
+        return !!entity.tags.power;
+    });
+
+    // contains a past/future tag, but not in active use as a road/path/cycleway/etc..
+    defineFeature('past_future', function isPastFuture(entity) {
+        if (
+            major_roads[entity.tags.highway] ||
+            minor_roads[entity.tags.highway] ||
+            paths[entity.tags.highway]
+        ) { return false; }
+
+        var strings = Object.keys(entity.tags);
+
+        for (var i = 0, imax = strings.length; i !== imax; i++) {
+            var s = strings[i];
+            if (past_futures[s] || past_futures[entity.tags[s]]) { return true; }
+        }
+        return false;
+    });
+
+    // lines or areas that don't match another feature filter.
+    defineFeature('others', function isOther(entity, resolver, geometry) {
+        return (geometry === 'line' || geometry === 'area') && !(
+            _features.major_roads.filter(entity, resolver, geometry) ||
+            _features.minor_roads.filter(entity, resolver, geometry) ||
+            _features.paths.filter(entity, resolver, geometry) ||
+            _features.buildings.filter(entity, resolver, geometry) ||
+            _features.landuse.filter(entity, resolver, geometry) ||
+            _features.boundaries.filter(entity, resolver, geometry) ||
+            _features.water.filter(entity, resolver, geometry) ||
+            _features.rail.filter(entity, resolver, geometry) ||
+            _features.power.filter(entity, resolver, geometry) ||
+            _features.past_future.filter(entity, resolver, geometry)
+        );
+    });
+
+
+    function features() {}
+
+    features.keys = function() {
+        return _keys;
+    };
+
+    features.enabled = function(k) {
+        if (!arguments.length) {
+            return _.filter(_keys, function(k) { return _features[k].enabled; });
+        }
+        return _features[k] && _features[k].enabled;
+    };
+
+    features.disabled = function(k) {
+        if (!arguments.length) {
+            return _.reject(_keys, function(k) { return _features[k].enabled; });
+        }
+        return _features[k] && !_features[k].enabled;
+    };
+
+    features.hidden = function(k) {
+        if (!arguments.length) {
+            return _.filter(_keys, function(k) { return _features[k].hidden(); });
+        }
+        return _features[k] && _features[k].hidden();
+    };
+
+    features.autoHidden = function(k) {
+        if (!arguments.length) {
+            return _.filter(_keys, function(k) { return _features[k].autoHidden(); });
+        }
+        return _features[k] && _features[k].autoHidden();
+    };
+
+    features.enable = function(k) {
+        if (_features[k] && !_features[k].enabled) {
+            _features[k].enable();
+            update();
+        }
+    };
+
+    features.disable = function(k) {
+        if (_features[k] && _features[k].enabled) {
+            _features[k].disable();
+            update();
+        }
+    };
+
+    features.toggle = function(k) {
+        if (_features[k]) {
+            (function(f) { return f.enabled ? f.disable() : f.enable(); }(_features[k]));
+            update();
+        }
+    };
+
+    features.resetStats = function() {
+        _.each(_features, function(f) { f.count = 0; });
+        dispatch.change();
+    };
+
+    features.gatherStats = function(d, resolver, dimensions) {
+        var needsRedraw = false,
+            currHidden, geometry, matches;
+
+        _.each(_features, function(f) { f.count = 0; });
+
+        // adjust the threshold for point/building culling based on viewport size..
+        // a _cullFactor of 1 corresponds to a 1000x1000px viewport..
+        _cullFactor = dimensions[0] * dimensions[1] / 1000000;
+
+        for (var i = 0, imax = d.length; i !== imax; i++) {
+            geometry = d[i].geometry(resolver);
+            if (!(geometry === 'vertex' || geometry === 'relation')) {
+                matches = Object.keys(features.getMatches(d[i], resolver, geometry));
+                for (var j = 0, jmax = matches.length; j !== jmax; j++) {
+                    _features[matches[j]].count++;
+                }
+            }
+        }
+
+        currHidden = features.hidden();
+        if (currHidden !== _hidden) {
+            _hidden = currHidden;
+            needsRedraw = true;
+            dispatch.change();
+        }
+
+        return needsRedraw;
+    };
+
+    features.stats = function() {
+        _.each(_keys, function(k) { _stats[k] = _features[k].count; });
+        return _stats;
+    };
+
+    features.clear = function(d) {
+        for (var i = 0, imax = d.length; i !== imax; i++) {
+            features.clearEntity(d[i]);
+        }
+    };
+
+    features.clearEntity = function(entity) {
+        delete _cache[iD.Entity.key(entity)];
+    };
+
+    features.reset = function() {
+        _cache = {};
+    };
+
+    features.getMatches = function(entity, resolver, geometry) {
+        var ent = iD.Entity.key(entity);
+
+        if (!_cache[ent]) {
+            _cache[ent] = {};
+        }
+        if (!_cache[ent].matches) {
+            var matches = {},
+                hasMatch = false;
+
+            if (!(geometry === 'vertex' || geometry === 'relation')) {
+                for (var i = 0, imax = _keys.length; i !== imax; i++) {
+                    if (hasMatch && _keys[i] === 'others') {
+                        continue;
+                    }
+                    if (_features[_keys[i]].filter(entity, resolver, geometry)) {
+                        matches[_keys[i]] = hasMatch = true;
+                    }
+                }
+            }
+            _cache[ent].matches = matches;
+        }
+        return _cache[ent].matches;
+    };
+
+    features.getParents = function(entity, resolver, geometry) {
+        var ent = iD.Entity.key(entity);
+
+        if (!_cache[ent]) {
+            _cache[ent] = {};
+        }
+        if (!_cache[ent].parents) {
+            var parents = [];
+
+            if (geometry !== 'point') {
+                if (geometry === 'vertex') {
+                    parents = resolver.parentWays(entity);
+                } else {   // 'line', 'area', 'relation'
+                    parents = resolver.parentRelations(entity);
+                }
+            }
+            _cache[ent].parents = parents;
+        }
+        return _cache[ent].parents;
+    };
+
+    features.isHiddenFeature = function(entity, resolver, geometry) {
+        if (!entity.version) return false;
+
+        var matches = features.getMatches(entity, resolver, geometry);
+
+        for (var i = 0, imax = _hidden.length; i !== imax; i++) {
+            if (matches[_hidden[i]]) { return true; }
+        }
+        return false;
+    };
+
+    features.isHiddenChild = function(entity, resolver, geometry) {
+        if (!entity.version || geometry === 'point') { return false; }
+
+        var parents = features.getParents(entity, resolver, geometry);
+
+        if (!parents.length) { return false; }
+
+        for (var i = 0, imax = parents.length; i !== imax; i++) {
+            if (!features.isHidden(parents[i], resolver, parents[i].geometry(resolver))) {
+                return false;
+            }
+        }
+        return true;
+    };
+
+    features.hasHiddenConnections = function(entity, resolver) {
+        var childNodes, connections;
+
+        if (entity.type === 'midpoint') {
+            childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
+            connections = [];
+        } else {
+            childNodes = resolver.childNodes(entity);
+            connections = features.getParents(entity, resolver, entity.geometry(resolver));
+        }
+
+        // gather ways connected to child nodes..
+        connections = _.reduce(childNodes, function(result, e) {
+            return resolver.isShared(e) ? _.union(result, resolver.parentWays(e)) : result;
+        }, connections);
+
+        return connections.length ? _.any(connections, function(e) {
+            return features.isHidden(e, resolver, e.geometry(resolver));
+        }) : false;
+    };
+
+    features.isHidden = function(entity, resolver, geometry) {
+        if (!entity.version) return false;
+
+        if (geometry === 'vertex')
+            return features.isHiddenChild(entity, resolver, geometry);
+        if (geometry === 'point')
+            return features.isHiddenFeature(entity, resolver, geometry);
+
+        return features.isHiddenFeature(entity, resolver, geometry) ||
+               features.isHiddenChild(entity, resolver, geometry);
+    };
+
+    features.filter = function(d, resolver) {
+        if (!_hidden.length)
+            return d;
+
+        var result = [];
+        for (var i = 0, imax = d.length; i !== imax; i++) {
+            var entity = d[i];
+            if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
+                result.push(entity);
+            }
+        }
+        return result;
+    };
+
+    return d3.rebind(features, dispatch, 'on');
+};
 iD.GpxLayer = function(context) {
     var projection,
         gj = {},
@@ -24224,6 +24907,8 @@ iD.Map = function(context) {
             .on('change.map', redraw);
         context.background()
             .on('change.map', redraw);
+        context.features()
+            .on('redraw.map', redraw);
 
         selection.call(zoom);
 
@@ -24274,6 +24959,8 @@ iD.Map = function(context) {
                 var all = context.intersects(map.extent()),
                     filter = d3.functor(true),
                     graph = context.graph();
+
+                all = context.features().filter(all, graph);
                 surface.call(vertices, graph, all, filter, map.extent(), map.zoom());
                 surface.call(midpoints, graph, all, filter, map.trimmedExtent());
                 dispatch.drawn({full: false});
@@ -24288,47 +24975,52 @@ iD.Map = function(context) {
     function pxCenter() { return [dimensions[0] / 2, dimensions[1] / 2]; }
 
     function drawVector(difference, extent) {
-        var filter, all,
-            graph = context.graph();
+        var graph = context.graph(),
+            features = context.features(),
+            all = context.intersects(map.extent()),
+            data, filter;
 
         if (difference) {
             var complete = difference.complete(map.extent());
-            all = _.compact(_.values(complete));
+            data = _.compact(_.values(complete));
             filter = function(d) { return d.id in complete; };
-
-        } else if (extent) {
-            all = context.intersects(map.extent().intersection(extent));
-            var set = d3.set(_.pluck(all, 'id'));
-            filter = function(d) { return set.has(d.id); };
+            features.clear(data);
 
         } else {
-            all = context.intersects(map.extent());
-            filter = d3.functor(true);
+            // force a full redraw if gatherStats detects that a feature
+            // should be auto-hidden (e.g. points or buildings)..
+            if (features.gatherStats(all, graph, dimensions)) {
+                extent = undefined;
+            }
+
+            if (extent) {
+                data = context.intersects(map.extent().intersection(extent));
+                var set = d3.set(_.pluck(data, 'id'));
+                filter = function(d) { return set.has(d.id); };
+
+            } else {
+                data = all;
+                filter = d3.functor(true);
+            }
         }
 
+        data = features.filter(data, graph);
+
         surface
-            .call(vertices, graph, all, filter, map.extent(), map.zoom())
-            .call(lines, graph, all, filter)
-            .call(areas, graph, all, filter)
-            .call(midpoints, graph, all, filter, map.trimmedExtent())
-            .call(labels, graph, all, filter, dimensions, !difference && !extent);
-
-        if (points.points(context.intersects(map.extent()), 100).length >= 100) {
-            surface.select('.layer-hit').selectAll('g.point').remove();
-        } else {
-            surface.call(points, points.points(all), filter);
-        }
+            .call(vertices, graph, data, filter, map.extent(), map.zoom())
+            .call(lines, graph, data, filter)
+            .call(areas, graph, data, filter)
+            .call(midpoints, graph, data, filter, map.trimmedExtent())
+            .call(labels, graph, data, filter, dimensions, !difference && !extent)
+            .call(points, data, filter);
 
         dispatch.drawn({full: true});
     }
 
     function editOff() {
-        var mode = context.mode();
+        context.features().resetStats();
         surface.selectAll('.layer *').remove();
         dispatch.drawn({full: true});
-        if (!(mode && mode.id === 'browse')) {
-            context.enter(iD.modes.Browse(context));
-        }
     }
 
     function zoomPan() {
@@ -24344,7 +25036,7 @@ iD.Map = function(context) {
             iD.ui.flash(context.container())
                 .select('.content')
                 .text(t('cannot_zoom'));
-            return setZoom(16, true);
+            return setZoom(context.minEditableZoom(), true);
         }
 
         projection
@@ -24514,6 +25206,13 @@ iD.Map = function(context) {
             return Math.max(Math.log(projection.scale() * 2 * Math.PI) / Math.LN2 - 8, 0);
         }
 
+        if (z < minzoom) {
+            iD.ui.flash(context.container())
+                .select('.content')
+                .text(t('cannot_zoom'));
+            z = context.minEditableZoom();
+        }
+
         if (setZoom(z)) {
             dispatch.move(map);
         }
@@ -24524,7 +25223,7 @@ iD.Map = function(context) {
     map.zoomTo = function(entity, zoomLimits) {
         var extent = entity.extent(context.graph()),
             zoom = map.extentZoom(extent);
-        zoomLimits = zoomLimits || [16, 20];
+        zoomLimits = zoomLimits || [context.minEditableZoom(), 20];
         map.centerZoom(extent.center(), Math.min(Math.max(zoom, zoomLimits[0]), zoomLimits[1]));
     };
 
@@ -24588,7 +25287,7 @@ iD.Map = function(context) {
     };
 
     map.editable = function() {
-        return map.zoom() >= 16;
+        return map.zoom() >= context.minEditableZoom();
     };
 
     map.minzoom = function(_) {
@@ -24703,9 +25402,9 @@ iD.MapillaryLayer = function (context) {
         if (request)
             request.abort();
 
-        request = d3.json('https://mapillary-read-api.herokuapp.com/v1/s/search?min-lat=' +
-            extent[0][1] + '&max-lat=' + extent[1][1] + '&min-lon=' +
-            extent[0][0] + '&max-lon=' + extent[1][0] + '&max-results=100&geojson=true',
+        request = d3.json('https://a.mapillary.com/v2/search/s/geojson?client_id=NzNRM2otQkR2SHJzaXJmNmdQWVQ0dzoxNjQ3MDY4ZTUxY2QzNGI2&min_lat=' +
+            extent[0][1] + '&max_lat=' + extent[1][1] + '&min_lon=' +
+            extent[0][0] + '&max_lon=' + extent[1][0] + '&max_results=100&geojson=true',
             function (error, data) {
                 if (error) return;
 
@@ -25053,20 +25752,14 @@ iD.svg.Areas = function(projection) {
 
     var patternKeys = ['landuse', 'natural', 'amenity'];
 
-    var clipped = ['residential', 'commercial', 'retail', 'industrial'];
-
-    function clip(entity) {
-        return clipped.indexOf(entity.tags.landuse) !== -1;
-    }
-
     function setPattern(d) {
         for (var i = 0; i < patternKeys.length; i++) {
             if (patterns.hasOwnProperty(d.tags[patternKeys[i]])) {
-                this.style.fill = 'url("#pattern-' + patterns[d.tags[patternKeys[i]]] + '")';
+                this.style.fill = this.style.stroke = 'url("#pattern-' + patterns[d.tags[patternKeys[i]]] + '")';
                 return;
             }
         }
-        this.style.fill = '';
+        this.style.fill = this.style.stroke = '';
     }
 
     return function drawAreas(surface, graph, entities, filter) {
@@ -25101,7 +25794,7 @@ iD.svg.Areas = function(projection) {
         });
 
         var data = {
-            clip: areas.filter(clip),
+            clip: areas,
             shadow: strokes,
             stroke: strokes,
             fill: areas
@@ -25161,11 +25854,8 @@ iD.svg.Areas = function(projection) {
 
                 this.setAttribute('class', entity.type + ' area ' + layer + ' ' + entity.id);
 
-                if (layer === 'fill' && clip(entity)) {
-                    this.setAttribute('clip-path', 'url(#' + entity.id + '-clippath)');
-                }
-
                 if (layer === 'fill') {
+                    this.setAttribute('clip-path', 'url(#' + entity.id + '-clippath)');
                     setPattern.apply(this, arguments);
                 }
             })
@@ -25986,7 +26676,10 @@ iD.svg.Points = function(projection, context) {
         return b.loc[1] - a.loc[1];
     }
 
-    function drawPoints(surface, points, filter) {
+    return function drawPoints(surface, entities, filter) {
+        var graph = context.graph(),
+            points = _.filter(entities, function(e) { return e.geometry(graph) === 'point'; });
+
         points.sort(sortY);
 
         var groups = surface.select('.layer-hit').selectAll('g.point')
@@ -26024,24 +26717,7 @@ iD.svg.Points = function(projection, context) {
 
         groups.exit()
             .remove();
-    }
-
-    drawPoints.points = function(entities, limit) {
-        var graph = context.graph(),
-            points = [];
-
-        for (var i = 0; i < entities.length; i++) {
-            var entity = entities[i];
-            if (entity.geometry(graph) === 'point') {
-                points.push(entity);
-                if (limit && points.length >= limit) break;
-            }
-        }
-
-        return points;
     };
-
-    return drawPoints;
 };
 iD.svg.Surface = function() {
     return function (selection) {
@@ -26197,20 +26873,22 @@ iD.svg.Vertices = function(projection, context) {
         var vertices = {};
 
         function addChildVertices(entity) {
-            var i;
-            if (entity.type === 'way') {
-                for (i = 0; i < entity.nodes.length; i++) {
-                    addChildVertices(graph.entity(entity.nodes[i]));
-                }
-            } else if (entity.type === 'relation') {
-                for (i = 0; i < entity.members.length; i++) {
-                    var member = context.hasEntity(entity.members[i].id);
-                    if (member) {
-                        addChildVertices(member);
+            if (!context.features().isHiddenFeature(entity, graph, entity.geometry(graph))) {
+                var i;
+                if (entity.type === 'way') {
+                    for (i = 0; i < entity.nodes.length; i++) {
+                        addChildVertices(graph.entity(entity.nodes[i]));
+                    }
+                } else if (entity.type === 'relation') {
+                    for (i = 0; i < entity.members.length; i++) {
+                        var member = context.hasEntity(entity.members[i].id);
+                        if (member) {
+                            addChildVertices(member);
+                        }
                     }
+                } else if (entity.intersects(extent, graph)) {
+                    vertices[entity.id] = entity;
                 }
-            } else if (entity.intersects(extent, graph)) {
-                vertices[entity.id] = entity;
             }
         }
 
@@ -26415,13 +27093,6 @@ iD.ui = function(context) {
             .attr('class', 'spinner')
             .call(iD.ui.Spinner(context));
 
-        content
-            .call(iD.ui.Attribution(context));
-
-        content.append('div')
-            .style('display', 'none')
-            .attr('class', 'help-wrap map-overlay fillL col5 content');
-
         var controls = bar.append('div')
             .attr('class', 'map-controls');
 
@@ -26437,11 +27108,22 @@ iD.ui = function(context) {
             .attr('class', 'map-control background-control')
             .call(iD.ui.Background(context));
 
+        controls.append('div')
+            .attr('class', 'map-control map-data-control')
+            .call(iD.ui.MapData(context));
+
         controls.append('div')
             .attr('class', 'map-control help-control')
             .call(iD.ui.Help(context));
 
-        var footer = content.append('div')
+        var about = content.append('div')
+            .attr('id', 'about');
+
+        about.append('div')
+            .attr('id', 'attrib')
+            .call(iD.ui.Attribution(context));
+
+        var footer = about.append('div')
             .attr('id', 'footer')
             .attr('class', 'fillD');
 
@@ -26449,24 +27131,23 @@ iD.ui = function(context) {
             .attr('id', 'scale-block')
             .call(iD.ui.Scale(context));
 
-        var linkList = footer.append('div')
+        var aboutList = footer.append('div')
             .attr('id', 'info-block')
             .append('ul')
-            .attr('id', 'about-list')
-            .attr('class', 'link-list');
+            .attr('id', 'about-list');
 
         if (!context.embed()) {
-            linkList.call(iD.ui.Account(context));
+            aboutList.call(iD.ui.Account(context));
         }
 
-        linkList.append('li')
+        aboutList.append('li')
             .append('a')
             .attr('target', '_blank')
             .attr('tabindex', -1)
             .attr('href', 'http://github.com/openstreetmap/iD')
             .text(iD.version);
 
-        var bugReport = linkList.append('li')
+        var bugReport = aboutList.append('li')
             .append('a')
             .attr('target', '_blank')
             .attr('tabindex', -1)
@@ -26480,7 +27161,12 @@ iD.ui = function(context) {
                 .placement('top')
             );
 
-        linkList.append('li')
+        aboutList.append('li')
+            .attr('class', 'feature-warning')
+            .attr('tabindex', -1)
+            .call(iD.ui.FeatureInfo(context));
+
+        aboutList.append('li')
             .attr('class', 'user-list')
             .attr('tabindex', -1)
             .call(iD.ui.Contributors(context));
@@ -26552,7 +27238,13 @@ iD.ui = function(context) {
 };
 
 iD.ui.tooltipHtml = function(text, key) {
-    return '<span>' + text + '</span>' + '<div class="keyhint-wrap">' + '<span> ' + (t('tooltip_keyhint')) + ' </span>' + '<span class="keyhint"> ' + key + '</span></div>';
+    var s = '<span>' + text + '</span>';
+    if (key) {
+        s += '<div class="keyhint-wrap">' +
+            '<span> ' + (t('tooltip_keyhint')) + ' </span>' +
+            '<span class="keyhint"> ' + key + '</span></div>';
+    }
+    return s;
 };
 iD.ui.Account = function(context) {
     var connection = context.connection();
@@ -26560,7 +27252,7 @@ iD.ui.Account = function(context) {
     function update(selection) {
         if (!connection.authenticated()) {
             selection.selectAll('#userLink, #logoutLink')
-                .style('display', 'none');
+                .classed('hide', true);
             return;
         }
 
@@ -26574,7 +27266,7 @@ iD.ui.Account = function(context) {
             if (err) return;
 
             selection.selectAll('#userLink, #logoutLink')
-                .style('display', 'list-item');
+                .classed('hide', false);
 
             // Link
             userLink.append('a')
@@ -26610,11 +27302,11 @@ iD.ui.Account = function(context) {
     return function(selection) {
         selection.append('li')
             .attr('id', 'logoutLink')
-            .style('display', 'none');
+            .classed('hide', true);
 
         selection.append('li')
             .attr('id', 'userLink')
-            .style('display', 'none');
+            .classed('hide', true);
 
         connection.on('auth.account', function() { update(selection); });
         update(selection);
@@ -26701,7 +27393,7 @@ iD.ui.Attribution = function(context) {
     };
 };
 iD.ui.Background = function(context) {
-    var key = 'b',
+    var key = 'B',
         opacities = [1, 0.75, 0.5, 0.25],
         directions = [
             ['left', [1, 0]],
@@ -26774,16 +27466,6 @@ iD.ui.Background = function(context) {
             selectLayer();
         }
 
-        function clickGpx() {
-            context.background().toggleGpxLayer();
-            update();
-        }
-
-        function clickMapillary() {
-            context.background().toggleMapillaryLayer();
-            update();
-        }
-
         function drawList(layerList, type, change, filter) {
             var sources = context.background()
                 .sources(context.map().extent())
@@ -26822,22 +27504,6 @@ iD.ui.Background = function(context) {
             backgroundList.call(drawList, 'radio', clickSetSource, function(d) { return !d.overlay; });
             overlayList.call(drawList, 'checkbox', clickSetOverlay, function(d) { return d.overlay; });
 
-            var hasGpx = context.background().hasGpxLayer(),
-                showsGpx = context.background().showsGpxLayer();
-
-            gpxLayerItem
-                .classed('active', showsGpx)
-                .selectAll('input')
-                .property('disabled', !hasGpx)
-                .property('checked', showsGpx);
-
-            var showsMapillary = context.background().showsMapillaryLayer();
-
-            mapillaryLayerItem
-                .classed('active', showsMapillary)
-                .selectAll('input')
-                .property('checked', showsMapillary);
-
             selectLayer();
 
             var source = context.background().baseLayerSource();
@@ -26867,13 +27533,6 @@ iD.ui.Background = function(context) {
             }
         }
 
-        var content = selection.append('div')
-                .attr('class', 'fillL map-overlay col3 content hide'),
-            tooltip = bootstrap.tooltip()
-                .placement('left')
-                .html(true)
-                .title(iD.ui.tooltipHtml(t('background.description'), key));
-
         function hide() { setVisible(false); }
 
         function toggle() {
@@ -26910,18 +27569,26 @@ iD.ui.Background = function(context) {
             }
         }
 
-        var button = selection.append('button')
+
+        var content = selection.append('div')
+                .attr('class', 'fillL map-overlay col3 content hide'),
+            tooltip = bootstrap.tooltip()
+                .placement('left')
+                .html(true)
+                .title(iD.ui.tooltipHtml(t('background.description'), key)),
+            button = selection.append('button')
                 .attr('tabindex', -1)
                 .on('click', toggle)
                 .call(tooltip),
-            opa = content
-                .append('div')
-                .attr('class', 'opacity-options-wrapper'),
             shown = false;
 
         button.append('span')
             .attr('class', 'icon layers light');
 
+
+        var opa = content.append('div')
+                .attr('class', 'opacity-options-wrapper');
+
         opa.append('h4')
             .text(t('background.title'));
 
@@ -26978,68 +27645,6 @@ iD.ui.Background = function(context) {
         var overlayList = content.append('ul')
             .attr('class', 'layer-list');
 
-        var mapillaryLayerItem = overlayList.append('li');
-
-        label = mapillaryLayerItem.append('label')
-            .call(bootstrap.tooltip()
-                .title(t('mapillary.tooltip'))
-                .placement('top'));
-
-        label.append('input')
-            .attr('type', 'checkbox')
-            .on('change', clickMapillary);
-
-        label.append('span')
-            .text(t('mapillary.title'));
-
-        var gpxLayerItem = content.append('ul')
-            .style('display', iD.detect().filedrop ? 'block' : 'none')
-            .attr('class', 'layer-list')
-            .append('li')
-            .classed('layer-toggle-gpx', true);
-
-        gpxLayerItem.append('button')
-            .attr('class', 'layer-extent')
-            .call(bootstrap.tooltip()
-                .title(t('gpx.zoom'))
-                .placement('left'))
-            .on('click', function() {
-                d3.event.preventDefault();
-                d3.event.stopPropagation();
-                context.background().zoomToGpxLayer();
-            })
-            .append('span')
-            .attr('class', 'icon geolocate');
-
-        gpxLayerItem.append('button')
-            .attr('class', 'layer-browse')
-            .call(bootstrap.tooltip()
-                .title(t('gpx.browse'))
-                .placement('left'))
-            .on('click', function() {
-                d3.select(document.createElement('input'))
-                    .attr('type', 'file')
-                    .on('change', function() {
-                        context.background().gpxLayerFiles(d3.event.target.files);
-                    })
-                    .node().click();
-            })
-            .append('span')
-            .attr('class', 'icon geocode');
-
-        label = gpxLayerItem.append('label')
-            .call(bootstrap.tooltip()
-                .title(t('gpx.drag_drop'))
-                .placement('top'));
-
-        label.append('input')
-            .attr('type', 'checkbox')
-            .property('disabled', true)
-            .on('change', clickGpx);
-
-        label.append('span')
-            .text(t('gpx.local_layer'));
-
         var adjustments = content.append('div')
             .attr('class', 'adjustments');
 
@@ -27084,11 +27689,10 @@ iD.ui.Background = function(context) {
         update();
         setOpacity(opacityDefault);
 
-        var keybinding = d3.keybinding('background');
-        keybinding.on(key, toggle);
-        keybinding.on('m', function() {
-            context.enter(iD.modes.SelectImage(context));
-        });
+        var keybinding = d3.keybinding('background')
+            .on(key, toggle)
+            .on('F', hide)
+            .on('H', hide);
 
         d3.select(document)
             .call(keybinding);
@@ -27654,7 +28258,7 @@ iD.ui.EntityEditor = function(context) {
         if (!arguments.length) return preset;
         if (_ !== preset) {
             preset = _;
-            reference = iD.ui.TagReference(preset.reference(context.geometry(id)))
+            reference = iD.ui.TagReference(preset.reference(context.geometry(id)), context)
                 .showing(false);
         }
         return entityEditor;
@@ -27662,6 +28266,52 @@ iD.ui.EntityEditor = function(context) {
 
     return d3.rebind(entityEditor, event, 'on');
 };
+iD.ui.FeatureInfo = function(context) {
+    function update(selection) {
+        var features = context.features(),
+            stats = features.stats(),
+            count = 0,
+            hiddenList = _.compact(_.map(features.hidden(), function(k) {
+                if (stats[k]) {
+                    count += stats[k];
+                    return String(stats[k]) + ' ' + t('feature.' + k + '.description');
+                }
+            }));
+
+        selection.html('');
+
+        if (hiddenList.length) {
+            var tooltip = bootstrap.tooltip()
+                    .placement('top')
+                    .html(true)
+                    .title(function() {
+                        return iD.ui.tooltipHtml(hiddenList.join('<br/>'));
+                    });
+
+            var warning = selection.append('a')
+                .attr('href', '#')
+                .attr('tabindex', -1)
+                .html(t('feature_info.hidden_warning', { count: count }))
+                .call(tooltip)
+                .on('click', function() {
+                    tooltip.hide(warning);
+                    // open map data panel?
+                    d3.event.preventDefault();
+                });
+        }
+
+        selection
+            .classed('hide', !hiddenList.length);
+    }
+
+    return function(selection) {
+        update(selection);
+
+        context.features().on('change.feature_info', function() {
+            update(selection);
+        });
+    };
+};
 iD.ui.FeatureList = function(context) {
     var geocodeResults;
 
@@ -27951,7 +28601,7 @@ iD.ui.Geolocate = function(map) {
     };
 };
 iD.ui.Help = function(context) {
-    var key = 'h';
+    var key = 'H';
 
     var docKeys = [
         'help.help',
@@ -27973,7 +28623,6 @@ iD.ui.Help = function(context) {
     });
 
     function help(selection) {
-        var shown = false;
 
         function hide() {
             setVisible(false);
@@ -27989,7 +28638,11 @@ iD.ui.Help = function(context) {
             if (show !== shown) {
                 button.classed('active', show);
                 shown = show;
+
                 if (show) {
+                    selection.on('mousedown.help-inside', function() {
+                        return d3.event.stopPropagation();
+                    });
                     pane.style('display', 'block')
                         .style('right', '-500px')
                         .transition()
@@ -28003,6 +28656,7 @@ iD.ui.Help = function(context) {
                         .each('end', function() {
                             d3.select(this).style('display', 'none');
                         });
+                    selection.on('mousedown.help-inside', null);
                 }
             }
         }
@@ -28044,21 +28698,22 @@ iD.ui.Help = function(context) {
             setVisible(false);
         }
 
-        var tooltip = bootstrap.tooltip()
-            .placement('left')
-            .html(true)
-            .title(iD.ui.tooltipHtml(t('help.title'), key));
 
-        var button = selection.append('button')
-            .attr('tabindex', -1)
-            .on('click', toggle)
-            .call(tooltip);
+        var pane = selection.append('div')
+                .attr('class', 'help-wrap map-overlay fillL col5 content hide'),
+            tooltip = bootstrap.tooltip()
+                .placement('left')
+                .html(true)
+                .title(iD.ui.tooltipHtml(t('help.title'), key)),
+            button = selection.append('button')
+                .attr('tabindex', -1)
+                .on('click', toggle)
+                .call(tooltip),
+            shown = false;
 
         button.append('span')
             .attr('class', 'icon help light');
 
-        var pane = context.container()
-            .select('.help-wrap');
 
         var toc = pane.append('ul')
             .attr('class', 'toc');
@@ -28092,18 +28747,15 @@ iD.ui.Help = function(context) {
         clickHelp(docs[0], 0);
 
         var keybinding = d3.keybinding('help')
-            .on(key, toggle);
+            .on(key, toggle)
+            .on('B', hide)
+            .on('F', hide);
 
         d3.select(document)
             .call(keybinding);
 
         context.surface().on('mousedown.help-outside', hide);
-        context.container().on('mousedown.b.help-outside', hide);
-
-        pane.on('mousedown.help-inside', function() {
-            return d3.event.stopPropagation();
-        });
-
+        context.container().on('mousedown.help-outside', hide);
     }
 
     return help;
@@ -28441,6 +29093,335 @@ iD.ui.Loading = function(context) {
 
     return loading;
 };
+iD.ui.MapData = function(context) {
+    var key = 'F',
+        features = context.features().keys(),
+        fills = ['wireframe', 'partial', 'full'],
+        fillDefault = context.storage('area-fill') || 'partial',
+        fillSelected = fillDefault;
+
+    function map_data(selection) {
+
+        function showsFeature(d) {
+            return autoHiddenFeature(d) ? null : context.features().enabled(d);
+        }
+
+        function autoHiddenFeature(d) {
+            return context.features().autoHidden(d);
+        }
+
+        function clickFeature(d) {
+            context.features().toggle(d);
+            update();
+        }
+
+        function showsFill(d) {
+            return fillSelected === d;
+        }
+
+        function setFill(d) {
+            _.each(fills, function(opt) {
+                context.surface().classed('fill-' + opt, Boolean(opt === d));
+            });
+
+            fillSelected = d;
+            if (d !== 'wireframe') {
+                fillDefault = d;
+                context.storage('area-fill', d);
+            }
+            update();
+        }
+
+        function clickGpx() {
+            context.background().toggleGpxLayer();
+            update();
+        }
+
+        function clickMapillary() {
+            context.background().toggleMapillaryLayer();
+            update();
+        }
+
+        function drawList(selection, data, type, name, change, active) {
+            var items = selection.selectAll('li')
+                .data(data);
+
+            //enter
+            var enter = items.enter()
+                .append('li')
+                .attr('class', 'layer')
+                .call(bootstrap.tooltip()
+                    .html(true)
+                    .title(function(d) {
+                        var tip = t(name + '.' + d + '.tooltip'),
+                            key = (d === 'wireframe' ? 'W' : null);
+
+                        if (name === 'feature' && autoHiddenFeature(d)) {
+                            tip += '<div>' + t('map_data.autohidden') + '</div>';
+                        }
+                        return iD.ui.tooltipHtml(tip, key);
+                    })
+                    .placement('top')
+                );
+
+            var label = enter.append('label');
+
+            label.append('input')
+                .attr('type', type)
+                .attr('name', name)
+                .on('change', change);
+
+            label.append('span')
+                .text(function(d) { return t(name + '.' + d + '.description'); });
+
+            //update
+            items
+                .classed('active', active)
+                .selectAll('input')
+                .property('checked', active);
+
+            if (name === 'feature') {
+                items
+                    .selectAll('input')
+                    .property('indeterminate', autoHiddenFeature);
+            }
+
+            //exit
+            items.exit()
+                .remove();
+        }
+
+        function update() {
+            featureList.call(drawList, features, 'checkbox', 'feature', clickFeature, showsFeature);
+            fillList.call(drawList, fills, 'radio', 'area_fill', setFill, showsFill);
+
+            var hasGpx = context.background().hasGpxLayer(),
+                showsGpx = context.background().showsGpxLayer(),
+                showsMapillary = context.background().showsMapillaryLayer();
+
+            gpxLayerItem
+                .classed('active', showsGpx)
+                .selectAll('input')
+                .property('disabled', !hasGpx)
+                .property('checked', showsGpx);
+
+            mapillaryLayerItem
+                .classed('active', showsMapillary)
+                .selectAll('input')
+                .property('checked', showsMapillary);
+        }
+
+        function hidePanel() { setVisible(false); }
+
+        function togglePanel() {
+            if (d3.event) d3.event.preventDefault();
+            tooltip.hide(button);
+            setVisible(!button.classed('active'));
+        }
+
+        function toggleWireframe() {
+            if (d3.event) {
+                d3.event.preventDefault();
+                d3.event.stopPropagation();
+            }
+            setFill((fillSelected === 'wireframe' ? fillDefault : 'wireframe'));
+        }
+
+        function setVisible(show) {
+            if (show !== shown) {
+                button.classed('active', show);
+                shown = show;
+
+                if (show) {
+                    selection.on('mousedown.map_data-inside', function() {
+                        return d3.event.stopPropagation();
+                    });
+                    content.style('display', 'block')
+                        .style('right', '-300px')
+                        .transition()
+                        .duration(200)
+                        .style('right', '0px');
+                } else {
+                    content.style('display', 'block')
+                        .style('right', '0px')
+                        .transition()
+                        .duration(200)
+                        .style('right', '-300px')
+                        .each('end', function() {
+                            d3.select(this).style('display', 'none');
+                        });
+                    selection.on('mousedown.map_data-inside', null);
+                }
+            }
+        }
+
+
+        var content = selection.append('div')
+                .attr('class', 'fillL map-overlay col3 content hide'),
+            tooltip = bootstrap.tooltip()
+                .placement('left')
+                .html(true)
+                .title(iD.ui.tooltipHtml(t('map_data.description'), key)),
+            button = selection.append('button')
+                .attr('tabindex', -1)
+                .on('click', togglePanel)
+                .call(tooltip),
+            shown = false;
+
+        button.append('span')
+            .attr('class', 'icon data light');
+
+        content.append('h4')
+            .text(t('map_data.title'));
+
+
+        // data layers
+        content.append('a')
+            .text(t('map_data.data_layers'))
+            .attr('href', '#')
+            .classed('hide-toggle', true)
+            .classed('expanded', true)
+            .on('click', function() {
+                var exp = d3.select(this).classed('expanded');
+                layerContainer.style('display', exp ? 'none' : 'block');
+                d3.select(this).classed('expanded', !exp);
+                d3.event.preventDefault();
+            });
+
+        var layerContainer = content.append('div')
+            .attr('class', 'filters')
+            .style('display', 'block');
+
+        // mapillary
+        var mapillaryLayerItem = layerContainer.append('ul')
+            .attr('class', 'layer-list')
+            .append('li');
+
+        var label = mapillaryLayerItem.append('label')
+            .call(bootstrap.tooltip()
+                .title(t('mapillary.tooltip'))
+                .placement('top'));
+
+        label.append('input')
+            .attr('type', 'checkbox')
+            .on('change', clickMapillary);
+
+        label.append('span')
+            .text(t('mapillary.title'));
+
+        // gpx
+        var gpxLayerItem = layerContainer.append('ul')
+            .style('display', iD.detect().filedrop ? 'block' : 'none')
+            .attr('class', 'layer-list')
+            .append('li')
+            .classed('layer-toggle-gpx', true);
+
+        gpxLayerItem.append('button')
+            .attr('class', 'layer-extent')
+            .call(bootstrap.tooltip()
+                .title(t('gpx.zoom'))
+                .placement('left'))
+            .on('click', function() {
+                d3.event.preventDefault();
+                d3.event.stopPropagation();
+                context.background().zoomToGpxLayer();
+            })
+            .append('span')
+            .attr('class', 'icon geolocate');
+
+        gpxLayerItem.append('button')
+            .attr('class', 'layer-browse')
+            .call(bootstrap.tooltip()
+                .title(t('gpx.browse'))
+                .placement('left'))
+            .on('click', function() {
+                d3.select(document.createElement('input'))
+                    .attr('type', 'file')
+                    .on('change', function() {
+                        context.background().gpxLayerFiles(d3.event.target.files);
+                    })
+                    .node().click();
+            })
+            .append('span')
+            .attr('class', 'icon geocode');
+
+        label = gpxLayerItem.append('label')
+            .call(bootstrap.tooltip()
+                .title(t('gpx.drag_drop'))
+                .placement('top'));
+
+        label.append('input')
+            .attr('type', 'checkbox')
+            .property('disabled', true)
+            .on('change', clickGpx);
+
+        label.append('span')
+            .text(t('gpx.local_layer'));
+
+
+        // area fills
+        content.append('a')
+            .text(t('map_data.fill_area'))
+            .attr('href', '#')
+            .classed('hide-toggle', true)
+            .classed('expanded', false)
+            .on('click', function() {
+                var exp = d3.select(this).classed('expanded');
+                fillContainer.style('display', exp ? 'none' : 'block');
+                d3.select(this).classed('expanded', !exp);
+                d3.event.preventDefault();
+            });
+
+        var fillContainer = content.append('div')
+            .attr('class', 'filters')
+            .style('display', 'none');
+
+        var fillList = fillContainer.append('ul')
+            .attr('class', 'layer-list');
+
+
+        // feature filters
+        content.append('a')
+            .text(t('map_data.map_features'))
+            .attr('href', '#')
+            .classed('hide-toggle', true)
+            .classed('expanded', false)
+            .on('click', function() {
+                var exp = d3.select(this).classed('expanded');
+                featureContainer.style('display', exp ? 'none' : 'block');
+                d3.select(this).classed('expanded', !exp);
+                d3.event.preventDefault();
+            });
+
+        var featureContainer = content.append('div')
+            .attr('class', 'filters')
+            .style('display', 'none');
+
+        var featureList = featureContainer.append('ul')
+            .attr('class', 'layer-list');
+
+
+        context.features()
+            .on('change.map_data-update', update);
+
+        update();
+        setFill(fillDefault);
+
+        var keybinding = d3.keybinding('features')
+            .on(key, togglePanel)
+            .on('W', toggleWireframe)
+            .on('B', hidePanel)
+            .on('H', hidePanel);
+
+        d3.select(document)
+            .call(keybinding);
+
+        context.surface().on('mousedown.map_data-outside', hidePanel);
+        context.container().on('mousedown.map_data-outside', hidePanel);
+    }
+
+    return map_data;
+};
 iD.ui.modal = function(selection, blocking) {
 
     var previous = selection.select('div.modal');
@@ -28513,6 +29494,10 @@ iD.ui.Modes = function(context) {
         iD.modes.AddLine(context),
         iD.modes.AddArea(context)];
 
+    function editable() {
+        return context.editable() && context.mode().id !== 'save';
+    }
+
     return function(selection) {
         var buttons = selection.selectAll('button.add-button')
             .data(modes);
@@ -28540,8 +29525,6 @@ iD.ui.Modes = function(context) {
         context
             .on('enter.modes', update);
 
-        update();
-
         buttons.append('span')
             .attr('class', function(mode) { return mode.id + ' icon icon-pre-text'; });
 
@@ -28563,14 +29546,14 @@ iD.ui.Modes = function(context) {
         var keybinding = d3.keybinding('mode-buttons');
 
         modes.forEach(function(m) {
-            keybinding.on(m.key, function() { if (context.editable()) context.enter(m); });
+            keybinding.on(m.key, function() { if (editable()) context.enter(m); });
         });
 
         d3.select(document)
             .call(keybinding);
 
         function update() {
-            buttons.property('disabled', !context.editable());
+            buttons.property('disabled', !editable());
         }
     };
 };
@@ -28581,7 +29564,7 @@ iD.ui.Notice = function(context) {
 
         var button = div.append('button')
             .attr('class', 'zoom-to notice')
-            .on('click', function() { context.map().zoom(16); });
+            .on('click', function() { context.map().zoom(context.minEditableZoom()); });
 
         button.append('span')
             .attr('class', 'icon zoom-in-invert');
@@ -28591,7 +29574,7 @@ iD.ui.Notice = function(context) {
             .text(t('zoom_in_edit'));
 
         function disableTooHigh() {
-            div.style('display', context.map().editable() ? 'none' : 'block');
+            div.style('display', context.editable() ? 'none' : 'block');
         }
 
         context.map()
@@ -28700,7 +29683,7 @@ iD.ui.preset = function(context) {
         // Enter
 
         var $enter = $fields.enter()
-            .insert('div', '.more-buttons')
+            .append('div')
             .attr('class', function(field) {
                 return 'form-field form-field-' + field.id;
             });
@@ -28740,7 +29723,7 @@ iD.ui.preset = function(context) {
                 return field.present();
             })
             .each(function(field) {
-                var reference = iD.ui.TagReference(field.reference || {key: field.key});
+                var reference = iD.ui.TagReference(field.reference || {key: field.key}, context);
 
                 if (state === 'hover') {
                     reference.showing(false);
@@ -28758,30 +29741,49 @@ iD.ui.preset = function(context) {
         $fields.exit()
             .remove();
 
-        var $more = selection.selectAll('.more-buttons')
-            .data([0]);
+        notShown = notShown.map(function(field) {
+            return {
+                title: field.label(),
+                value: field.label(),
+                field: field
+            };
+        });
+
+        var $more = selection.selectAll('.more-fields')
+            .data((notShown.length > 0) ? [0] : []);
 
         $more.enter().append('div')
-            .attr('class', 'more-buttons inspector-inner');
+            .attr('class', 'more-fields')
+            .append('label')
+                .text(t('inspector.add_fields'));
 
-        var $buttons = $more.selectAll('.preset-add-field')
-            .data(notShown, fieldKey);
+        var $input = $more.selectAll('.value')
+            .data([0]);
 
-        $buttons.enter()
-            .append('button')
-            .attr('class', 'preset-add-field')
-            .call(bootstrap.tooltip()
-                .placement('top')
-                .title(function(d) { return d.label(); }))
-            .append('span')
-            .attr('class', function(d) { return 'icon ' + d.icon; });
+        $input.enter().append('input')
+            .attr('class', 'value')
+            .attr('type', 'text');
 
-        $buttons.on('click', show);
+        $input.value('')
+            .attr('placeholder', function() {
+                var placeholder = [];
+                for (var field in notShown) {
+                    placeholder.push(notShown[field].title);
+                }
+                return placeholder.slice(0,3).join(', ') + ((placeholder.length > 3) ? '…' : '');
+            })
+            .call(d3.combobox().data(notShown)
+                .minItems(1)
+                .on('accept', show));
+
+        $more.exit()
+            .remove();
 
-        $buttons.exit()
+        $input.exit()
             .remove();
 
         function show(field) {
+            field = field.field;
             field.show = true;
             presets(selection);
             field.input.focus();
@@ -29106,7 +30108,7 @@ iD.ui.PresetList = function(context) {
         };
 
         item.preset = preset;
-        item.reference = iD.ui.TagReference(preset.reference(context.geometry(id)));
+        item.reference = iD.ui.TagReference(preset.reference(context.geometry(id)), context);
 
         return item;
     }
@@ -29589,7 +30591,6 @@ iD.ui.RawMembershipEditor = function(context) {
 };
 iD.ui.RawTagEditor = function(context) {
     var event = d3.dispatch('change'),
-        taginfo = iD.taginfo(),
         showBlank = false,
         state,
         preset,
@@ -29666,14 +30667,16 @@ iD.ui.RawTagEditor = function(context) {
             .append('span')
             .attr('class', 'icon delete');
 
-        $enter.each(bindTypeahead);
+        if (context.taginfo()) {
+            $enter.each(bindTypeahead);
+        }
 
         // Update
 
         $items.order();
 
         $items.each(function(tag) {
-            var reference = iD.ui.TagReference({key: tag.key});
+            var reference = iD.ui.TagReference({key: tag.key}, context);
 
             if (state === 'hover') {
                 reference.showing(false);
@@ -29728,7 +30731,7 @@ iD.ui.RawTagEditor = function(context) {
 
             key.call(d3.combobox()
                 .fetcher(function(value, callback) {
-                    taginfo.keys({
+                    context.taginfo().keys({
                         debounce: true,
                         geometry: context.geometry(id),
                         query: value
@@ -29739,7 +30742,7 @@ iD.ui.RawTagEditor = function(context) {
 
             value.call(d3.combobox()
                 .fetcher(function(value, callback) {
-                    taginfo.values({
+                    context.taginfo().values({
                         debounce: true,
                         key: key.value(),
                         geometry: context.geometry(id),
@@ -29780,6 +30783,7 @@ iD.ui.RawTagEditor = function(context) {
             var tag = {};
             tag[d.key] = undefined;
             event.change(tag);
+            d3.select(this.parentNode).remove();
         }
 
         function addTag() {
@@ -30364,9 +31368,8 @@ iD.ui.Success = function(context) {
 
     return d3.rebind(success, event, 'on');
 };
-iD.ui.TagReference = function(tag) {
+iD.ui.TagReference = function(tag, context) {
     var tagReference = {},
-        taginfo = iD.taginfo(),
         button,
         body,
         loaded,
@@ -30400,7 +31403,7 @@ iD.ui.TagReference = function(tag) {
     function load() {
         button.classed('tag-reference-loading', true);
 
-        taginfo.docs(tag, function(err, docs) {
+        context.taginfo().docs(tag, function(err, docs) {
             if (!err && docs) {
                 docs = findLocal(docs);
             }
@@ -30483,7 +31486,9 @@ iD.ui.TagReference = function(tag) {
             } else if (loaded) {
                 show();
             } else {
-                load();
+                if (context.taginfo()) {
+                    load();
+                }
             }
         });
     };
@@ -30957,6 +31962,8 @@ iD.ui.preset.address = function(field, context) {
     }
 
     function address(selection) {
+        isInitialized = false;
+        
         selection.selectAll('.preset-input-wrap')
             .remove();
 
@@ -31065,7 +32072,8 @@ iD.ui.preset.address = function(field, context) {
     };
 
     address.focus = function() {
-        wrap.selectAll('input').node().focus();
+        var node = wrap.selectAll('input').node();
+        if (node) node.focus();
     };
 
     return d3.rebind(address, event, 'on');
@@ -31153,7 +32161,7 @@ iD.ui.preset.defaultcheck = function(field) {
     return d3.rebind(check, event, 'on');
 };
 iD.ui.preset.combo =
-iD.ui.preset.typeCombo = function(field) {
+iD.ui.preset.typeCombo = function(field, context) {
     var event = d3.dispatch('change'),
         optstrings = field.strings && field.strings.options,
         optarray = field.options,
@@ -31188,8 +32196,8 @@ iD.ui.preset.typeCombo = function(field) {
                         strings[k] = k.replace(/_+/g, ' ');
                     });
                     stringsLoaded();
-                } else {
-                    iD.taginfo().values({key: field.key}, function(err, data) {
+                } else if (context.taginfo()) {
+                    context.taginfo().values({key: field.key}, function(err, data) {
                         if (!err) {
                             _.each(_.pluck(data, 'value'), function(k) {
                                 strings[k] = k.replace(/_+/g, ' ');
@@ -32592,6 +33600,39 @@ iD.presets = function() {
         return match || all.item(geometry);
     };
 
+    // Because of the open nature of tagging, iD will never have a complete
+    // list of tags used in OSM, so we want it to have logic like "assume
+    // that a closed way with an amenity tag is an area, unless the amenity
+    // is one of these specific types". This function computes a structure
+    // that allows testing of such conditions, based on the presets designated
+    // as as supporting (or not supporting) the area geometry.
+    //
+    // The returned object L is a whitelist/blacklist of tags. A closed way
+    // with a tag (k, v) is considered to be an area if `k in L && !(v in L[k])`
+    // (see `iD.Way#isArea()`). In other words, the keys of L form the whitelist,
+    // and the subkeys form the blacklist.
+    all.areaKeys = function() {
+        var areaKeys = {};
+
+        all.collection.forEach(function(d) {
+            if (d.suggestion) return;
+
+            for (var key in d.tags) break;
+            if (!key) return;
+            var value = d.tags[key];
+
+            if (['highway', 'footway', 'railway', 'type'].indexOf(key) === -1) {
+                if (d.geometry.indexOf('area') >= 0) {
+                    areaKeys[key] = areaKeys[key] || {};
+                } else if (key in areaKeys && value !== '*') {
+                    areaKeys[key][value] = true;
+                }
+            }
+        });
+
+        return areaKeys;
+    };
+
     all.load = function(d) {
 
         if (d.fields) {
@@ -33195,72640 +34236,1433 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
         "yh:WIDTH_RANK",
         "SK53_bulk:load"
     ],
-    "imagery": [
-        {
-            "name": "7th Series (OS7)",
-            "type": "tms",
-            "template": "http://ooc.openstreetmap.org/os7/{zoom}/{x}/{y}.jpg",
-            "polygon": [
-                [
-                    [
-                        -9,
-                        49.8
-                    ],
-                    [
-                        -9,
-                        61.1
-                    ],
-                    [
-                        1.9,
-                        61.1
-                    ],
-                    [
-                        1.9,
-                        49.8
-                    ],
-                    [
-                        -9,
-                        49.8
-                    ]
-                ]
-            ]
-        },
-        {
-            "name": "AGRI black-and-white 2.5m",
-            "type": "tms",
-            "template": "http://agri.openstreetmap.org/{zoom}/{x}/{y}.png",
-            "polygon": [
-                [
-                    [
-                        112.28778,
-                        -28.784589
-                    ],
-                    [
-                        112.71488,
-                        -31.13894
-                    ],
-                    [
-                        114.11263,
-                        -34.178287
-                    ],
-                    [
-                        113.60788,
-                        -37.39012
-                    ],
-                    [
-                        117.17992,
-                        -37.451794
-                    ],
-                    [
-                        119.31538,
-                        -37.42096
-                    ],
-                    [
-                        121.72262,
-                        -36.708394
-                    ],
-                    [
-                        123.81925,
-                        -35.76893
-                    ],
-                    [
-                        125.9547,
-                        -34.3066
-                    ],
-                    [
-                        127.97368,
-                        -33.727398
-                    ],
-                    [
-                        130.07031,
-                        -33.24166
-                    ],
-                    [
-                        130.10913,
-                        -33.888704
-                    ],
-                    [
-                        131.00214,
-                        -34.049705
-                    ],
-                    [
-                        131.0798,
-                        -34.72257
-                    ],
-                    [
-                        132.28342,
-                        -35.39
-                    ],
-                    [
-                        134.18591,
-                        -35.61126
-                    ],
-                    [
-                        133.8753,
-                        -37.1119
-                    ],
-                    [
-                        134.8459,
-                        -37.6365
-                    ],
-                    [
-                        139.7769,
-                        -37.82075
-                    ],
-                    [
-                        139.93223,
-                        -39.4283
-                    ],
-                    [
-                        141.6017,
-                        -39.8767
-                    ],
-                    [
-                        142.3783,
-                        -39.368294
-                    ],
-                    [
-                        142.3783,
-                        -40.64702
-                    ],
-                    [
-                        142.49478,
-                        -42.074874
-                    ],
-                    [
-                        144.009,
-                        -44.060127
-                    ],
-                    [
-                        147.23161,
-                        -44.03222
-                    ],
-                    [
-                        149.05645,
-                        -42.534313
-                    ],
-                    [
-                        149.52237,
-                        -40.99959
-                    ],
-                    [
-                        149.9494,
-                        -40.852921
-                    ],
-                    [
-                        150.8036,
-                        -38.09627
-                    ],
-                    [
-                        151.81313,
-                        -38.12682
-                    ],
-                    [
-                        156.20052,
-                        -22.667706
-                    ],
-                    [
-                        156.20052,
-                        -20.10109
-                    ],
-                    [
-                        156.62761,
-                        -17.417627
-                    ],
-                    [
-                        155.26869,
-                        -17.19521
-                    ],
-                    [
-                        154.14272,
-                        -19.51662
-                    ],
-                    [
-                        153.5215,
-                        -18.34139
-                    ],
-                    [
-                        153.05558,
-                        -16.5636
-                    ],
-                    [
-                        152.78379,
-                        -15.256768
-                    ],
-                    [
-                        152.27905,
-                        -13.4135
-                    ],
-                    [
-                        151.3472,
-                        -12.391767
-                    ],
-                    [
-                        149.48354,
-                        -12.05024
-                    ],
-                    [
-                        146.9598,
-                        -9.992408
-                    ],
-                    [
-                        135.9719,
-                        -9.992408
-                    ],
-                    [
-                        130.3032,
-                        -10.33636
-                    ],
-                    [
-                        128.09016,
-                        -12.164136
-                    ],
-                    [
-                        125.91588,
-                        -12.315912
-                    ],
-                    [
-                        124.3239,
-                        -11.860326
-                    ],
-                    [
-                        122.03323,
-                        -11.974295
-                    ],
-                    [
-                        118.26706,
-                        -16.9353
-                    ],
-                    [
-                        115.93747,
-                        -19.11357
-                    ],
-                    [
-                        114.0738,
-                        -21.11863
-                    ],
-                    [
-                        113.49141,
-                        -22.596033
-                    ],
-                    [
-                        112.28778,
-                        -28.784589
-                    ]
-                ]
-            ],
-            "terms_text": "AGRI"
-        },
-        {
-            "name": "Bing aerial imagery",
-            "type": "bing",
-            "description": "Satellite and aerial imagery.",
-            "template": "http://www.bing.com/maps/",
-            "scaleExtent": [
-                0,
-                22
-            ],
-            "id": "Bing",
-            "default": true
-        },
-        {
-            "name": "British Columbia Mosaic",
-            "type": "tms",
-            "template": "http://{switch:a,b,c,d}.imagery.paulnorman.ca/tiles/bc_mosaic/{zoom}/{x}/{y}.png",
-            "scaleExtent": [
-                9,
-                20
-            ],
-            "polygon": [
-                [
-                    [
-                        -123.3176032,
-                        49.3272567
-                    ],
-                    [
-                        -123.4405258,
-                        49.3268222
-                    ],
-                    [
-                        -123.440717,
-                        49.3384429
-                    ],
-                    [
-                        -123.4398375,
-                        49.3430357
-                    ],
-                    [
-                        -123.4401258,
-                        49.3435398
-                    ],
-                    [
-                        -123.4401106,
-                        49.3439946
-                    ],
-                    [
-                        -123.4406265,
-                        49.3444493
-                    ],
-                    [
-                        -123.4404747,
-                        49.3455762
-                    ],
-                    [
-                        -123.4397768,
-                        49.3460606
-                    ],
-                    [
-                        -123.4389726,
-                        49.3461298
-                    ],
-                    [
-                        -123.4372904,
-                        49.3567236
-                    ],
-                    [
-                        -123.4374774,
-                        49.3710843
-                    ],
-                    [
-                        -123.4335292,
-                        49.3709446
-                    ],
-                    [
-                        -123.4330357,
-                        49.373725
-                    ],
-                    [
-                        -123.4332717,
-                        49.3751221
-                    ],
-                    [
-                        -123.4322847,
-                        49.3761001
-                    ],
-                    [
-                        -123.4317482,
-                        49.3791736
-                    ],
-                    [
-                        -123.4314264,
-                        49.3795927
-                    ],
-                    [
-                        -123.4307826,
-                        49.3823866
-                    ],
-                    [
-                        -123.4313405,
-                        49.3827358
-                    ],
-                    [
-                        -123.4312118,
-                        49.3838533
-                    ],
-                    [
-                        -123.4300415,
-                        49.3845883
-                    ],
-                    [
-                        -123.4189858,
-                        49.3847087
-                    ],
-                    [
-                        -123.4192235,
-                        49.4135198
-                    ],
-                    [
-                        -123.3972532,
-                        49.4135691
-                    ],
-                    [
-                        -123.3972758,
-                        49.4243473
-                    ],
-                    [
-                        -123.4006929,
-                        49.4243314
-                    ],
-                    [
-                        -123.4007741,
-                        49.5703491
-                    ],
-                    [
-                        -123.4000812,
-                        49.570345
-                    ],
-                    [
-                        -123.4010761,
-                        49.5933838
-                    ],
-                    [
-                        -123.3760399,
-                        49.5932848
-                    ],
-                    [
-                        -123.3769811,
-                        49.6756063
-                    ],
-                    [
-                        -123.3507288,
-                        49.6756396
-                    ],
-                    [
-                        -123.3507969,
-                        49.7086751
-                    ],
-                    [
-                        -123.332887,
-                        49.708722
-                    ],
-                    [
-                        -123.3327888,
-                        49.7256288
-                    ],
-                    [
-                        -123.3007111,
-                        49.7255625
-                    ],
-                    [
-                        -123.3009164,
-                        49.7375384
-                    ],
-                    [
-                        -123.2885986,
-                        49.737638
-                    ],
-                    [
-                        -123.2887823,
-                        49.8249207
-                    ],
-                    [
-                        -123.2997955,
-                        49.8249207
-                    ],
-                    [
-                        -123.3011721,
-                        49.8497814
-                    ],
-                    [
-                        -123.3218218,
-                        49.850669
-                    ],
-                    [
-                        -123.3273284,
-                        49.8577696
-                    ],
-                    [
-                        -123.3276726,
-                        49.9758852
-                    ],
-                    [
-                        -123.3008279,
-                        49.9752212
-                    ],
-                    [
-                        -123.3007204,
-                        50.0997002
-                    ],
-                    [
-                        -123.2501716,
-                        50.100735
-                    ],
-                    [
-                        -123.25091,
-                        50.2754901
-                    ],
-                    [
-                        -123.0224338,
-                        50.2755598
-                    ],
-                    [
-                        -123.0224879,
-                        50.3254853
-                    ],
-                    [
-                        -123.0009318,
-                        50.3254689
-                    ],
-                    [
-                        -123.0007778,
-                        50.3423899
-                    ],
-                    [
-                        -122.9775023,
-                        50.3423408
-                    ],
-                    [
-                        -122.9774766,
-                        50.3504306
-                    ],
-                    [
-                        -122.9508137,
-                        50.3504961
-                    ],
-                    [
-                        -122.950795,
-                        50.3711984
-                    ],
-                    [
-                        -122.9325221,
-                        50.3711521
-                    ],
-                    [
-                        -122.9321048,
-                        50.399793
-                    ],
-                    [
-                        -122.8874234,
-                        50.3999748
-                    ],
-                    [
-                        -122.8873385,
-                        50.4256108
-                    ],
-                    [
-                        -122.6620152,
-                        50.4256959
-                    ],
-                    [
-                        -122.6623083,
-                        50.3994506
-                    ],
-                    [
-                        -122.5990316,
-                        50.3992413
-                    ],
-                    [
-                        -122.5988274,
-                        50.3755206
-                    ],
-                    [
-                        -122.5724832,
-                        50.3753706
-                    ],
-                    [
-                        -122.5735621,
-                        50.2493891
-                    ],
-                    [
-                        -122.5990415,
-                        50.2494643
-                    ],
-                    [
-                        -122.5991504,
-                        50.2265663
-                    ],
-                    [
-                        -122.6185016,
-                        50.2266359
-                    ],
-                    [
-                        -122.6185741,
-                        50.2244081
-                    ],
-                    [
-                        -122.6490609,
-                        50.2245126
-                    ],
-                    [
-                        -122.6492181,
-                        50.1993528
-                    ],
-                    [
-                        -122.7308575,
-                        50.1993758
-                    ],
-                    [
-                        -122.7311583,
-                        50.1244287
-                    ],
-                    [
-                        -122.7490352,
-                        50.1245109
-                    ],
-                    [
-                        -122.7490541,
-                        50.0903032
-                    ],
-                    [
-                        -122.7687806,
-                        50.0903435
-                    ],
-                    [
-                        -122.7689801,
-                        49.9494546
-                    ],
-                    [
-                        -122.999047,
-                        49.9494706
-                    ],
-                    [
-                        -122.9991199,
-                        49.8754553
-                    ],
-                    [
-                        -122.9775894,
-                        49.8754553
-                    ],
-                    [
-                        -122.9778145,
-                        49.6995098
-                    ],
-                    [
-                        -122.9992362,
-                        49.6994781
-                    ],
-                    [
-                        -122.9992524,
-                        49.6516526
-                    ],
-                    [
-                        -123.0221525,
-                        49.6516526
-                    ],
-                    [
-                        -123.0221162,
-                        49.5995096
-                    ],
-                    [
-                        -123.0491898,
-                        49.5994625
-                    ],
-                    [
-                        -123.0491898,
-                        49.5940523
-                    ],
-                    [
-                        -123.0664647,
-                        49.5940405
-                    ],
-                    [
-                        -123.0663594,
-                        49.5451868
-                    ],
-                    [
-                        -123.0699906,
-                        49.5451202
-                    ],
-                    [
-                        -123.0699008,
-                        49.5413153
-                    ],
-                    [
-                        -123.0706835,
-                        49.5392837
-                    ],
-                    [
-                        -123.0708888,
-                        49.5379931
-                    ],
-                    [
-                        -123.0711454,
-                        49.5368773
-                    ],
-                    [
-                        -123.0711069,
-                        49.5358115
-                    ],
-                    [
-                        -123.0713764,
-                        49.532822
-                    ],
-                    [
-                        -123.0716458,
-                        49.5321141
-                    ],
-                    [
-                        -123.07171,
-                        49.5313896
-                    ],
-                    [
-                        -123.0720308,
-                        49.5304153
-                    ],
-                    [
-                        -123.0739554,
-                        49.5303486
-                    ],
-                    [
-                        -123.0748023,
-                        49.5294992
-                    ],
-                    [
-                        -123.0748151,
-                        49.5288079
-                    ],
-                    [
-                        -123.0743403,
-                        49.5280584
-                    ],
-                    [
-                        -123.073532,
-                        49.5274588
-                    ],
-                    [
-                        -123.0733652,
-                        49.5270423
-                    ],
-                    [
-                        -123.0732882,
-                        49.5255932
-                    ],
-                    [
-                        -123.0737116,
-                        49.5249602
-                    ],
-                    [
-                        -123.0736218,
-                        49.5244938
-                    ],
-                    [
-                        -123.0992583,
-                        49.5244854
-                    ],
-                    [
-                        -123.0991649,
-                        49.4754502
-                    ],
-                    [
-                        -123.071052,
-                        49.4755252
-                    ],
-                    [
-                        -123.071088,
-                        49.4663034
-                    ],
-                    [
-                        -123.0739204,
-                        49.4663054
-                    ],
-                    [
-                        -123.07422,
-                        49.4505028
-                    ],
-                    [
-                        -123.0746319,
-                        49.4500858
-                    ],
-                    [
-                        -123.074651,
-                        49.449329
-                    ],
-                    [
-                        -123.0745999,
-                        49.449018
-                    ],
-                    [
-                        -123.0744619,
-                        49.4486927
-                    ],
-                    [
-                        -123.0743336,
-                        49.4479899
-                    ],
-                    [
-                        -123.0742427,
-                        49.4477688
-                    ],
-                    [
-                        -123.0743061,
-                        49.4447473
-                    ],
-                    [
-                        -123.0747103,
-                        49.4447556
-                    ],
-                    [
-                        -123.0746384,
-                        49.4377306
-                    ],
-                    [
-                        -122.9996506,
-                        49.4377363
-                    ],
-                    [
-                        -122.9996506,
-                        49.4369214
-                    ],
-                    [
-                        -122.8606163,
-                        49.4415314
-                    ],
-                    [
-                        -122.8102616,
-                        49.4423972
-                    ],
-                    [
-                        -122.8098984,
-                        49.3766739
-                    ],
-                    [
-                        -122.4036093,
-                        49.3766617
-                    ],
-                    [
-                        -122.4036341,
-                        49.3771944
-                    ],
-                    [
-                        -122.264739,
-                        49.3773028
-                    ],
-                    [
-                        -122.263542,
-                        49.2360088
-                    ],
-                    [
-                        -122.2155742,
-                        49.236139
-                    ],
-                    [
-                        -122.0580956,
-                        49.235878
-                    ],
-                    [
-                        -121.9538274,
-                        49.2966525
-                    ],
-                    [
-                        -121.9400911,
-                        49.3045389
-                    ],
-                    [
-                        -121.9235761,
-                        49.3142257
-                    ],
-                    [
-                        -121.8990871,
-                        49.3225436
-                    ],
-                    [
-                        -121.8883447,
-                        49.3259752
-                    ],
-                    [
-                        -121.8552982,
-                        49.3363575
-                    ],
-                    [
-                        -121.832697,
-                        49.3441519
-                    ],
-                    [
-                        -121.7671336,
-                        49.3654361
-                    ],
-                    [
-                        -121.6736683,
-                        49.3654589
-                    ],
-                    [
-                        -121.6404153,
-                        49.3743775
-                    ],
-                    [
-                        -121.5961976,
-                        49.3860493
-                    ],
-                    [
-                        -121.5861178,
-                        49.3879193
-                    ],
-                    [
-                        -121.5213684,
-                        49.3994649
-                    ],
-                    [
-                        -121.5117375,
-                        49.4038378
-                    ],
-                    [
-                        -121.4679302,
-                        49.4229024
-                    ],
-                    [
-                        -121.4416803,
-                        49.4345607
-                    ],
-                    [
-                        -121.422429,
-                        49.4345788
-                    ],
-                    [
-                        -121.3462885,
-                        49.3932312
-                    ],
-                    [
-                        -121.3480144,
-                        49.3412388
-                    ],
-                    [
-                        -121.5135035,
-                        49.320577
-                    ],
-                    [
-                        -121.6031683,
-                        49.2771727
-                    ],
-                    [
-                        -121.6584065,
-                        49.1856125
-                    ],
-                    [
-                        -121.679953,
-                        49.1654109
-                    ],
-                    [
-                        -121.7815793,
-                        49.0702559
-                    ],
-                    [
-                        -121.8076228,
-                        49.0622471
-                    ],
-                    [
-                        -121.9393997,
-                        49.0636219
-                    ],
-                    [
-                        -121.9725524,
-                        49.0424179
-                    ],
-                    [
-                        -121.9921394,
-                        49.0332869
-                    ],
-                    [
-                        -122.0035289,
-                        49.0273413
-                    ],
-                    [
-                        -122.0178564,
-                        49.0241067
-                    ],
-                    [
-                        -122.1108634,
-                        48.9992786
-                    ],
-                    [
-                        -122.1493067,
-                        48.9995305
-                    ],
-                    [
-                        -122.1492705,
-                        48.9991498
-                    ],
-                    [
-                        -122.1991447,
-                        48.9996019
-                    ],
-                    [
-                        -122.199181,
-                        48.9991974
-                    ],
-                    [
-                        -122.234365,
-                        48.9994829
-                    ],
-                    [
-                        -122.234365,
-                        49.000173
-                    ],
-                    [
-                        -122.3994722,
-                        49.0012385
-                    ],
-                    [
-                        -122.4521338,
-                        49.0016326
-                    ],
-                    [
-                        -122.4521338,
-                        49.000883
-                    ],
-                    [
-                        -122.4584089,
-                        49.0009306
-                    ],
-                    [
-                        -122.4584814,
-                        48.9993124
-                    ],
-                    [
-                        -122.4992458,
-                        48.9995022
-                    ],
-                    [
-                        -122.4992458,
-                        48.9992906
-                    ],
-                    [
-                        -122.5492618,
-                        48.9995107
-                    ],
-                    [
-                        -122.5492564,
-                        48.9993206
-                    ],
-                    [
-                        -122.6580785,
-                        48.9994212
-                    ],
-                    [
-                        -122.6581061,
-                        48.9954007
-                    ],
-                    [
-                        -122.7067604,
-                        48.9955344
-                    ],
-                    [
-                        -122.7519761,
-                        48.9956392
-                    ],
-                    [
-                        -122.7922063,
-                        48.9957204
-                    ],
-                    [
-                        -122.7921907,
-                        48.9994331
-                    ],
-                    [
-                        -123.0350417,
-                        48.9995724
-                    ],
-                    [
-                        -123.0350437,
-                        49.0000958
-                    ],
-                    [
-                        -123.0397091,
-                        49.0000536
-                    ],
-                    [
-                        -123.0397444,
-                        49.0001812
-                    ],
-                    [
-                        -123.0485506,
-                        49.0001348
-                    ],
-                    [
-                        -123.0485329,
-                        49.0004712
-                    ],
-                    [
-                        -123.0557122,
-                        49.000448
-                    ],
-                    [
-                        -123.0556324,
-                        49.0002284
-                    ],
-                    [
-                        -123.0641365,
-                        49.0001293
-                    ],
-                    [
-                        -123.064158,
-                        48.9999421
-                    ],
-                    [
-                        -123.074899,
-                        48.9996928
-                    ],
-                    [
-                        -123.0750717,
-                        49.0006218
-                    ],
-                    [
-                        -123.0899573,
-                        49.0003726
-                    ],
-                    [
-                        -123.109229,
-                        48.9999421
-                    ],
-                    [
-                        -123.1271193,
-                        49.0003046
-                    ],
-                    [
-                        -123.1359953,
-                        48.9998741
-                    ],
-                    [
-                        -123.1362716,
-                        49.0005765
-                    ],
-                    [
-                        -123.153851,
-                        48.9998061
-                    ],
-                    [
-                        -123.1540533,
-                        49.0006806
-                    ],
-                    [
-                        -123.1710015,
-                        49.0001274
-                    ],
-                    [
-                        -123.2000916,
-                        48.9996849
-                    ],
-                    [
-                        -123.2003446,
-                        49.0497785
-                    ],
-                    [
-                        -123.2108845,
-                        49.0497232
-                    ],
-                    [
-                        -123.2112218,
-                        49.051989
-                    ],
-                    [
-                        -123.2070479,
-                        49.0520857
-                    ],
-                    [
-                        -123.2078911,
-                        49.0607884
-                    ],
-                    [
-                        -123.2191688,
-                        49.0600978
-                    ],
-                    [
-                        -123.218958,
-                        49.0612719
-                    ],
-                    [
-                        -123.2251766,
-                        49.0612719
-                    ],
-                    [
-                        -123.2253874,
-                        49.0622388
-                    ],
-                    [
-                        -123.2297088,
-                        49.0620316
-                    ],
-                    [
-                        -123.2298142,
-                        49.068592
-                    ],
-                    [
-                        -123.2331869,
-                        49.0687301
-                    ],
-                    [
-                        -123.2335031,
-                        49.0705945
-                    ],
-                    [
-                        -123.249313,
-                        49.0702493
-                    ],
-                    [
-                        -123.2497346,
-                        49.0802606
-                    ],
-                    [
-                        -123.2751358,
-                        49.0803986
-                    ],
-                    [
-                        -123.2751358,
-                        49.0870947
-                    ],
-                    [
-                        -123.299483,
-                        49.0873018
-                    ],
-                    [
-                        -123.29944,
-                        49.080253
-                    ],
-                    [
-                        -123.3254508,
-                        49.0803944
-                    ],
-                    [
-                        -123.3254353,
-                        49.1154662
-                    ],
-                    [
-                        -123.2750966,
-                        49.1503341
-                    ],
-                    [
-                        -123.275181,
-                        49.1873267
-                    ],
-                    [
-                        -123.2788067,
-                        49.1871063
-                    ],
-                    [
-                        -123.278891,
-                        49.1910741
-                    ],
-                    [
-                        -123.3004767,
-                        49.1910741
-                    ],
-                    [
-                        -123.3004186,
-                        49.2622933
-                    ],
-                    [
-                        -123.3126185,
-                        49.2622416
-                    ],
-                    [
-                        -123.3125958,
-                        49.2714948
-                    ],
-                    [
-                        -123.3154251,
-                        49.2714727
-                    ],
-                    [
-                        -123.3156628,
-                        49.2818906
-                    ],
-                    [
-                        -123.3174735,
-                        49.2818832
-                    ],
-                    [
-                        -123.3174961,
-                        49.2918488
-                    ],
-                    [
-                        -123.3190353,
-                        49.2918488
-                    ],
-                    [
-                        -123.3190692,
-                        49.298602
-                    ],
-                    [
-                        -123.3202349,
-                        49.2985651
-                    ],
-                    [
-                        -123.3202786,
-                        49.3019749
-                    ],
-                    [
-                        -123.3222679,
-                        49.3019605
-                    ],
-                    [
-                        -123.3223943,
-                        49.3118263
-                    ],
-                    [
-                        -123.3254002,
-                        49.3118086
-                    ],
-                    [
-                        -123.3253898,
-                        49.3201721
-                    ],
-                    [
-                        -123.3192695,
-                        49.3201957
-                    ],
-                    [
-                        -123.3192242,
-                        49.3246748
-                    ],
-                    [
-                        -123.3179437,
-                        49.3246596
-                    ],
-                    [
-                        -123.3179861,
-                        49.3254065
-                    ]
-                ]
-            ],
-            "terms_url": "http://imagery.paulnorman.ca/tiles/about.html",
-            "terms_text": "Copyright Province of British Columbia, City of Surrey"
-        },
-        {
-            "name": "Cambodia, Laos, Thailand, Vietnam bilingual",
-            "type": "tms",
-            "template": "http://{switch:a,b,c,d}.tile.osm-tools.org/osm_then/{zoom}/{x}/{y}.png",
-            "scaleExtent": [
-                0,
-                19
-            ],
-            "polygon": [
-                [
-                    [
-                        97.3,
-                        5.6
-                    ],
-                    [
-                        97.3,
-                        23.4
-                    ],
-                    [
-                        109.6,
-                        23.4
-                    ],
-                    [
-                        109.6,
-                        5.6
-                    ],
-                    [
-                        97.3,
-                        5.6
-                    ]
-                ]
-            ],
-            "terms_url": "http://www.osm-tools.org/",
-            "terms_text": "© osm-tools.org & OpenStreetMap contributors, CC-BY-SA"
-        },
-        {
-            "name": "Freemap.sk Car",
-            "type": "tms",
-            "template": "http://t{switch:1,2,3,4}.freemap.sk/A/{zoom}/{x}/{y}.jpeg",
-            "scaleExtent": [
-                8,
-                16
-            ],
-            "polygon": [
-                [
-                    [
-                        19.83682,
-                        49.25529
-                    ],
-                    [
-                        19.80075,
-                        49.42385
-                    ],
-                    [
-                        19.60437,
-                        49.48058
-                    ],
-                    [
-                        19.49179,
-                        49.63961
-                    ],
-                    [
-                        19.21831,
-                        49.52604
-                    ],
-                    [
-                        19.16778,
-                        49.42521
-                    ],
-                    [
-                        19.00308,
-                        49.42236
-                    ],
-                    [
-                        18.97611,
-                        49.5308
-                    ],
-                    [
-                        18.54685,
-                        49.51425
-                    ],
-                    [
-                        18.31432,
-                        49.33818
-                    ],
-                    [
-                        18.15913,
-                        49.2961
-                    ],
-                    [
-                        18.05564,
-                        49.11134
-                    ],
-                    [
-                        17.56396,
-                        48.84938
-                    ],
-                    [
-                        17.17929,
-                        48.88816
-                    ],
-                    [
-                        17.058,
-                        48.81105
-                    ],
-                    [
-                        16.90426,
-                        48.61947
-                    ],
-                    [
-                        16.79685,
-                        48.38561
-                    ],
-                    [
-                        17.06762,
-                        48.01116
-                    ],
-                    [
-                        17.32787,
-                        47.97749
-                    ],
-                    [
-                        17.51699,
-                        47.82535
-                    ],
-                    [
-                        17.74776,
-                        47.73093
-                    ],
-                    [
-                        18.29515,
-                        47.72075
-                    ],
-                    [
-                        18.67959,
-                        47.75541
-                    ],
-                    [
-                        18.89755,
-                        47.81203
-                    ],
-                    [
-                        18.79463,
-                        47.88245
-                    ],
-                    [
-                        18.84318,
-                        48.04046
-                    ],
-                    [
-                        19.46212,
-                        48.05333
-                    ],
-                    [
-                        19.62064,
-                        48.22938
-                    ],
-                    [
-                        19.89585,
-                        48.09387
-                    ],
-                    [
-                        20.33766,
-                        48.2643
-                    ],
-                    [
-                        20.55395,
-                        48.52358
-                    ],
-                    [
-                        20.82335,
-                        48.55714
-                    ],
-                    [
-                        21.10271,
-                        48.47096
-                    ],
-                    [
-                        21.45863,
-                        48.55513
-                    ],
-                    [
-                        21.74536,
-                        48.31435
-                    ],
-                    [
-                        22.15293,
-                        48.37179
-                    ],
-                    [
-                        22.61255,
-                        49.08914
-                    ],
-                    [
-                        22.09997,
-                        49.23814
-                    ],
-                    [
-                        21.9686,
-                        49.36363
-                    ],
-                    [
-                        21.6244,
-                        49.46989
-                    ],
-                    [
-                        21.06873,
-                        49.46402
-                    ],
-                    [
-                        20.94336,
-                        49.31088
-                    ],
-                    [
-                        20.73052,
-                        49.44006
-                    ],
-                    [
-                        20.22804,
-                        49.41714
-                    ],
-                    [
-                        20.05234,
-                        49.23052
-                    ],
-                    [
-                        19.83682,
-                        49.25529
-                    ]
-                ]
-            ],
-            "terms_text": "Copyright ©2007-2012 Freemap Slovakia (www.freemap.sk). Some rights reserved."
-        },
-        {
-            "name": "Freemap.sk Cyclo",
-            "type": "tms",
-            "template": "http://t{switch:1,2,3,4}.freemap.sk/C/{zoom}/{x}/{y}.jpeg",
-            "scaleExtent": [
-                8,
-                16
-            ],
-            "polygon": [
-                [
-                    [
-                        19.83682,
-                        49.25529
-                    ],
-                    [
-                        19.80075,
-                        49.42385
-                    ],
-                    [
-                        19.60437,
-                        49.48058
-                    ],
-                    [
-                        19.49179,
-                        49.63961
-                    ],
-                    [
-                        19.21831,
-                        49.52604
-                    ],
-                    [
-                        19.16778,
-                        49.42521
-                    ],
-                    [
-                        19.00308,
-                        49.42236
-                    ],
-                    [
-                        18.97611,
-                        49.5308
-                    ],
-                    [
-                        18.54685,
-                        49.51425
-                    ],
-                    [
-                        18.31432,
-                        49.33818
-                    ],
-                    [
-                        18.15913,
-                        49.2961
-                    ],
-                    [
-                        18.05564,
-                        49.11134
-                    ],
-                    [
-                        17.56396,
-                        48.84938
-                    ],
-                    [
-                        17.17929,
-                        48.88816
-                    ],
-                    [
-                        17.058,
-                        48.81105
-                    ],
-                    [
-                        16.90426,
-                        48.61947
-                    ],
-                    [
-                        16.79685,
-                        48.38561
-                    ],
-                    [
-                        17.06762,
-                        48.01116
-                    ],
-                    [
-                        17.32787,
-                        47.97749
-                    ],
-                    [
-                        17.51699,
-                        47.82535
-                    ],
-                    [
-                        17.74776,
-                        47.73093
-                    ],
-                    [
-                        18.29515,
-                        47.72075
-                    ],
-                    [
-                        18.67959,
-                        47.75541
-                    ],
-                    [
-                        18.89755,
-                        47.81203
-                    ],
-                    [
-                        18.79463,
-                        47.88245
-                    ],
-                    [
-                        18.84318,
-                        48.04046
-                    ],
-                    [
-                        19.46212,
-                        48.05333
-                    ],
-                    [
-                        19.62064,
-                        48.22938
-                    ],
-                    [
-                        19.89585,
-                        48.09387
-                    ],
-                    [
-                        20.33766,
-                        48.2643
-                    ],
-                    [
-                        20.55395,
-                        48.52358
-                    ],
-                    [
-                        20.82335,
-                        48.55714
-                    ],
-                    [
-                        21.10271,
-                        48.47096
-                    ],
-                    [
-                        21.45863,
-                        48.55513
-                    ],
-                    [
-                        21.74536,
-                        48.31435
-                    ],
-                    [
-                        22.15293,
-                        48.37179
-                    ],
-                    [
-                        22.61255,
-                        49.08914
-                    ],
-                    [
-                        22.09997,
-                        49.23814
-                    ],
-                    [
-                        21.9686,
-                        49.36363
-                    ],
-                    [
-                        21.6244,
-                        49.46989
-                    ],
-                    [
-                        21.06873,
-                        49.46402
-                    ],
-                    [
-                        20.94336,
-                        49.31088
-                    ],
-                    [
-                        20.73052,
-                        49.44006
-                    ],
-                    [
-                        20.22804,
-                        49.41714
-                    ],
-                    [
-                        20.05234,
-                        49.23052
-                    ],
-                    [
-                        19.83682,
-                        49.25529
-                    ]
-                ]
-            ],
-            "terms_text": "Copyright ©2007-2012 Freemap Slovakia (www.freemap.sk). Some rights reserved."
-        },
-        {
-            "name": "Freemap.sk Hiking",
-            "type": "tms",
-            "template": "http://t{switch:1,2,3,4}.freemap.sk/T/{zoom}/{x}/{y}.jpeg",
-            "scaleExtent": [
-                8,
-                16
-            ],
-            "polygon": [
-                [
-                    [
-                        19.83682,
-                        49.25529
-                    ],
-                    [
-                        19.80075,
-                        49.42385
-                    ],
-                    [
-                        19.60437,
-                        49.48058
-                    ],
-                    [
-                        19.49179,
-                        49.63961
-                    ],
-                    [
-                        19.21831,
-                        49.52604
-                    ],
-                    [
-                        19.16778,
-                        49.42521
-                    ],
-                    [
-                        19.00308,
-                        49.42236
-                    ],
-                    [
-                        18.97611,
-                        49.5308
-                    ],
-                    [
-                        18.54685,
-                        49.51425
-                    ],
-                    [
-                        18.31432,
-                        49.33818
-                    ],
-                    [
-                        18.15913,
-                        49.2961
-                    ],
-                    [
-                        18.05564,
-                        49.11134
-                    ],
-                    [
-                        17.56396,
-                        48.84938
-                    ],
-                    [
-                        17.17929,
-                        48.88816
-                    ],
-                    [
-                        17.058,
-                        48.81105
-                    ],
-                    [
-                        16.90426,
-                        48.61947
-                    ],
-                    [
-                        16.79685,
-                        48.38561
-                    ],
-                    [
-                        17.06762,
-                        48.01116
-                    ],
-                    [
-                        17.32787,
-                        47.97749
-                    ],
-                    [
-                        17.51699,
-                        47.82535
-                    ],
-                    [
-                        17.74776,
-                        47.73093
-                    ],
-                    [
-                        18.29515,
-                        47.72075
-                    ],
-                    [
-                        18.67959,
-                        47.75541
-                    ],
-                    [
-                        18.89755,
-                        47.81203
-                    ],
-                    [
-                        18.79463,
-                        47.88245
-                    ],
-                    [
-                        18.84318,
-                        48.04046
-                    ],
-                    [
-                        19.46212,
-                        48.05333
-                    ],
-                    [
-                        19.62064,
-                        48.22938
-                    ],
-                    [
-                        19.89585,
-                        48.09387
-                    ],
-                    [
-                        20.33766,
-                        48.2643
-                    ],
-                    [
-                        20.55395,
-                        48.52358
-                    ],
-                    [
-                        20.82335,
-                        48.55714
-                    ],
-                    [
-                        21.10271,
-                        48.47096
-                    ],
-                    [
-                        21.45863,
-                        48.55513
-                    ],
-                    [
-                        21.74536,
-                        48.31435
-                    ],
-                    [
-                        22.15293,
-                        48.37179
-                    ],
-                    [
-                        22.61255,
-                        49.08914
-                    ],
-                    [
-                        22.09997,
-                        49.23814
-                    ],
-                    [
-                        21.9686,
-                        49.36363
-                    ],
-                    [
-                        21.6244,
-                        49.46989
-                    ],
-                    [
-                        21.06873,
-                        49.46402
-                    ],
-                    [
-                        20.94336,
-                        49.31088
-                    ],
-                    [
-                        20.73052,
-                        49.44006
-                    ],
-                    [
-                        20.22804,
-                        49.41714
-                    ],
-                    [
-                        20.05234,
-                        49.23052
-                    ],
-                    [
-                        19.83682,
-                        49.25529
-                    ]
-                ]
-            ],
-            "terms_text": "Copyright ©2007-2012 Freemap Slovakia (www.freemap.sk). Some rights reserved."
-        },
-        {
-            "name": "Freemap.sk Ski",
-            "type": "tms",
-            "template": "http://t{switch:1,2,3,4}.freemap.sk/K/{zoom}/{x}/{y}.jpeg",
-            "scaleExtent": [
-                8,
-                16
-            ],
-            "polygon": [
-                [
-                    [
-                        19.83682,
-                        49.25529
-                    ],
-                    [
-                        19.80075,
-                        49.42385
-                    ],
-                    [
-                        19.60437,
-                        49.48058
-                    ],
-                    [
-                        19.49179,
-                        49.63961
-                    ],
-                    [
-                        19.21831,
-                        49.52604
-                    ],
-                    [
-                        19.16778,
-                        49.42521
-                    ],
-                    [
-                        19.00308,
-                        49.42236
-                    ],
-                    [
-                        18.97611,
-                        49.5308
-                    ],
-                    [
-                        18.54685,
-                        49.51425
-                    ],
-                    [
-                        18.31432,
-                        49.33818
-                    ],
-                    [
-                        18.15913,
-                        49.2961
-                    ],
-                    [
-                        18.05564,
-                        49.11134
-                    ],
-                    [
-                        17.56396,
-                        48.84938
-                    ],
-                    [
-                        17.17929,
-                        48.88816
-                    ],
-                    [
-                        17.058,
-                        48.81105
-                    ],
-                    [
-                        16.90426,
-                        48.61947
-                    ],
-                    [
-                        16.79685,
-                        48.38561
-                    ],
-                    [
-                        17.06762,
-                        48.01116
-                    ],
-                    [
-                        17.32787,
-                        47.97749
-                    ],
-                    [
-                        17.51699,
-                        47.82535
-                    ],
-                    [
-                        17.74776,
-                        47.73093
-                    ],
-                    [
-                        18.29515,
-                        47.72075
-                    ],
-                    [
-                        18.67959,
-                        47.75541
-                    ],
-                    [
-                        18.89755,
-                        47.81203
-                    ],
-                    [
-                        18.79463,
-                        47.88245
-                    ],
-                    [
-                        18.84318,
-                        48.04046
-                    ],
-                    [
-                        19.46212,
-                        48.05333
-                    ],
-                    [
-                        19.62064,
-                        48.22938
-                    ],
-                    [
-                        19.89585,
-                        48.09387
-                    ],
-                    [
-                        20.33766,
-                        48.2643
-                    ],
-                    [
-                        20.55395,
-                        48.52358
-                    ],
-                    [
-                        20.82335,
-                        48.55714
-                    ],
-                    [
-                        21.10271,
-                        48.47096
-                    ],
-                    [
-                        21.45863,
-                        48.55513
-                    ],
-                    [
-                        21.74536,
-                        48.31435
-                    ],
-                    [
-                        22.15293,
-                        48.37179
-                    ],
-                    [
-                        22.61255,
-                        49.08914
-                    ],
-                    [
-                        22.09997,
-                        49.23814
-                    ],
-                    [
-                        21.9686,
-                        49.36363
-                    ],
-                    [
-                        21.6244,
-                        49.46989
-                    ],
-                    [
-                        21.06873,
-                        49.46402
-                    ],
-                    [
-                        20.94336,
-                        49.31088
-                    ],
-                    [
-                        20.73052,
-                        49.44006
-                    ],
-                    [
-                        20.22804,
-                        49.41714
-                    ],
-                    [
-                        20.05234,
-                        49.23052
-                    ],
-                    [
-                        19.83682,
-                        49.25529
-                    ]
-                ]
-            ],
-            "terms_text": "Copyright ©2007-2012 Freemap Slovakia (www.freemap.sk). Some rights reserved."
-        },
-        {
-            "name": "Fugro (Denmark)",
-            "type": "tms",
-            "template": "http://{switch:a,b,c}.tile.openstreetmap.dk/fugro2005/{zoom}/{x}/{y}.png",
-            "scaleExtent": [
-                0,
-                19
-            ],
-            "polygon": [
-                [
-                    [
-                        8.3743941,
-                        54.9551655
-                    ],
-                    [
-                        8.3683809,
-                        55.4042149
-                    ],
-                    [
-                        8.2103997,
-                        55.4039795
-                    ],
-                    [
-                        8.2087314,
-                        55.4937345
-                    ],
-                    [
-                        8.0502655,
-                        55.4924731
-                    ],
-                    [
-                        8.0185123,
-                        56.7501399
-                    ],
-                    [
-                        8.1819161,
-                        56.7509948
-                    ],
-                    [
-                        8.1763274,
-                        57.0208898
-                    ],
-                    [
-                        8.3413329,
-                        57.0219872
-                    ],
-                    [
-                        8.3392467,
-                        57.1119574
-                    ],
-                    [
-                        8.5054433,
-                        57.1123212
-                    ],
-                    [
-                        8.5033923,
-                        57.2020499
-                    ],
-                    [
-                        9.3316304,
-                        57.2027636
-                    ],
-                    [
-                        9.3319079,
-                        57.2924835
-                    ],
-                    [
-                        9.4978864,
-                        57.2919578
-                    ],
-                    [
-                        9.4988593,
-                        57.3820608
-                    ],
-                    [
-                        9.6649749,
-                        57.3811615
-                    ],
-                    [
-                        9.6687295,
-                        57.5605591
-                    ],
-                    [
-                        9.8351961,
-                        57.5596265
-                    ],
-                    [
-                        9.8374896,
-                        57.6493322
-                    ],
-                    [
-                        10.1725726,
-                        57.6462818
-                    ],
-                    [
-                        10.1754245,
-                        57.7367768
-                    ],
-                    [
-                        10.5118282,
-                        57.7330269
-                    ],
-                    [
-                        10.5152095,
-                        57.8228945
-                    ],
-                    [
-                        10.6834853,
-                        57.8207722
-                    ],
-                    [
-                        10.6751613,
-                        57.6412021
-                    ],
-                    [
-                        10.5077045,
-                        57.6433097
-                    ],
-                    [
-                        10.5039992,
-                        57.5535088
-                    ],
-                    [
-                        10.671038,
-                        57.5514113
-                    ],
-                    [
-                        10.6507805,
-                        57.1024538
-                    ],
-                    [
-                        10.4857673,
-                        57.1045138
-                    ],
-                    [
-                        10.4786236,
-                        56.9249051
-                    ],
-                    [
-                        10.3143981,
-                        56.9267573
-                    ],
-                    [
-                        10.3112341,
-                        56.8369269
-                    ],
-                    [
-                        10.4750295,
-                        56.83509
-                    ],
-                    [
-                        10.4649016,
-                        56.5656681
-                    ],
-                    [
-                        10.9524239,
-                        56.5589761
-                    ],
-                    [
-                        10.9479249,
-                        56.4692243
-                    ],
-                    [
-                        11.1099335,
-                        56.4664675
-                    ],
-                    [
-                        11.1052639,
-                        56.376833
-                    ],
-                    [
-                        10.9429901,
-                        56.3795284
-                    ],
-                    [
-                        10.9341235,
-                        56.1994768
-                    ],
-                    [
-                        10.7719685,
-                        56.2020244
-                    ],
-                    [
-                        10.7694751,
-                        56.1120103
-                    ],
-                    [
-                        10.6079695,
-                        56.1150259
-                    ],
-                    [
-                        10.4466742,
-                        56.116717
-                    ],
-                    [
-                        10.2865948,
-                        56.118675
-                    ],
-                    [
-                        10.2831527,
-                        56.0281851
-                    ],
-                    [
-                        10.4439274,
-                        56.0270388
-                    ],
-                    [
-                        10.4417713,
-                        55.7579243
-                    ],
-                    [
-                        10.4334961,
-                        55.6693533
-                    ],
-                    [
-                        10.743814,
-                        55.6646861
-                    ],
-                    [
-                        10.743814,
-                        55.5712253
-                    ],
-                    [
-                        10.8969041,
-                        55.5712253
-                    ],
-                    [
-                        10.9051793,
-                        55.3953852
-                    ],
-                    [
-                        11.0613726,
-                        55.3812841
-                    ],
-                    [
-                        11.0593038,
-                        55.1124061
-                    ],
-                    [
-                        11.0458567,
-                        55.0318621
-                    ],
-                    [
-                        11.2030844,
-                        55.0247474
-                    ],
-                    [
-                        11.2030844,
-                        55.117139
-                    ],
-                    [
-                        11.0593038,
-                        55.1124061
-                    ],
-                    [
-                        11.0613726,
-                        55.3812841
-                    ],
-                    [
-                        11.0789572,
-                        55.5712253
-                    ],
-                    [
-                        10.8969041,
-                        55.5712253
-                    ],
-                    [
-                        10.9258671,
-                        55.6670198
-                    ],
-                    [
-                        10.743814,
-                        55.6646861
-                    ],
-                    [
-                        10.7562267,
-                        55.7579243
-                    ],
-                    [
-                        10.4417713,
-                        55.7579243
-                    ],
-                    [
-                        10.4439274,
-                        56.0270388
-                    ],
-                    [
-                        10.4466742,
-                        56.116717
-                    ],
-                    [
-                        10.6079695,
-                        56.1150259
-                    ],
-                    [
-                        10.6052053,
-                        56.0247462
-                    ],
-                    [
-                        10.9258671,
-                        56.0201215
-                    ],
-                    [
-                        10.9197132,
-                        55.9309388
-                    ],
-                    [
-                        11.0802782,
-                        55.92792
-                    ],
-                    [
-                        11.0858066,
-                        56.0178284
-                    ],
-                    [
-                        11.7265047,
-                        56.005058
-                    ],
-                    [
-                        11.7319981,
-                        56.0952142
-                    ],
-                    [
-                        12.0540333,
-                        56.0871256
-                    ],
-                    [
-                        12.0608477,
-                        56.1762576
-                    ],
-                    [
-                        12.7023469,
-                        56.1594405
-                    ],
-                    [
-                        12.6611131,
-                        55.7114318
-                    ],
-                    [
-                        12.9792318,
-                        55.7014026
-                    ],
-                    [
-                        12.9612912,
-                        55.5217294
-                    ],
-                    [
-                        12.3268659,
-                        55.5412096
-                    ],
-                    [
-                        12.3206071,
-                        55.4513655
-                    ],
-                    [
-                        12.4778226,
-                        55.447067
-                    ],
-                    [
-                        12.4702432,
-                        55.3570479
-                    ],
-                    [
-                        12.6269738,
-                        55.3523837
-                    ],
-                    [
-                        12.6200898,
-                        55.2632576
-                    ],
-                    [
-                        12.4627339,
-                        55.26722
-                    ],
-                    [
-                        12.4552949,
-                        55.1778223
-                    ],
-                    [
-                        12.2987046,
-                        55.1822303
-                    ],
-                    [
-                        12.2897344,
-                        55.0923641
-                    ],
-                    [
-                        12.6048608,
-                        55.0832904
-                    ],
-                    [
-                        12.5872011,
-                        54.9036285
-                    ],
-                    [
-                        12.2766618,
-                        54.9119031
-                    ],
-                    [
-                        12.2610181,
-                        54.7331602
-                    ],
-                    [
-                        12.1070691,
-                        54.7378161
-                    ],
-                    [
-                        12.0858621,
-                        54.4681655
-                    ],
-                    [
-                        11.7794953,
-                        54.4753579
-                    ],
-                    [
-                        11.7837381,
-                        54.5654783
-                    ],
-                    [
-                        11.1658525,
-                        54.5782155
-                    ],
-                    [
-                        11.1706443,
-                        54.6686508
-                    ],
-                    [
-                        10.8617173,
-                        54.6733956
-                    ],
-                    [
-                        10.8651245,
-                        54.7634667
-                    ],
-                    [
-                        10.7713646,
-                        54.7643888
-                    ],
-                    [
-                        10.7707276,
-                        54.7372807
-                    ],
-                    [
-                        10.7551428,
-                        54.7375776
-                    ],
-                    [
-                        10.7544039,
-                        54.7195666
-                    ],
-                    [
-                        10.7389074,
-                        54.7197588
-                    ],
-                    [
-                        10.7384368,
-                        54.7108482
-                    ],
-                    [
-                        10.7074486,
-                        54.7113045
-                    ],
-                    [
-                        10.7041094,
-                        54.6756741
-                    ],
-                    [
-                        10.5510973,
-                        54.6781698
-                    ],
-                    [
-                        10.5547184,
-                        54.7670245
-                    ],
-                    [
-                        10.2423994,
-                        54.7705935
-                    ],
-                    [
-                        10.2459845,
-                        54.8604673
-                    ],
-                    [
-                        10.0902268,
-                        54.8622134
-                    ],
-                    [
-                        10.0873731,
-                        54.7723851
-                    ],
-                    [
-                        9.1555798,
-                        54.7769557
-                    ],
-                    [
-                        9.1562752,
-                        54.8675369
-                    ],
-                    [
-                        8.5321973,
-                        54.8663765
-                    ],
-                    [
-                        8.531432,
-                        54.95516
-                    ]
-                ],
-                [
-                    [
-                        11.4577738,
-                        56.819554
-                    ],
-                    [
-                        11.7849181,
-                        56.8127385
-                    ],
-                    [
-                        11.7716715,
-                        56.6332796
-                    ],
-                    [
-                        11.4459621,
-                        56.6401087
-                    ]
-                ],
-                [
-                    [
-                        11.3274736,
-                        57.3612962
-                    ],
-                    [
-                        11.3161808,
-                        57.1818004
-                    ],
-                    [
-                        11.1508692,
-                        57.1847276
-                    ],
-                    [
-                        11.1456628,
-                        57.094962
-                    ],
-                    [
-                        10.8157703,
-                        57.1001693
-                    ],
-                    [
-                        10.8290599,
-                        57.3695272
-                    ]
-                ],
-                [
-                    [
-                        11.5843266,
-                        56.2777928
-                    ],
-                    [
-                        11.5782882,
-                        56.1880397
-                    ],
-                    [
-                        11.7392309,
-                        56.1845765
-                    ],
-                    [
-                        11.7456428,
-                        56.2743186
-                    ]
-                ],
-                [
-                    [
-                        14.6825922,
-                        55.3639405
-                    ],
-                    [
-                        14.8395247,
-                        55.3565231
-                    ],
-                    [
-                        14.8263755,
-                        55.2671261
-                    ],
-                    [
-                        15.1393406,
-                        55.2517359
-                    ],
-                    [
-                        15.1532015,
-                        55.3410836
-                    ],
-                    [
-                        15.309925,
-                        55.3330556
-                    ],
-                    [
-                        15.295719,
-                        55.2437356
-                    ],
-                    [
-                        15.1393406,
-                        55.2517359
-                    ],
-                    [
-                        15.1255631,
-                        55.1623802
-                    ],
-                    [
-                        15.2815819,
-                        55.1544167
-                    ],
-                    [
-                        15.2535578,
-                        54.9757646
-                    ],
-                    [
-                        14.6317464,
-                        55.0062496
-                    ]
-                ]
-            ],
-            "terms_url": "http://wiki.openstreetmap.org/wiki/Fugro",
-            "terms_text": "Fugro Aerial Mapping"
-        },
-        {
-            "name": "Geodatastyrelsen (Denmark)",
-            "type": "tms",
-            "template": "http://mapproxy.gpweb.dk/tiles/1.0.0/kortforsyningen_ortoforaar/EPSG3857/{zoom}/{x}/{y}.jpeg",
-            "scaleExtent": [
-                0,
-                21
-            ],
-            "polygon": [
-                [
-                    [
-                        8.3743941,
-                        54.9551655
-                    ],
-                    [
-                        8.3683809,
-                        55.4042149
-                    ],
-                    [
-                        8.2103997,
-                        55.4039795
-                    ],
-                    [
-                        8.2087314,
-                        55.4937345
-                    ],
-                    [
-                        8.0502655,
-                        55.4924731
-                    ],
-                    [
-                        8.0185123,
-                        56.7501399
-                    ],
-                    [
-                        8.1819161,
-                        56.7509948
-                    ],
-                    [
-                        8.1763274,
-                        57.0208898
-                    ],
-                    [
-                        8.3413329,
-                        57.0219872
-                    ],
-                    [
-                        8.3392467,
-                        57.1119574
-                    ],
-                    [
-                        8.5054433,
-                        57.1123212
-                    ],
-                    [
-                        8.5033923,
-                        57.2020499
-                    ],
-                    [
-                        9.3316304,
-                        57.2027636
-                    ],
-                    [
-                        9.3319079,
-                        57.2924835
-                    ],
-                    [
-                        9.4978864,
-                        57.2919578
-                    ],
-                    [
-                        9.4988593,
-                        57.3820608
-                    ],
-                    [
-                        9.6649749,
-                        57.3811615
-                    ],
-                    [
-                        9.6687295,
-                        57.5605591
-                    ],
-                    [
-                        9.8351961,
-                        57.5596265
-                    ],
-                    [
-                        9.8374896,
-                        57.6493322
-                    ],
-                    [
-                        10.1725726,
-                        57.6462818
-                    ],
-                    [
-                        10.1754245,
-                        57.7367768
-                    ],
-                    [
-                        10.5118282,
-                        57.7330269
-                    ],
-                    [
-                        10.5152095,
-                        57.8228945
-                    ],
-                    [
-                        10.6834853,
-                        57.8207722
-                    ],
-                    [
-                        10.6751613,
-                        57.6412021
-                    ],
-                    [
-                        10.5077045,
-                        57.6433097
-                    ],
-                    [
-                        10.5039992,
-                        57.5535088
-                    ],
-                    [
-                        10.671038,
-                        57.5514113
-                    ],
-                    [
-                        10.6507805,
-                        57.1024538
-                    ],
-                    [
-                        10.4857673,
-                        57.1045138
-                    ],
-                    [
-                        10.4786236,
-                        56.9249051
-                    ],
-                    [
-                        10.3143981,
-                        56.9267573
-                    ],
-                    [
-                        10.3112341,
-                        56.8369269
-                    ],
-                    [
-                        10.4750295,
-                        56.83509
-                    ],
-                    [
-                        10.4649016,
-                        56.5656681
-                    ],
-                    [
-                        10.9524239,
-                        56.5589761
-                    ],
-                    [
-                        10.9479249,
-                        56.4692243
-                    ],
-                    [
-                        11.1099335,
-                        56.4664675
-                    ],
-                    [
-                        11.1052639,
-                        56.376833
-                    ],
-                    [
-                        10.9429901,
-                        56.3795284
-                    ],
-                    [
-                        10.9341235,
-                        56.1994768
-                    ],
-                    [
-                        10.7719685,
-                        56.2020244
-                    ],
-                    [
-                        10.7694751,
-                        56.1120103
-                    ],
-                    [
-                        10.6079695,
-                        56.1150259
-                    ],
-                    [
-                        10.4466742,
-                        56.116717
-                    ],
-                    [
-                        10.2865948,
-                        56.118675
-                    ],
-                    [
-                        10.2831527,
-                        56.0281851
-                    ],
-                    [
-                        10.4439274,
-                        56.0270388
-                    ],
-                    [
-                        10.4417713,
-                        55.7579243
-                    ],
-                    [
-                        10.4334961,
-                        55.6693533
-                    ],
-                    [
-                        10.743814,
-                        55.6646861
-                    ],
-                    [
-                        10.743814,
-                        55.5712253
-                    ],
-                    [
-                        10.8969041,
-                        55.5712253
-                    ],
-                    [
-                        10.9051793,
-                        55.3953852
-                    ],
-                    [
-                        11.0613726,
-                        55.3812841
-                    ],
-                    [
-                        11.0593038,
-                        55.1124061
-                    ],
-                    [
-                        11.0458567,
-                        55.0318621
-                    ],
-                    [
-                        11.2030844,
-                        55.0247474
-                    ],
-                    [
-                        11.2030844,
-                        55.117139
-                    ],
-                    [
-                        11.0593038,
-                        55.1124061
-                    ],
-                    [
-                        11.0613726,
-                        55.3812841
-                    ],
-                    [
-                        11.0789572,
-                        55.5712253
-                    ],
-                    [
-                        10.8969041,
-                        55.5712253
-                    ],
-                    [
-                        10.9258671,
-                        55.6670198
-                    ],
-                    [
-                        10.743814,
-                        55.6646861
-                    ],
-                    [
-                        10.7562267,
-                        55.7579243
-                    ],
-                    [
-                        10.4417713,
-                        55.7579243
-                    ],
-                    [
-                        10.4439274,
-                        56.0270388
-                    ],
-                    [
-                        10.4466742,
-                        56.116717
-                    ],
-                    [
-                        10.6079695,
-                        56.1150259
-                    ],
-                    [
-                        10.6052053,
-                        56.0247462
-                    ],
-                    [
-                        10.9258671,
-                        56.0201215
-                    ],
-                    [
-                        10.9197132,
-                        55.9309388
-                    ],
-                    [
-                        11.0802782,
-                        55.92792
-                    ],
-                    [
-                        11.0858066,
-                        56.0178284
-                    ],
-                    [
-                        11.7265047,
-                        56.005058
-                    ],
-                    [
-                        11.7319981,
-                        56.0952142
-                    ],
-                    [
-                        12.0540333,
-                        56.0871256
-                    ],
-                    [
-                        12.0608477,
-                        56.1762576
-                    ],
-                    [
-                        12.7023469,
-                        56.1594405
-                    ],
-                    [
-                        12.6611131,
-                        55.7114318
-                    ],
-                    [
-                        12.9792318,
-                        55.7014026
-                    ],
-                    [
-                        12.9612912,
-                        55.5217294
-                    ],
-                    [
-                        12.3268659,
-                        55.5412096
-                    ],
-                    [
-                        12.3206071,
-                        55.4513655
-                    ],
-                    [
-                        12.4778226,
-                        55.447067
-                    ],
-                    [
-                        12.4702432,
-                        55.3570479
-                    ],
-                    [
-                        12.6269738,
-                        55.3523837
-                    ],
-                    [
-                        12.6200898,
-                        55.2632576
-                    ],
-                    [
-                        12.4627339,
-                        55.26722
-                    ],
-                    [
-                        12.4552949,
-                        55.1778223
-                    ],
-                    [
-                        12.2987046,
-                        55.1822303
-                    ],
-                    [
-                        12.2897344,
-                        55.0923641
-                    ],
-                    [
-                        12.6048608,
-                        55.0832904
-                    ],
-                    [
-                        12.5872011,
-                        54.9036285
-                    ],
-                    [
-                        12.2766618,
-                        54.9119031
-                    ],
-                    [
-                        12.2610181,
-                        54.7331602
-                    ],
-                    [
-                        12.1070691,
-                        54.7378161
-                    ],
-                    [
-                        12.0858621,
-                        54.4681655
-                    ],
-                    [
-                        11.7794953,
-                        54.4753579
-                    ],
-                    [
-                        11.7837381,
-                        54.5654783
-                    ],
-                    [
-                        11.1658525,
-                        54.5782155
-                    ],
-                    [
-                        11.1706443,
-                        54.6686508
-                    ],
-                    [
-                        10.8617173,
-                        54.6733956
-                    ],
-                    [
-                        10.8651245,
-                        54.7634667
-                    ],
-                    [
-                        10.7713646,
-                        54.7643888
-                    ],
-                    [
-                        10.7707276,
-                        54.7372807
-                    ],
-                    [
-                        10.7551428,
-                        54.7375776
-                    ],
-                    [
-                        10.7544039,
-                        54.7195666
-                    ],
-                    [
-                        10.7389074,
-                        54.7197588
-                    ],
-                    [
-                        10.7384368,
-                        54.7108482
-                    ],
-                    [
-                        10.7074486,
-                        54.7113045
-                    ],
-                    [
-                        10.7041094,
-                        54.6756741
-                    ],
-                    [
-                        10.5510973,
-                        54.6781698
-                    ],
-                    [
-                        10.5547184,
-                        54.7670245
-                    ],
-                    [
-                        10.2423994,
-                        54.7705935
-                    ],
-                    [
-                        10.2459845,
-                        54.8604673
-                    ],
-                    [
-                        10.0902268,
-                        54.8622134
-                    ],
-                    [
-                        10.0873731,
-                        54.7723851
-                    ],
-                    [
-                        9.1555798,
-                        54.7769557
-                    ],
-                    [
-                        9.1562752,
-                        54.8675369
-                    ],
-                    [
-                        8.5321973,
-                        54.8663765
-                    ],
-                    [
-                        8.531432,
-                        54.95516
-                    ]
-                ],
-                [
-                    [
-                        11.4577738,
-                        56.819554
-                    ],
-                    [
-                        11.7849181,
-                        56.8127385
-                    ],
-                    [
-                        11.7716715,
-                        56.6332796
-                    ],
-                    [
-                        11.4459621,
-                        56.6401087
-                    ]
-                ],
-                [
-                    [
-                        11.3274736,
-                        57.3612962
-                    ],
-                    [
-                        11.3161808,
-                        57.1818004
-                    ],
-                    [
-                        11.1508692,
-                        57.1847276
-                    ],
-                    [
-                        11.1456628,
-                        57.094962
-                    ],
-                    [
-                        10.8157703,
-                        57.1001693
-                    ],
-                    [
-                        10.8290599,
-                        57.3695272
-                    ]
-                ],
-                [
-                    [
-                        11.5843266,
-                        56.2777928
-                    ],
-                    [
-                        11.5782882,
-                        56.1880397
-                    ],
-                    [
-                        11.7392309,
-                        56.1845765
-                    ],
-                    [
-                        11.7456428,
-                        56.2743186
-                    ]
-                ],
-                [
-                    [
-                        14.6825922,
-                        55.3639405
-                    ],
-                    [
-                        14.8395247,
-                        55.3565231
-                    ],
-                    [
-                        14.8263755,
-                        55.2671261
-                    ],
-                    [
-                        15.1393406,
-                        55.2517359
-                    ],
-                    [
-                        15.1532015,
-                        55.3410836
-                    ],
-                    [
-                        15.309925,
-                        55.3330556
-                    ],
-                    [
-                        15.295719,
-                        55.2437356
-                    ],
-                    [
-                        15.1393406,
-                        55.2517359
-                    ],
-                    [
-                        15.1255631,
-                        55.1623802
-                    ],
-                    [
-                        15.2815819,
-                        55.1544167
-                    ],
-                    [
-                        15.2535578,
-                        54.9757646
-                    ],
-                    [
-                        14.6317464,
-                        55.0062496
-                    ]
-                ]
-            ],
-            "terms_url": "http://download.kortforsyningen.dk/content/vilkaar-og-betingelser",
-            "terms_text": "Geodatastyrelsen og Danske Kommuner"
-        },
-        {
-            "name": "Geoimage.at MaxRes",
-            "type": "tms",
-            "template": "http://geoimage.openstreetmap.at/4d80de696cd562a63ce463a58a61488d/{zoom}/{x}/{y}.jpg",
-            "polygon": [
-                [
-                    [
-                        16.5073284,
-                        46.9929304
-                    ],
-                    [
-                        16.283417,
-                        46.9929304
-                    ],
-                    [
-                        16.135839,
-                        46.8713046
-                    ],
-                    [
-                        15.9831722,
-                        46.8190947
-                    ],
-                    [
-                        16.0493278,
-                        46.655175
-                    ],
-                    [
-                        15.8610387,
-                        46.7180116
-                    ],
-                    [
-                        15.7592608,
-                        46.6900933
-                    ],
-                    [
-                        15.5607938,
-                        46.6796202
-                    ],
-                    [
-                        15.5760605,
-                        46.6342132
-                    ],
-                    [
-                        15.4793715,
-                        46.6027553
-                    ],
-                    [
-                        15.4335715,
-                        46.6516819
-                    ],
-                    [
-                        15.2249267,
-                        46.6342132
-                    ],
-                    [
-                        15.0468154,
-                        46.6481886
-                    ],
-                    [
-                        14.9908376,
-                        46.5887681
-                    ],
-                    [
-                        14.9603042,
-                        46.6237293
-                    ],
-                    [
-                        14.8534374,
-                        46.6027553
-                    ],
-                    [
-                        14.8330818,
-                        46.5012666
-                    ],
-                    [
-                        14.7516595,
-                        46.4977636
-                    ],
-                    [
-                        14.6804149,
-                        46.4381781
-                    ],
-                    [
-                        14.6142593,
-                        46.4381781
-                    ],
-                    [
-                        14.578637,
-                        46.3785275
-                    ],
-                    [
-                        14.4412369,
-                        46.4311638
-                    ],
-       &nb