Update to iD v1.2.0
authorJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 26 Sep 2013 17:21:36 +0000 (10:21 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 26 Sep 2013 17:21:52 +0000 (10:21 -0700)
47 files changed:
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/ast.json
vendor/assets/iD/iD/locales/bg-BG.json
vendor/assets/iD/iD/locales/bn.json [new file with mode: 0644]
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.json
vendor/assets/iD/iD/locales/el.json
vendor/assets/iD/iD/locales/en-GB.json [new file with mode: 0644]
vendor/assets/iD/iD/locales/en.json
vendor/assets/iD/iD/locales/es.json
vendor/assets/iD/iD/locales/et.json
vendor/assets/iD/iD/locales/fi.json
vendor/assets/iD/iD/locales/fr.json
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/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/nn.json [new file with mode: 0644]
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/ru.json
vendor/assets/iD/iD/locales/sc.json [new file with mode: 0644]
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/tr.json
vendor/assets/iD/iD/locales/uk.json
vendor/assets/iD/iD/locales/vi.json
vendor/assets/iD/iD/locales/zh-CN.GB2312.json [new file with mode: 0644]
vendor/assets/iD/iD/locales/zh-CN.json
vendor/assets/iD/iD/locales/zh-TW.json
vendor/assets/iD/iD/locales/zh.json

index 18c6c162610f9581cfccff51d7060cd2db89c3bb..44176cdf5633a9c487e4afa1ff2dea4ef9dcdc6f 100644 (file)
@@ -386,10 +386,6 @@ path.stroke.tag-leisure-park {
     stroke: #8cd05f;
 }
 
-path.stroke.tag-landuse-residential {
-    stroke: #e06e5f;
-}
-
 path.stroke.tag-landuse-retail,
 path.stroke.tag-landuse-commercial {
     stroke: #eab056;
@@ -1195,12 +1191,17 @@ text.point {
 
 /* GPX Paths */
 path.gpx {
-    stroke: #6AFF25;
+    stroke: #FF26D4;
     stroke-width: 2;
     fill: none;
     pointer-events: none;
 }
 
+/* GPS Labels */
+text.gpx {
+    fill:#FF26D4;
+}
+
 /* Modes */
 
 .mode-draw-line .vertex.active,
index 2e23addfd2841b386b59cf497d06e47f483b12f2..d4a8ffdef75391bbaeba92564382d6c41c6a17b2 100644 (file)
@@ -13770,64 +13770,126 @@ if (typeof module !== 'undefined') {
 
 })();
 toGeoJSON = (function() {
-    var removeSpace = (/\s*/g), trimSpace = (/^\s*|\s*$/g), splitSpace = (/\s+/);
+    'use strict';
+
+    var removeSpace = (/\s*/g),
+        trimSpace = (/^\s*|\s*$/g),
+        splitSpace = (/\s+/);
+    // generate a short, numeric hash of a string
     function okhash(x) {
         if (!x || !x.length) return 0;
         for (var i = 0, h = 0; i < x.length; i++) {
             h = ((h << 5) - h) + x.charCodeAt(i) | 0;
         } return h;
     }
+    // all Y children of X
     function get(x, y) { return x.getElementsByTagName(y); }
     function attr(x, y) { return x.getAttribute(y); }
     function attrf(x, y) { return parseFloat(attr(x, y)); }
+    // one Y child of X, if any, otherwise null
     function get1(x, y) { var n = get(x, y); return n.length ? n[0] : null; }
+    // https://developer.mozilla.org/en-US/docs/Web/API/Node.normalize
+    function norm(el) { if (el.normalize) { el.normalize(); } return el; }
+    // cast array x into numbers
     function numarray(x) {
         for (var j = 0, o = []; j < x.length; j++) o[j] = parseFloat(x[j]);
         return o;
     }
-    function nodeVal(x) { return x && x.firstChild && x.firstChild.nodeValue; }
+    function clean(x) {
+        var o = {};
+        for (var i in x) if (x[i]) o[i] = x[i];
+        return o;
+    }
+    // get the content of a text node, if any
+    function nodeVal(x) { if (x) {norm(x);} return x && x.firstChild && x.firstChild.nodeValue; }
+    // get one coordinate from a coordinate array, if any
     function coord1(v) { return numarray(v.replace(removeSpace, '').split(',')); }
+    // get all coordinates from a coordinate array as [[],[]]
     function coord(v) {
-        var coords = v.replace(trimSpace, '').split(splitSpace), o = [];
-        for (var i = 0; i < coords.length; i++) o.push(coord1(coords[i]));
+        var coords = v.replace(trimSpace, '').split(splitSpace),
+            o = [];
+        for (var i = 0; i < coords.length; i++) {
+            o.push(coord1(coords[i]));
+        }
         return o;
     }
-    function fc() { return { type: 'FeatureCollection', features: [] }; }
+    function coordPair(x) { return [attrf(x, 'lon'), attrf(x, 'lat')]; }
+
+    // create a new feature collection parent object
+    function fc() {
+        return {
+            type: 'FeatureCollection',
+            features: []
+        };
+    }
+
+    var styleSupport = false;
+    if (typeof XMLSerializer !== 'undefined') {
+        var serializer = new XMLSerializer();
+        styleSupport = true;
+    }
+    function xml2str(str) { return serializer.serializeToString(str); }
+
     var t = {
         kml: function(doc, o) {
             o = o || {};
-            var gj = fc(), styleIndex = {},
-                geotypes = ['Polygon', 'LineString', 'Point'],
-                placemarks = get(doc, 'Placemark'), styles = get(doc, 'Style');
 
-            if (o.styles) for (var k = 0; k < styles.length; k++) {
-                styleIndex['#' + styles[k].id] = okhash(styles[k].innerHTML).toString(16);
+            var gj = fc(),
+                // styleindex keeps track of hashed styles in order to match features
+                styleIndex = {},
+                // atomic geospatial types supported by KML - MultiGeometry is
+                // handled separately
+                geotypes = ['Polygon', 'LineString', 'Point', 'Track'],
+                // all root placemarks in the file
+                placemarks = get(doc, 'Placemark'),
+                styles = get(doc, 'Style');
+
+            if (styleSupport) for (var k = 0; k < styles.length; k++) {
+                styleIndex['#' + attr(styles[k], 'id')] = okhash(xml2str(styles[k])).toString(16);
             }
             for (var j = 0; j < placemarks.length; j++) {
                 gj.features = gj.features.concat(getPlacemark(placemarks[j]));
             }
+            function gxCoord(v) { return numarray(v.split(' ')); }
+            function gxCoords(root) {
+                var elems = get(root, 'coord', 'gx'), coords = [];
+                for (var i = 0; i < elems.length; i++) coords.push(gxCoord(nodeVal(elems[i])));
+                return coords;
+            }
             function getGeometry(root) {
                 var geomNode, geomNodes, i, j, k, geoms = [];
                 if (get1(root, 'MultiGeometry')) return getGeometry(get1(root, 'MultiGeometry'));
+                if (get1(root, 'MultiTrack')) return getGeometry(get1(root, 'MultiTrack'));
                 for (i = 0; i < geotypes.length; i++) {
                     geomNodes = get(root, geotypes[i]);
                     if (geomNodes) {
                         for (j = 0; j < geomNodes.length; j++) {
                             geomNode = geomNodes[j];
                             if (geotypes[i] == 'Point') {
-                                geoms.push({ type: 'Point',
+                                geoms.push({
+                                    type: 'Point',
                                     coordinates: coord1(nodeVal(get1(geomNode, 'coordinates')))
                                 });
                             } else if (geotypes[i] == 'LineString') {
-                                geoms.push({ type: 'LineString',
+                                geoms.push({
+                                    type: 'LineString',
                                     coordinates: coord(nodeVal(get1(geomNode, 'coordinates')))
                                 });
                             } else if (geotypes[i] == 'Polygon') {
-                                var rings = get(geomNode, 'LinearRing'), coords = [];
+                                var rings = get(geomNode, 'LinearRing'),
+                                    coords = [];
                                 for (k = 0; k < rings.length; k++) {
                                     coords.push(coord(nodeVal(get1(rings[k], 'coordinates'))));
                                 }
-                                geoms.push({ type: 'Polygon', coordinates: coords });
+                                geoms.push({
+                                    type: 'Polygon',
+                                    coordinates: coords
+                                });
+                            } else if (geotypes[i] == 'Track') {
+                                geoms.push({
+                                    type: 'LineString',
+                                    coordinates: gxCoords(geomNode)
+                                });
                             }
                         }
                     }
@@ -13841,7 +13903,7 @@ toGeoJSON = (function() {
                     description = nodeVal(get1(root, 'description')),
                     extendedData = get1(root, 'ExtendedData');
 
-                if (!geoms.length) return false;
+                if (!geoms.length) return [];
                 if (name) properties.name = name;
                 if (styleUrl && styleIndex[styleUrl]) {
                     properties.styleUrl = styleUrl;
@@ -13859,28 +13921,69 @@ toGeoJSON = (function() {
                         properties[simpleDatas[i].getAttribute('name')] = nodeVal(simpleDatas[i]);
                     }
                 }
-                return [{ type: 'Feature', geometry: (geoms.length === 1) ? geoms[0] : {
-                    type: 'GeometryCollection',
-                    geometries: geoms }, properties: properties }];
+                return [{
+                    type: 'Feature',
+                    geometry: (geoms.length === 1) ? geoms[0] : {
+                        type: 'GeometryCollection',
+                        geometries: geoms
+                    },
+                    properties: properties
+                }];
             }
             return gj;
         },
         gpx: function(doc, o) {
-            var i, j, tracks = get(doc, 'trk'), track, pt, gj = fc();
+            var i,
+                tracks = get(doc, 'trk'),
+                routes = get(doc, 'rte'),
+                waypoints = get(doc, 'wpt'),
+                // a feature collection
+                gj = fc();
             for (i = 0; i < tracks.length; i++) {
-                track = tracks[i];
-                var name = nodeVal(get1(track, 'name'));
-                var pts = get(track, 'trkpt'), line = [];
+                gj.features.push(getLinestring(tracks[i], 'trkpt'));
+            }
+            for (i = 0; i < routes.length; i++) {
+                gj.features.push(getLinestring(routes[i], 'rtept'));
+            }
+            for (i = 0; i < waypoints.length; i++) {
+                gj.features.push(getPoint(waypoints[i]));
+            }
+            function getLinestring(node, pointname) {
+                var j, pts = get(node, pointname), line = [];
                 for (j = 0; j < pts.length; j++) {
-                    line.push([attrf(pts[j], 'lon'), attrf(pts[j], 'lat')]);
+                    line.push(coordPair(pts[j]));
                 }
-                gj.features.push({
+                return {
                     type: 'Feature',
-                    properties: {
-                        name: name || ''
-                    },
-                    geometry: { type: 'LineString', coordinates: line }
-                });
+                    properties: getProperties(node),
+                    geometry: {
+                        type: 'LineString',
+                        coordinates: line
+                    }
+                };
+            }
+            function getPoint(node) {
+                var prop = getProperties(node);
+                prop.ele = nodeVal(get1(node, 'ele'));
+                prop.sym = nodeVal(get1(node, 'sym'));
+                return {
+                    type: 'Feature',
+                    properties: prop,
+                    geometry: {
+                        type: 'Point',
+                        coordinates: coordPair(node)
+                    }
+                };
+            }
+            function getProperties(node) {
+                var meta = ['name', 'desc', 'author', 'copyright', 'link',
+                            'time', 'keywords'],
+                    prop = {},
+                    k;
+                for (k = 0; k < meta.length; k++) {
+                    prop[meta[k]] = nodeVal(get1(node, meta[k]));
+                }
+                return clean(prop);
             }
             return gj;
         }
@@ -15033,14 +15136,19 @@ window.iD = function () {
         return {
             getItem: function(k) { return s[k]; },
             setItem: function(k, v) { s[k] = v; },
-            removeItem: function(k) { delete s[k] }
+            removeItem: function(k) { delete s[k]; }
         };
     })();
 
     context.storage = function(k, v) {
-        if (arguments.length === 1) return storage.getItem(k);
-        else if (v === null) storage.removeItem(k);
-        else storage.setItem(k, v);
+        try {
+            if (arguments.length === 1) return storage.getItem(k);
+            else if (v === null) storage.removeItem(k);
+            else storage.setItem(k, v);
+        } catch(e) {
+            // localstorage quota exceeded
+            if (typeof console !== 'undefined') console.error('localStorage quota exceeded');
+        }
     };
 
     var history = iD.History(context),
@@ -15099,6 +15207,20 @@ window.iD = function () {
     context.changes = history.changes;
     context.intersects = history.intersects;
 
+    var inIntro = false;
+
+    context.inIntro = function(_) {
+        if (!arguments.length) return inIntro;
+        inIntro = _;
+        return context;
+    };
+
+    context.save = function() {
+        if (inIntro) return;
+        history.save();
+        if (history.hasChanges()) return t('save.unsaved_changes');
+    };
+
     context.flush = function() {
         connection.flush();
         history.reset();
@@ -15254,7 +15376,7 @@ window.iD = function () {
     return d3.rebind(context, dispatch, 'on');
 };
 
-iD.version = '1.1.6';
+iD.version = '1.2.0';
 
 (function() {
     var detected = {};
@@ -15768,6 +15890,16 @@ _.extend(iD.geo.Extent.prototype, {
                 (this[0][1] + this[1][1]) / 2];
     },
 
+    polygon: function() {
+        return [
+            [this[0][0], this[0][1]],
+            [this[0][0], this[1][1]],
+            [this[1][0], this[1][1]],
+            [this[1][0], this[0][1]],
+            [this[0][0], this[0][1]]
+        ]
+    },
+
     intersects: function(obj) {
         if (!(obj instanceof iD.geo.Extent)) obj = new iD.geo.Extent(obj);
         return obj[0][0] <= this[1][0] &&
@@ -15931,6 +16063,68 @@ iD.geo.joinWays = function(array, graph) {
 
     return joined;
 };
+iD.geo.turns = function(graph, entityID) {
+    var way = graph.entity(entityID);
+    if (way.type !== 'way' || !way.tags.highway || way.isArea())
+        return [];
+
+    function withRestriction(turn) {
+        graph.parentRelations(turn.from).forEach(function(relation) {
+            if (relation.tags.type !== 'restriction')
+                return;
+
+            var f = relation.memberByRole('from'),
+                t = relation.memberByRole('to'),
+                v = relation.memberByRole('via');
+
+            if (f && f.id === turn.from.id &&
+                t && t.id === turn.to.id &&
+                v && v.id === turn.via.id) {
+                turn.restriction = relation;
+            }
+        });
+
+        return turn;
+    }
+
+    var turns = [];
+
+    [way.first(), way.last()].forEach(function(nodeID) {
+        var node = graph.entity(nodeID);
+        graph.parentWays(node).forEach(function(parent) {
+            if (parent === way || parent.isDegenerate() || !parent.tags.highway)
+                return;
+            if (way.first() === node.id && way.tags.oneway === 'yes')
+                return;
+            if (way.last() === node.id && way.tags.oneway === '-1')
+                return;
+
+            var index = parent.nodes.indexOf(node.id);
+
+            // backward
+            if (parent.first() !== node.id && parent.tags.oneway !== 'yes') {
+                turns.push(withRestriction({
+                    from: way,
+                    to: parent,
+                    via: node,
+                    toward: graph.entity(parent.nodes[index - 1])
+                }));
+            }
+
+            // forward
+            if (parent.last() !== node.id && parent.tags.oneway !== '-1') {
+                turns.push(withRestriction({
+                    from: way,
+                    to: parent,
+                    via: node,
+                    toward: graph.entity(parent.nodes[index + 1])
+                }));
+            }
+       });
+    });
+
+    return turns;
+};
 iD.actions = {};
 iD.actions.AddEntity = function(way) {
     return function(graph) {
@@ -15981,6 +16175,10 @@ iD.actions.AddMidpoint = function(midpoint, node) {
                     (way.nodes[i]     === midpoint.edge[1] &&
                      way.nodes[i + 1] === midpoint.edge[0])) {
                     graph = graph.replace(graph.entity(way.id).addNode(node.id, i + 1));
+
+                    // Add only one midpoint on doubled-back segments,
+                    // turning them into self-intersections.
+                    return;
                 }
             }
         });
@@ -16173,7 +16371,12 @@ iD.actions.DeleteNode = function(nodeId) {
 
         graph.parentRelations(node)
             .forEach(function(parent) {
-                graph = graph.replace(parent.removeMembersWithID(nodeId));
+                parent = parent.removeMembersWithID(nodeId);
+                graph = graph.replace(parent);
+
+                if (parent.isDegenerate()) {
+                    graph = iD.actions.DeleteRelation(parent.id)(graph);
+                }
             });
 
         return graph.remove(node);
@@ -16198,7 +16401,12 @@ iD.actions.DeleteRelation = function(relationId) {
 
         graph.parentRelations(relation)
             .forEach(function(parent) {
-                graph = graph.replace(parent.removeMembersWithID(relationId));
+                parent = parent.removeMembersWithID(relationId);
+                graph = graph.replace(parent);
+
+                if (parent.isDegenerate()) {
+                    graph = iD.actions.DeleteRelation(parent.id)(graph);
+                }
             });
 
         _.uniq(_.pluck(relation.members, 'id')).forEach(function(memberId) {
@@ -16233,7 +16441,12 @@ iD.actions.DeleteWay = function(wayId) {
 
         graph.parentRelations(way)
             .forEach(function(parent) {
-                graph = graph.replace(parent.removeMembersWithID(wayId));
+                parent = parent.removeMembersWithID(wayId);
+                graph = graph.replace(parent);
+
+                if (parent.isDegenerate()) {
+                    graph = iD.actions.DeleteRelation(parent.id)(graph);
+                }
             });
 
         _.uniq(way.nodes).forEach(function(nodeId) {
@@ -16674,7 +16887,7 @@ iD.actions.Orthogonalize = function(wayId, projection) {
                 .move(projection.invert(points[corner.i])));
         } else {
             var best;
-            points = nodes.map(function(n) { return projection(n.loc); });
+            points = _.uniq(nodes).map(function(n) { return projection(n.loc); });
             score = squareness();
 
             for (i = 0; i < 1000; i++) {
@@ -16694,7 +16907,7 @@ iD.actions.Orthogonalize = function(wayId, projection) {
 
             points = best;
 
-            for (i = 0; i < points.length - 1; i++) {
+            for (i = 0; i < points.length; i++) {
                 graph = graph.replace(graph.entity(nodes[i].id)
                     .move(projection.invert(points[i])));
             }
@@ -16708,7 +16921,7 @@ iD.actions.Orthogonalize = function(wayId, projection) {
                 p = subtractPoints(a, b),
                 q = subtractPoints(c, b);
 
-            var scale = iD.geo.dist(p, [0, 0]) + iD.geo.dist(q, [0, 0]);
+            var scale = 2*Math.min(iD.geo.dist(p, [0, 0]), iD.geo.dist(q, [0, 0]));
             p = normalizePoint(p, 1.0);
             q = normalizePoint(q, 1.0);
 
@@ -16777,8 +16990,7 @@ iD.actions.Orthogonalize = function(wayId, projection) {
     };
 
     action.disabled = function(graph) {
-        if (!graph.entity(wayId).isClosed())
-            return 'not_closed';
+        return false;
     };
 
     return action;
@@ -17018,6 +17230,77 @@ iD.actions.Split = function(nodeId, newWayIds) {
 
     return action;
 };
+/*
+ * Based on https://github.com/openstreetmap/potlatch2/net/systemeD/potlatch2/tools/Straighten.as
+ */
+
+iD.actions.Straighten = function(wayId, projection) {
+    function positionAlongWay(n, s, e) {
+        return ((n[0] - s[0]) * (e[0] - s[0]) + (n[1] - s[1]) * (e[1] - s[1]))/
+                (Math.pow(e[0] - s[0], 2) + Math.pow(e[1] - s[1], 2));
+    }
+
+    var action = function(graph) {
+        var way = graph.entity(wayId),
+            nodes = graph.childNodes(way),
+            points = nodes.map(function(n) { return projection(n.loc); }),
+            startPoint = points[0],
+            endPoint = points[points.length-1],
+            toDelete = [],
+            i;
+
+        for (i = 1; i < points.length-1; i++) {
+            var node = nodes[i], 
+                point = points[i];
+
+            if (graph.parentWays(node).length > 1 || (node.tags && Object.keys(node.tags).length)) {
+                var u = positionAlongWay(point, startPoint, endPoint),
+                    p0 = startPoint[0] + u * (endPoint[0] - startPoint[0]),
+                    p1 = startPoint[1] + u * (endPoint[1] - startPoint[1]),
+
+                graph = graph.replace(graph.entity(node.id)
+                    .move(projection.invert([p0, p1])));
+            } else {
+                // safe to delete
+                if (toDelete.indexOf(node) == -1) {
+                    toDelete.push(node);
+                }
+            }
+        }
+
+        for (i = 0; i < toDelete.length; i++) {
+            graph = iD.actions.DeleteNode(toDelete[i].id)(graph);
+        }
+
+        return graph;
+    };
+    
+    action.disabled = function(graph) {
+        // check way isn't too bendy
+        var way = graph.entity(wayId),
+            nodes = graph.childNodes(way),
+            points = nodes.map(function(n) { return projection(n.loc); }),
+            startPoint = points[0],
+            endPoint = points[points.length-1],
+            threshold = 0.2 * Math.sqrt(Math.pow(startPoint[0] - endPoint[0], 2) + Math.pow(startPoint[1] - endPoint[1], 2)),
+            i;
+
+        for (i = 1; i < points.length-1; i++) {
+            var point = points[i], 
+                u = positionAlongWay(point, startPoint, endPoint),
+                p0 = startPoint[0] + u * (endPoint[0] - startPoint[0]),
+                p1 = startPoint[1] + u * (endPoint[1] - startPoint[1]),
+                dist = Math.sqrt(Math.pow(p0 - point[0], 2) + Math.pow(p1 - point[1], 2));
+
+            // to bendy if point is off by 20% of total start/end distance in projected space
+            if (dist > threshold) {
+                return 'too_bendy';
+            }
+        }
+    };
+
+    return action;
+};
 iD.behavior = {};
 iD.behavior.AddWay = function(context) {
     var event = d3.dispatch('start', 'startFromWay', 'startFromNode'),
@@ -18112,7 +18395,7 @@ iD.modes.AddLine = function(context) {
             iD.actions.AddEntity(way),
             iD.actions.AddVertex(way.id, node.id));
 
-        context.enter(iD.modes.DrawLine(context, way.id, 'forward', graph));
+        context.enter(iD.modes.DrawLine(context, way.id, graph));
     }
 
     function startFromWay(loc, edge) {
@@ -18126,29 +18409,17 @@ iD.modes.AddLine = function(context) {
             iD.actions.AddVertex(way.id, node.id),
             iD.actions.AddMidpoint({ loc: loc, edge: edge }, node));
 
-        context.enter(iD.modes.DrawLine(context, way.id, 'forward', graph));
+        context.enter(iD.modes.DrawLine(context, way.id, graph));
     }
 
     function startFromNode(node) {
-        var graph = context.graph(),
-            parent = graph.parentWays(node)[0],
-            isLine = parent && parent.geometry(graph) === 'line';
-
-        if (isLine && parent.first() === node.id) {
-            context.enter(iD.modes.DrawLine(context, parent.id, 'backward', graph));
+        var way = iD.Way();
 
-        } else if (isLine && parent.last() === node.id) {
-            context.enter(iD.modes.DrawLine(context, parent.id, 'forward', graph));
-
-        } else {
-            var way = iD.Way();
-
-            context.perform(
-                iD.actions.AddEntity(way),
-                iD.actions.AddVertex(way.id, node.id));
+        context.perform(
+            iD.actions.AddEntity(way),
+            iD.actions.AddVertex(way.id, node.id));
 
-            context.enter(iD.modes.DrawLine(context, way.id, 'forward', graph));
-        }
+        context.enter(iD.modes.DrawLine(context, way.id, context.graph()));
     }
 
     mode.enter = function() {
@@ -18230,7 +18501,7 @@ iD.modes.Browse = function(context) {
         iD.modes.DragNode(context).behavior];
 
     mode.enter = function() {
-        context.history().save();
+        context.save();
 
         behaviors.forEach(function(behavior) {
             context.install(behavior);
@@ -18517,7 +18788,7 @@ iD.modes.DrawArea = function(context, wayId, baseGraph) {
 
     return mode;
 };
-iD.modes.DrawLine = function(context, wayId, direction, baseGraph) {
+iD.modes.DrawLine = function(context, wayId, baseGraph, affix) {
     var mode = {
         button: 'line',
         id: 'draw-line'
@@ -18527,8 +18798,8 @@ iD.modes.DrawLine = function(context, wayId, direction, baseGraph) {
 
     mode.enter = function() {
         var way = context.entity(wayId),
-            index = (direction === 'forward') ? undefined : 0,
-            headId = (direction === 'forward') ? way.last() : way.first();
+            index = (affix === 'prefix') ? 0 : undefined,
+            headId = (affix === 'prefix') ? way.first() : way.last();
 
         behavior = iD.behavior.DrawWay(context, wayId, index, mode, baseGraph)
             .tail(t('modes.draw_line.tail'));
@@ -18563,81 +18834,82 @@ iD.modes.Move = function(context, entityIDs) {
     };
 
     var keybinding = d3.keybinding('move'),
-        edit = iD.behavior.Edit(context);
-
-    mode.enter = function() {
-        context.install(edit);
+        edit = iD.behavior.Edit(context),
+        annotation = entityIDs.length === 1 ?
+            t('operations.move.annotation.' + context.geometry(entityIDs[0])) :
+            t('operations.move.annotation.multiple'),
+        origin,
+        nudgeInterval;
 
-        var origin,
-            nudgeInterval,
-            annotation = entityIDs.length === 1 ?
-                t('operations.move.annotation.' + context.geometry(entityIDs[0])) :
-                t('operations.move.annotation.multiple');
+    function edge(point, size) {
+        var pad = [30, 100, 30, 100];
+        if (point[0] > size[0] - pad[0]) return [-10, 0];
+        else if (point[0] < pad[2]) return [10, 0];
+        else if (point[1] > size[1] - pad[1]) return [0, -10];
+        else if (point[1] < pad[3]) return [0, 10];
+        return null;
+    }
 
-        context.perform(
-            iD.actions.Noop(),
-            annotation);
+    function startNudge(nudge) {
+        if (nudgeInterval) window.clearInterval(nudgeInterval);
+        nudgeInterval = window.setInterval(function() {
+            context.pan(nudge);
+            context.replace(
+                iD.actions.Move(entityIDs, [-nudge[0], -nudge[1]], context.projection),
+                annotation);
+            var c = context.projection(origin);
+            origin = context.projection.invert([c[0] - nudge[0], c[1] - nudge[1]]);
+        }, 50);
+    }
 
-        function edge(point, size) {
-            var pad = [30, 100, 30, 100];
-            if (point[0] > size[0] - pad[0]) return [-10, 0];
-            else if (point[0] < pad[2]) return [10, 0];
-            else if (point[1] > size[1] - pad[1]) return [0, -10];
-            else if (point[1] < pad[3]) return [0, 10];
-            return null;
-        }
+    function stopNudge() {
+        if (nudgeInterval) window.clearInterval(nudgeInterval);
+        nudgeInterval = null;
+    }
 
-        function startNudge(nudge) {
-            if (nudgeInterval) window.clearInterval(nudgeInterval);
-            nudgeInterval = window.setInterval(function() {
-                context.pan(nudge);
-                context.replace(
-                    iD.actions.Move(entityIDs, [-nudge[0], -nudge[1]], context.projection),
-                    annotation);
-                var c = context.projection(origin);
-                origin = context.projection.invert([c[0] - nudge[0], c[1] - nudge[1]]);
-            }, 50);
-        }
+    function move() {
+        var p = context.mouse();
 
-        function stopNudge() {
-            if (nudgeInterval) window.clearInterval(nudgeInterval);
-            nudgeInterval = null;
-        }
+        var delta = origin ?
+            [p[0] - context.projection(origin)[0],
+                p[1] - context.projection(origin)[1]] :
+            [0, 0];
 
-        function move() {
-            var p = context.mouse();
+        var nudge = edge(p, context.map().dimensions());
+        if (nudge) startNudge(nudge);
+        else stopNudge();
 
-            var delta = origin ?
-                [p[0] - context.projection(origin)[0],
-                p[1] - context.projection(origin)[1]] :
-                [0, 0];
+        origin = context.map().mouseCoordinates();
 
-            var nudge = edge(p, context.map().dimensions());
-            if (nudge) startNudge(nudge);
-            else stopNudge();
+        context.replace(
+            iD.actions.Move(entityIDs, delta, context.projection),
+            annotation);
+    }
 
-            origin = context.map().mouseCoordinates();
+    function finish() {
+        d3.event.stopPropagation();
+        context.enter(iD.modes.Select(context, entityIDs)
+            .suppressMenu(true));
+        stopNudge();
+    }
 
-            context.replace(
-                iD.actions.Move(entityIDs, delta, context.projection),
-                annotation);
-        }
+    function cancel() {
+        context.pop();
+        context.enter(iD.modes.Select(context, entityIDs)
+            .suppressMenu(true));
+        stopNudge();
+    }
 
-        function finish() {
-            d3.event.stopPropagation();
-            context.enter(iD.modes.Select(context, entityIDs));
-            stopNudge();
-        }
+    function undone() {
+        context.enter(iD.modes.Browse(context));
+    }
 
-        function cancel() {
-            context.pop();
-            context.enter(iD.modes.Select(context, entityIDs));
-            stopNudge();
-        }
+    mode.enter = function() {
+        context.install(edit);
 
-        function undone() {
-            context.enter(iD.modes.Browse(context));
-        }
+        context.perform(
+            iD.actions.Noop(),
+            annotation);
 
         context.surface()
             .on('mousemove.move', move)
@@ -18655,6 +18927,8 @@ iD.modes.Move = function(context, entityIDs) {
     };
 
     mode.exit = function() {
+        stopNudge();
+
         context.uninstall(edit);
 
         context.surface()
@@ -18708,12 +18982,14 @@ iD.modes.RotateWay = function(context, wayId) {
 
         function finish() {
             d3.event.stopPropagation();
-            context.enter(iD.modes.Select(context, [wayId]));
+            context.enter(iD.modes.Select(context, [wayId])
+                .suppressMenu(true));
         }
 
         function cancel() {
             context.pop();
-            context.enter(iD.modes.Select(context, [wayId]));
+            context.enter(iD.modes.Select(context, [wayId])
+                .suppressMenu(true));
         }
 
         function undone() {
@@ -18910,7 +19186,7 @@ iD.modes.Select = function(context, selectedIDs) {
     };
 
     mode.enter = function() {
-        context.history().save();
+        context.save();
 
         behaviors.forEach(function(behavior) {
             context.install(behavior);
@@ -19077,6 +19353,55 @@ iD.operations.Circularize = function(selectedIDs, context) {
 
     return operation;
 };
+iD.operations.Continue = function(selectedIDs, context) {
+    var graph = context.graph(),
+        entities = selectedIDs.map(function(id) { return graph.entity(id); }),
+        geometries = _.extend({line: [], vertex: []},
+            _.groupBy(entities, function(entity) { return entity.geometry(graph); })),
+        vertex = geometries.vertex[0];
+
+    function candidateWays() {
+        return graph.parentWays(vertex).filter(function(parent) {
+            return parent.geometry(graph) === 'line' &&
+                parent.affix(vertex.id) &&
+                (geometries.line.length === 0 || geometries.line[0] === parent);
+        });
+    }
+
+    var operation = function() {
+        var candidate = candidateWays()[0];
+        context.enter(iD.modes.DrawLine(
+            context,
+            candidate.id,
+            context.graph(),
+            candidate.affix(vertex.id)));
+    };
+
+    operation.available = function() {
+        return geometries.vertex.length === 1 && geometries.line.length <= 1;
+    };
+
+    operation.disabled = function() {
+        var candidates = candidateWays();
+        if (candidates.length === 0)
+            return 'not_eligible';
+        if (candidates.length > 1)
+            return 'multiple';
+    };
+
+    operation.tooltip = function() {
+        var disable = operation.disabled();
+        return disable ?
+            t('operations.continue.' + disable) :
+            t('operations.continue.description');
+    };
+
+    operation.id = "continue";
+    operation.keys = [t('operations.continue.key')];
+    operation.title = t('operations.continue.title');
+
+    return operation;
+};
 iD.operations.Delete = function(selectedIDs, context) {
     var action = iD.actions.DeleteMultiple(selectedIDs);
 
@@ -19266,17 +19591,20 @@ iD.operations.Move = function(selectedIDs, context) {
 };
 iD.operations.Orthogonalize = function(selectedIDs, context) {
     var entityId = selectedIDs[0],
+        geometry = context.geometry(entityId),
         action = iD.actions.Orthogonalize(entityId, context.projection);
 
-    var operation = function() {
-        var annotation = t('operations.orthogonalize.annotation.' + context.geometry(entityId));
+    function operation() {
+        var annotation = t('operations.orthogonalize.annotation.' + geometry);
         context.perform(action, annotation);
-    };
+    }
 
     operation.available = function() {
+        var entity = context.entity(entityId);
         return selectedIDs.length === 1 &&
-            context.entity(entityId).type === 'way' &&
-            _.uniq(context.entity(entityId).nodes).length > 2;
+            entity.type === 'way' &&
+            entity.isClosed() &&
+            _.uniq(entity.nodes).length > 2;
     };
 
     operation.disabled = function() {
@@ -19287,13 +19615,12 @@ iD.operations.Orthogonalize = function(selectedIDs, context) {
         var disable = operation.disabled();
         return disable ?
             t('operations.orthogonalize.' + disable) :
-            t('operations.orthogonalize.description');
+            t('operations.orthogonalize.description.' + geometry);
     };
 
     operation.id = "orthogonalize";
     operation.keys = [t('operations.orthogonalize.key')];
     operation.title = t('operations.orthogonalize.title');
-    operation.description = t('operations.orthogonalize.description');
 
     return operation;
 };
@@ -19406,6 +19733,40 @@ iD.operations.Split = function(selectedIDs, context) {
 
     return operation;
 };
+iD.operations.Straighten = function(selectedIDs, context) {
+    var entityId = selectedIDs[0],
+        action = iD.actions.Straighten(entityId, context.projection);
+
+    function operation() {
+        var annotation = t('operations.straighten.annotation');
+        context.perform(action, annotation);
+    }
+
+    operation.available = function() {
+        var entity = context.entity(entityId);
+        return selectedIDs.length === 1 &&
+            entity.type === 'way' &&
+            !entity.isClosed() &&
+            _.uniq(entity.nodes).length > 2;
+    };
+
+    operation.disabled = function() {
+        return action.disabled(context.graph());
+    };
+
+    operation.tooltip = function() {
+        var disable = operation.disabled();
+        return disable ?
+            t('operations.straighten.' + disable) :
+            t('operations.straighten.description');
+    };
+
+    operation.id = "straighten";
+    operation.keys = [t('operations.straighten.key')];
+    operation.title = t('operations.straighten.title');
+
+    return operation;
+};
 iD.Connection = function() {
 
     var event = d3.dispatch('authenticating', 'authenticated', 'auth', 'loading', 'load', 'loaded'),
@@ -19979,11 +20340,6 @@ iD.Entity.key = function(entity) {
     return entity.id + 'v' + (entity.v || 0);
 };
 
-iD.Entity.areaPath = d3.geo.path()
-    .projection(d3.geo.mercator()
-        .scale(12016420.517592335)
-        .precision(0));
-
 iD.Entity.prototype = {
     tags: {},
 
@@ -20050,12 +20406,9 @@ iD.Entity.prototype = {
             resolver.parentRelations(this).length > 0;
     },
 
-    // Returns the (possibly negative) area of the entity in square pixels at an
-    // arbitrary unspecified zoom level -- so basically, only useful for relative
-    // comparisons.
     area: function(resolver) {
         return resolver.transient(this, 'area', function() {
-            return iD.Entity.areaPath.area(this.asGeoJSON(resolver, true));
+            return d3.geo.area(this.asGeoJSON(resolver, true));
         });
     },
 
@@ -20779,6 +21132,10 @@ _.extend(iD.Relation.prototype, {
         });
     },
 
+    isDegenerate: function() {
+        return this.members.length === 0;
+    },
+
     // Return an array of members, each extended with an 'index' property whose value
     // is the member index.
     indexedMembers: function() {
@@ -20882,24 +21239,26 @@ _.extend(iD.Relation.prototype, {
     },
 
     asGeoJSON: function(resolver) {
-        if (this.isMultipolygon()) {
-            return {
-                type: 'Feature',
-                properties: this.tags,
-                geometry: {
-                    type: 'MultiPolygon',
-                    coordinates: this.multipolygon(resolver)
-                }
-            };
-        } else {
-            return {
-                type: 'FeatureCollection',
-                properties: this.tags,
-                features: this.members.map(function(member) {
-                    return _.extend({role: member.role}, resolver.entity(member.id).asGeoJSON(resolver));
-                })
-            };
-        }
+        return resolver.transient(this, 'GeoJSON', function () {
+            if (this.isMultipolygon()) {
+                return {
+                    type: 'Feature',
+                    properties: this.tags,
+                    geometry: {
+                        type: 'MultiPolygon',
+                        coordinates: this.multipolygon(resolver)
+                    }
+                };
+            } else {
+                return {
+                    type: 'FeatureCollection',
+                    properties: this.tags,
+                    features: this.members.map(function (member) {
+                        return _.extend({role: member.role}, resolver.entity(member.id).asGeoJSON(resolver));
+                    })
+                };
+            }
+        });
     },
 
     isMultipolygon: function() {
@@ -20939,7 +21298,11 @@ _.extend(iD.Relation.prototype, {
         outers = outers.map(function(outer) { return _.pluck(outer.nodes, 'loc'); });
         inners = inners.map(function(inner) { return _.pluck(inner.nodes, 'loc'); });
 
-        var result = outers.map(function(o) { return [o]; });
+        var result = outers.map(function(o) {
+            // Heuristic for detecting counterclockwise winding order. Assumes
+            // that OpenStreetMap polygons are not hemisphere-spanning.
+            return [d3.geo.area({type: 'Polygon', coordinates: [o]}) > 2 * Math.PI ? o.reverse() : o];
+        });
 
         function findOuter(inner) {
             var o, outer;
@@ -20958,6 +21321,12 @@ _.extend(iD.Relation.prototype, {
         }
 
         for (var i = 0; i < inners.length; i++) {
+            var inner = inners[i];
+
+            if (d3.geo.area({type: 'Polygon', coordinates: [inner]}) < 2 * Math.PI) {
+                inner = inner.reverse();
+            }
+
             var o = findOuter(inners[i]);
             if (o !== undefined)
                 result[o].push(inners[i]);
@@ -21115,6 +21484,11 @@ _.extend(iD.Way.prototype, {
         return this.nodes.indexOf(node) >= 0;
     },
 
+    affix: function(node) {
+        if (this.nodes[0] === node) return 'prefix';
+        if (this.nodes[this.nodes.length - 1] === node) return 'suffix';
+    },
+
     isOneWay: function() {
         return this.tags.oneway === 'yes' ||
             this.tags.oneway === '1' ||
@@ -21220,31 +21594,41 @@ _.extend(iD.Way.prototype, {
     },
 
     asGeoJSON: function(resolver, polygon) {
-        var nodes = resolver.childNodes(this);
-
-        if (this.isArea() && polygon && nodes.length >= 4) {
-            if (!this.isClosed()) {
-                nodes = nodes.concat([nodes[0]]);
-            }
+        return resolver.transient(this, 'GeoJSON', function() {
+            var nodes = resolver.childNodes(this);
 
-            return {
-                type: 'Feature',
-                properties: this.tags,
-                geometry: {
-                    type: 'Polygon',
-                    coordinates: [_.pluck(nodes, 'loc')]
+            if (this.isArea() && polygon && nodes.length >= 4) {
+                if (!this.isClosed()) {
+                    nodes = nodes.concat([nodes[0]]);
                 }
-            };
-        } else {
-            return {
-                type: 'Feature',
-                properties: this.tags,
-                geometry: {
-                    type: 'LineString',
-                    coordinates: _.pluck(nodes, 'loc')
+
+                var json = {
+                    type: 'Feature',
+                    properties: this.tags,
+                    geometry: {
+                        type: 'Polygon',
+                        coordinates: [_.pluck(nodes, 'loc')]
+                    }
+                };
+
+                // Heuristic for detecting counterclockwise winding order. Assumes
+                // that OpenStreetMap polygons are not hemisphere-spanning.
+                if (d3.geo.area(json) > 2 * Math.PI) {
+                    json.geometry.coordinates[0] = json.geometry.coordinates[0].reverse();
                 }
-            };
-        }
+
+                return json;
+            } else {
+                return {
+                    type: 'Feature',
+                    properties: this.tags,
+                    geometry: {
+                        type: 'LineString',
+                        coordinates: _.pluck(nodes, 'loc')
+                    }
+                };
+            }
+        });
     }
 });
 
@@ -21279,31 +21663,31 @@ iD.Background = function(context) {
         overlayLayers = [];
 
     var backgroundSources = iD.data.imagery.map(function(source) {
-        if (source.sourcetag === 'Bing') {
+        if (source.type === 'bing') {
             return iD.BackgroundSource.Bing(source, dispatch);
         } else {
             return iD.BackgroundSource(source);
         }
     });
 
-    function findSource(sourcetag) {
+    function findSource(id) {
         return _.find(backgroundSources, function(d) {
-            return d.sourcetag && d.sourcetag === sourcetag;
+            return d.id && d.id === id;
         });
     }
 
     function updateImagery() {
         var b = background.baseLayerSource(),
-            o = overlayLayers.map(function (d) { return d.source().sourcetag; }).join(','),
+            o = overlayLayers.map(function (d) { return d.source().id; }).join(','),
             q = iD.util.stringQs(location.hash.substring(1));
 
-        var tag = b.sourcetag;
-        if (!tag && b.name === 'Custom') {
-            tag = 'custom:' + b.template;
+        var id = b.id;
+        if (!id && b.name === 'Custom') {
+            id = 'custom:' + b.template;
         }
 
-        if (tag) {
-            q.background = tag;
+        if (id) {
+            q.background = id;
         } else {
             delete q.background;
         }
@@ -21320,13 +21704,13 @@ iD.Background = function(context) {
         if (b.name === 'Custom') {
             imageryUsed.push('Custom (' + b.template + ')');
         } else {
-            imageryUsed.push(b.sourcetag || b.name);
+            imageryUsed.push(b.id || b.name);
         }
 
         overlayLayers.forEach(function (d) {
             var source = d.source();
             if (!source.isLocatorOverlay()) {
-                imageryUsed.push(source.sourcetag || source.name);
+                imageryUsed.push(source.id || source.name);
             }
         });
 
@@ -21506,35 +21890,22 @@ iD.BackgroundSource = function(data) {
     };
 
     source.url = function(coord) {
-        var u = '';
-        for (var zoom = coord[2]; zoom > 0; zoom--) {
-            var b = 0;
-            var mask = 1 << (zoom - 1);
-            if ((coord[0] & mask) !== 0) b++;
-            if ((coord[1] & mask) !== 0) b += 2;
-            u += b.toString();
-        }
-
         return data.template
-            .replace('{t}', data.subdomains ?
-                data.subdomains[(coord[0] + coord[1]) % data.subdomains.length] : '')
-            .replace('{u}', u)
             .replace('{x}', coord[0])
             .replace('{y}', coord[1])
             // TMS-flipped y coordinate
-            .replace('{ty}', Math.pow(2, coord[2]) - coord[1] - 1)
-            .replace('{z}', coord[2])
-            // JOSM style
-            .replace('{zoom}', coord[2])
-            .replace(/\{(switch\:[^\}]*)\}/, function(s, r) {
-                var subdomains = r.split(':')[1].split(',');
-                return subdomains[coord[2] % subdomains.length];
+            .replace(/\{[t-]y\}/, Math.pow(2, coord[2]) - coord[1] - 1)
+            .replace(/\{z(oom)?\}/, coord[2])
+            .replace(/\{switch:([^}]+)\}/, function(s, r) {
+                var subdomains = r.split(',');
+                return subdomains[(coord[0] + coord[1]) % subdomains.length];
             });
     };
 
     source.intersects = function(extent) {
-        return !data.extents || data.extents.some(function(ex) {
-            return iD.geo.Extent(ex).intersects(extent);
+        extent = extent.polygon();
+        return !data.polygon || data.polygon.some(function(polygon) {
+            return iD.geo.polygonIntersectsPolygon(polygon, extent);
         });
     };
 
@@ -21577,6 +21948,25 @@ iD.BackgroundSource.Bing = function(data, dispatch) {
         dispatch.change();
     });
 
+    var template = "http://ecn.t{t}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=587&mkt=en-gb&n=z",
+        subdomains = [0, 1, 2, 3];
+
+    bing.url = function(coord) {
+        var u = '';
+
+        for (var zoom = coord[2]; zoom > 0; zoom--) {
+            var b = 0;
+            var mask = 1 << (zoom - 1);
+            if ((coord[0] & mask) !== 0) b++;
+            if ((coord[1] & mask) !== 0) b += 2;
+            u += b.toString();
+        }
+
+        return template
+            .replace('{t}', subdomains[(coord[0] + coord[1]) % 4])
+            .replace('{u}', u);
+    };
+
     bing.copyrightNotices = function(zoom, extent) {
         zoom = Math.min(zoom, 21);
         return providers.filter(function(provider) {
@@ -21590,6 +21980,9 @@ iD.BackgroundSource.Bing = function(data, dispatch) {
         }).join(', ');
     };
 
+    bing.logo = "bing_maps.png";
+    bing.terms_url = "http://opengeodata.org/microsoft-imagery-details";
+
     return bing;
 };
 iD.GpxLayer = function(context, dispatch) {
@@ -21616,8 +22009,35 @@ iD.GpxLayer = function(context, dispatch) {
             .append('path')
             .attr('class', 'gpx');
 
+        var path = d3.geo.path()
+            .projection(projection);
+
         paths
-            .attr('d', d3.geo.path().projection(projection));
+            .attr('d', path);
+
+        if (typeof gj.features !== 'undefined') {
+            svg
+                .selectAll('text')
+                .remove();
+
+            svg
+                .selectAll('path')
+                .data(gj.features)
+                .enter()
+                .append('text')
+                .attr('class', 'gpx')
+                .text(function(d) {
+                    return d.properties.name;
+                })
+                .attr('x', function(d) {
+                    var centroid = path.centroid(d);
+                    return centroid[0] + 5;
+                })
+                .attr('y', function(d) {
+                    var centroid = path.centroid(d);
+                    return centroid[1];
+                });
+        }
     }
 
     function toDom(x) {
@@ -21701,7 +22121,8 @@ iD.Map = function(context) {
         midpoints = iD.svg.Midpoints(roundedProjection, context),
         labels = iD.svg.Labels(roundedProjection, context),
         supersurface, surface,
-        mouse;
+        mouse,
+        mousemove;
 
     function map(selection) {
         context.history()
@@ -21733,6 +22154,10 @@ iD.Map = function(context) {
             .attr('id', 'surface')
             .call(iD.svg.Surface(context));
 
+        surface.on('mousemove.map', function() {
+            mousemove = d3.event;
+        });
+
         surface.on('mouseover.vertices', function() {
             if (map.editable() && !transformed) {
                 var hover = d3.event.target.__data__;
@@ -21817,7 +22242,7 @@ iD.Map = function(context) {
             .call(midpoints, graph, all, filter, map.extent())
             .call(labels, graph, all, filter, dimensions, !difference && !extent);
 
-        if (points.points(context.intersects(map.extent())).length > 100) {
+        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);
@@ -21930,7 +22355,7 @@ iD.Map = function(context) {
     }
 
     map.mouse = function() {
-        var e = d3.event, s;
+        var e = mousemove || d3.event, s;
         while (s = e.sourceEvent) e = s;
         return mouse(e);
     };
@@ -22434,13 +22859,25 @@ iD.svg.Areas = function(projection) {
             fill: areas
         };
 
+        var bisect = d3.bisector(function(node) {
+            return -node.__data__.area(graph);
+        }).left;
+
+        var fills = surface.selectAll('.layer-fill path.area')[0];
+
+        function sortedByArea(entity) {
+            if (this.__data__ === 'fill') {
+                return fills[bisect(fills, -entity.area(graph))];
+            }
+        }
+
         var paths = surface.selectAll('.layer-shadow, .layer-stroke, .layer-fill')
             .selectAll('path.area')
             .filter(filter)
             .data(function(layer) { return data[layer]; }, iD.Entity.key);
 
         paths.enter()
-            .append('path')
+            .insert('path', sortedByArea)
             .each(function(entity) {
                 var layer = this.parentNode.__data__;
 
@@ -22453,7 +22890,6 @@ iD.svg.Areas = function(projection) {
             .call(iD.svg.TagClasses());
 
         paths
-            .order()
             .attr('d', path);
 
         paths.exit()
@@ -22542,7 +22978,12 @@ iD.svg.Labels = function(projection, context) {
             return c[text];
 
         } else {
-            return size / 3 * 2 * text.length;
+            var str = encodeURIComponent(text).match(/%[CDEFcdef]/g);
+            if (str === null) {
+                return size / 3 * 2 * text.length;
+            } else {
+                return size / 3 * (2 * text.length + str.length);
+            }
         }
     }
 
@@ -22725,18 +23166,23 @@ iD.svg.Labels = function(projection, context) {
         // Split entities into groups specified by label_stack
         for (i = 0; i < entities.length; i++) {
             entity = entities[i];
-            var geometry = entity.geometry(graph),
-                preset = geometry === 'area' && context.presets().match(entity, graph),
+            var geometry = entity.geometry(graph);
+
+            if (geometry === 'vertex')
+                continue;
+            if (hidePoints && geometry === 'point')
+                continue;
+
+            var preset = geometry === 'area' && context.presets().match(entity, graph),
                 icon = preset && !blacklisted(preset) && preset.icon;
 
-            if ((iD.util.displayName(entity) || icon) && !(hidePoints && geometry === 'point')) {
+            if (!icon && !iD.util.displayName(entity))
+                continue;
 
-                for (k = 0; k < label_stack.length; k ++) {
-                    if (entity.geometry(graph) === label_stack[k][0] &&
-                        entity.tags[label_stack[k][1]]) {
-                        labelable[k].push(entity);
-                        break;
-                    }
+            for (k = 0; k < label_stack.length; k ++) {
+                if (geometry === label_stack[k][0] && entity.tags[label_stack[k][1]]) {
+                    labelable[k].push(entity);
+                    break;
                 }
             }
         }
@@ -23112,7 +23558,7 @@ iD.svg.Points = function(projection, context) {
             .remove();
     }
 
-    drawPoints.points = function(entities) {
+    drawPoints.points = function(entities, limit) {
         var graph = context.graph(),
             points = [];
 
@@ -23120,6 +23566,7 @@ iD.svg.Points = function(projection, context) {
             var entity = entities[i];
             if (entity.geometry(graph) === 'point') {
                 points.push(entity);
+                if (limit && points.length >= limit) break;
             }
         }
 
@@ -23128,6 +23575,81 @@ iD.svg.Points = function(projection, context) {
 
     return drawPoints;
 };
+iD.svg.Restrictions = function(context) {
+    var projection = context.projection;
+
+    function drawRestrictions(surface) {
+        var turns = drawRestrictions.turns(context.graph(), context.selectedIDs());
+
+        var groups = surface.select('.layer-hit').selectAll('g.restriction')
+            .data(turns, iD.Entity.key);
+
+        var enter = groups.enter().append('g')
+            .attr('class', 'restriction');
+
+        enter.append('circle')
+            .attr('class', 'restriction')
+            .attr('r', 4);
+
+        groups
+            .attr('transform', function(restriction) {
+                var via = context.entity(restriction.memberByRole('via').id);
+                return iD.svg.PointTransform(projection)(via);
+            });
+
+        groups.exit()
+            .remove();
+
+        return this;
+    }
+
+    drawRestrictions.turns = function (graph, selectedIDs) {
+        if (selectedIDs.length != 1)
+            return [];
+
+        var from = graph.entity(selectedIDs[0]);
+        if (from.type !== 'way')
+            return [];
+
+        return graph.parentRelations(from).filter(function(relation) {
+            var f = relation.memberById(from.id),
+                t = relation.memberByRole('to'),
+                v = relation.memberByRole('via');
+
+            return relation.tags.type === 'restriction' && f.role === 'from' &&
+                t && t.type === 'way' && graph.hasEntity(t.id) &&
+                v && v.type === 'node' && graph.hasEntity(v.id) &&
+                !graph.entity(t.id).isDegenerate() &&
+                !graph.entity(f.id).isDegenerate() &&
+                graph.entity(t.id).affix(v.id) &&
+                graph.entity(f.id).affix(v.id);
+        });
+    };
+
+    drawRestrictions.datum = function(graph, from, restriction, projection) {
+        var to = graph.entity(restriction.memberByRole('to').id),
+            a = graph.entity(restriction.memberByRole('via').id),
+            b;
+
+        if (to.first() === a.id) {
+            b = graph.entity(to.nodes[1]);
+        } else {
+            b = graph.entity(to.nodes[to.nodes.length - 2]);
+        }
+
+        a = projection(a.loc);
+        b = projection(b.loc);
+
+        return {
+            from: from,
+            to: to,
+            restriction: restriction,
+            angle: Math.atan2(b[1] - a[1], b[0] - a[0])
+        }
+    };
+
+    return drawRestrictions;
+};
 iD.svg.Surface = function(context) {
     function autosize(image) {
         var img = document.createElement('img');
@@ -23560,8 +24082,7 @@ iD.ui = function(context) {
             .call(iD.ui.Contributors(context));
 
         window.onbeforeunload = function() {
-            history.save();
-            if (history.hasChanges()) return t('save.unsaved_changes');
+            return context.save();
         };
 
         d3.select(window).on('resize.editor', function() {
@@ -23690,7 +24211,7 @@ iD.ui.Attribution = function(context) {
             .append('span')
             .attr('class', 'provided-by')
             .each(function(d) {
-                var source = d.sourcetag || d.name;
+                var source = d.terms_text || d.id || d.name;
 
                 if (d.logo) {
                     source = '<img class="source-image" src="' + context.imagePath(d.logo) + '">';
@@ -24097,7 +24618,7 @@ iD.ui.Commit = function(context) {
         presets = context.presets();
 
     function zipSame(d) {
-        var c = [], n = -1;
+        var c = {}, n = -1;
         for (var i = 0; i < d.length; i++) {
             var desc = {
                 name: d[i].tags.name || presets.match(d[i], context.graph()).name(),
@@ -24105,15 +24626,15 @@ iD.ui.Commit = function(context) {
                 count: 1,
                 tagText: iD.util.tagText(d[i])
             };
-            if (c[n] &&
-                c[n].name == desc.name &&
-                c[n].tagText == desc.tagText) {
-                c[n].count++;
+
+            var fingerprint = desc.name + desc.tagText;
+            if (c[fingerprint]) {
+                c[fingerprint].count++;
             } else {
-                c[++n] = desc;
+                c[fingerprint] = desc;
             }
         }
-        return c;
+        return _.values(c);
     }
 
     function commit(selection) {
@@ -24146,7 +24667,10 @@ iD.ui.Commit = function(context) {
 
         var commentField = commentSection.append('textarea')
             .attr('placeholder', t('commit.description_placeholder'))
-            .property('value', context.storage('comment') || '');
+            .property('value', context.storage('comment') || '')
+            .on('blur.save', function () {
+                context.storage('comment', this.value);
+            });
 
         commentField.node().select();
 
@@ -24183,10 +24707,8 @@ iD.ui.Commit = function(context) {
         var saveButton = saveSection.append('button')
             .attr('class', 'action col3 button')
             .on('click.save', function() {
-                var comment = commentField.node().value;
-                localStorage.comment = comment;
                 event.save({
-                    comment: comment
+                    comment: commentField.node().value
                 });
             });
 
@@ -24834,117 +25356,40 @@ iD.ui.Geolocate = function(map) {
     };
 };
 iD.ui.Help = function(context) {
-
     var key = 'h';
 
-    function help(selection) {
-
-        var shown = false, pane;
-
-        function setup() {
-            pane = context.container()
-                .select('.help-wrap')
-                .html('');
-
-            var toc = pane.append('ul')
-                .attr('class', 'toc');
-
-            function clickHelp(d, i) {
-                pane.property('scrollTop', 0);
-                doctitle.text(d.title);
-                body.html(d.html);
-                body.selectAll('a')
-                    .attr('target', '_blank');
-                menuItems.classed('selected', function(m) {
-                    return m.title === d.title;
-                });
-
-                nav.html('');
-
-                if (i > 0) {
-                    var prevLink = nav.append('a')
-                            .attr('class', 'previous')
-                            .on('click', function() {
-                                clickHelp(docs[i - 1], i - 1);
-                            });
-                    prevLink.append('span').attr('class', 'icon back blue');
-                    prevLink.append('span').text(docs[i - 1].title);
-                }
-                if (i < docs.length - 1) {
-                    var nextLink = nav.append('a')
-                        .attr('class', 'next')
-                        .on('click', function() {
-                            clickHelp(docs[i + 1], i + 1);
-                        });
-                    nextLink.append('span').text(docs[i + 1].title);
-                    nextLink.append('span').attr('class', 'icon forward blue');
-                }
-            }
-
-            var docKeys = [
-                'help.help',
-                'help.editing_saving',
-                'help.roads',
-                'help.gps',
-                'help.imagery',
-                'help.addresses',
-                'help.inspector',
-                'help.buildings',
-                'help.relations'];
-
-            function one(f) { return function(x) { return f(x); }; }
-            var docs = docKeys.map(one(t)).map(function(text) {
-                return {
-                    title: text.split('\n')[0].replace('#', '').trim(),
-                    html: marked(text.split('\n').slice(1).join('\n'))
-                };
-            });
-
-            var menuItems = toc.selectAll('li')
-                .data(docs)
-                .enter()
-                .append('li')
-                .append('a')
-                .text(function(d) { return d.title; })
-                .on('click', clickHelp);
-
-            toc.append('li')
-                .attr('class','walkthrough')
-                .append('a')
-                .text(t('splash.walkthrough'))
-                .on('click', function() {
-                    d3.select(document.body).call(iD.ui.intro(context));
-                    setVisible(false);
-                });
+    var docKeys = [
+        'help.help',
+        'help.editing_saving',
+        'help.roads',
+        'help.gps',
+        'help.imagery',
+        'help.addresses',
+        'help.inspector',
+        'help.buildings',
+        'help.relations'];
+
+    var docs = docKeys.map(function(key) {
+        var text = t(key);
+        return {
+            title: text.split('\n')[0].replace('#', '').trim(),
+            html: marked(text.split('\n').slice(1).join('\n'))
+        };
+    });
 
-            var content = pane.append('div')
-                    .attr('class', 'left-content'),
-                doctitle = content.append('h2')
-                    .text(t('help.title')),
-                body = content.append('div')
-                    .attr('class', 'body'),
-                nav = content.append('div')
-                    .attr('class', 'nav');
+    function help(selection) {
+        var shown = false;
 
-            clickHelp(docs[0], 0);
+        function hide() {
+            setVisible(false);
         }
 
-        function hide() { setVisible(false); }
         function toggle() {
             if (d3.event) d3.event.preventDefault();
             tooltip.hide(button);
             setVisible(!button.classed('active'));
         }
 
-        function blockClick() {
-            pane.on('mousedown.help-inside', function() {
-                return d3.event.stopPropagation();
-            });
-            selection.on('mousedown.help-inside', function() {
-                return d3.event.stopPropagation();
-            });
-        }
-
         function setVisible(show) {
             if (show !== shown) {
                 button.classed('active', show);
@@ -24954,8 +25399,7 @@ iD.ui.Help = function(context) {
                         .style('right', '-500px')
                         .transition()
                         .duration(200)
-                        .style('right', '0px')
-                        .each('end', blockClick);
+                        .style('right', '0px');
                 } else {
                     pane.style('right', '0px')
                         .transition()
@@ -24964,11 +25408,47 @@ iD.ui.Help = function(context) {
                         .each('end', function() {
                             d3.select(this).style('display', 'none');
                         });
-                    pane.on('mousedown.help-inside', null);
                 }
             }
         }
 
+        function clickHelp(d, i) {
+            pane.property('scrollTop', 0);
+            doctitle.text(d.title);
+            body.html(d.html);
+            body.selectAll('a')
+                .attr('target', '_blank');
+            menuItems.classed('selected', function(m) {
+                return m.title === d.title;
+            });
+
+            nav.html('');
+
+            if (i > 0) {
+                var prevLink = nav.append('a')
+                    .attr('class', 'previous')
+                    .on('click', function() {
+                        clickHelp(docs[i - 1], i - 1);
+                    });
+                prevLink.append('span').attr('class', 'icon back blue');
+                prevLink.append('span').text(docs[i - 1].title);
+            }
+            if (i < docs.length - 1) {
+                var nextLink = nav.append('a')
+                    .attr('class', 'next')
+                    .on('click', function() {
+                        clickHelp(docs[i + 1], i + 1);
+                    });
+                nextLink.append('span').text(docs[i + 1].title);
+                nextLink.append('span').attr('class', 'icon forward blue');
+            }
+        }
+
+        function clickWalkthrough() {
+            d3.select(document.body).call(iD.ui.intro(context));
+            setVisible(false);
+        }
+
         var tooltip = bootstrap.tooltip()
             .placement('left')
             .html(true)
@@ -24982,14 +25462,56 @@ iD.ui.Help = function(context) {
         button.append('span')
             .attr('class', 'icon help light');
 
+        var pane = context.container()
+            .select('.help-wrap');
+
+        var toc = pane.append('ul')
+            .attr('class', 'toc');
+
+        var menuItems = toc.selectAll('li')
+            .data(docs)
+            .enter()
+            .append('li')
+            .append('a')
+            .text(function(d) { return d.title; })
+            .on('click', clickHelp);
+
+        toc.append('li')
+            .attr('class','walkthrough')
+            .append('a')
+            .text(t('splash.walkthrough'))
+            .on('click', clickWalkthrough);
+
+        var content = pane.append('div')
+            .attr('class', 'left-content');
+
+        var doctitle = content.append('h2')
+            .text(t('help.title'));
+
+        var body = content.append('div')
+            .attr('class', 'body');
+
+        var nav = content.append('div')
+            .attr('class', 'nav');
+
+        clickHelp(docs[0], 0);
+
+        var keybinding = d3.keybinding('help')
+            .on(key, toggle);
+
+        d3.select(document)
+            .call(keybinding);
+
         context.surface().on('mousedown.help-outside', hide);
         context.container().on('mousedown.b.help-outside', hide);
 
-        setup();
+        pane.on('mousedown.help-inside', function() {
+            return d3.event.stopPropagation();
+        });
 
-        var keybinding = d3.keybinding('help');
-        keybinding.on(key, toggle);
-        d3.select(document).call(keybinding);
+        selection.on('mousedown.help-inside', function() {
+            return d3.event.stopPropagation();
+        });
     }
 
     return help;
@@ -25121,9 +25643,7 @@ iD.ui.intro = function(context) {
         var savebutton = d3.select('#bar button.save'),
             save = savebutton.on('click');
         savebutton.on('click', null);
-
-        var beforeunload = window.onbeforeunload;
-        window.onbeforeunload = null;
+        context.inIntro(true);
 
         d3.select('.background-layer').style('opacity', 1);
 
@@ -25156,7 +25676,7 @@ iD.ui.intro = function(context) {
             context.background().baseLayerSource(background);
             if (history) context.history().fromJSON(history);
             window.location.replace(hash);
-            window.onbeforeunload = beforeunload;
+            context.inIntro(false);
             d3.select('#bar button.save').on('click', save);
         });
 
@@ -26019,7 +26539,7 @@ iD.ui.RadialMenu = function(context, operations) {
             .attr('class', 'radial-menu-background')
             .attr('d', 'M' + r * Math.sin(a0) + ',' +
                              r * Math.cos(a0) +
-                      ' A' + r + ',' + r + ' 0 0,0 ' +
+                      ' A' + r + ',' + r + ' 0 ' + (operations.length > 5 ? '1' : '0') + ',0 ' +
                              (r * Math.sin(a1) + 1e-3) + ',' +
                              (r * Math.cos(a1) + 1e-3)) // Force positive-length path (#1305)
             .attr('stroke-width', 50)
@@ -26053,14 +26573,32 @@ iD.ui.RadialMenu = function(context, operations) {
         function mouseover(d, i) {
             var rect = context.surfaceRect(),
                 angle = a0 + i * a,
-                dx = rect.left - (angle < 0 ? 200 : 0),
-                dy = rect.top;
+                top = rect.top + (r + 25) * Math.cos(angle) + center[1] + 'px',
+                left = rect.left + (r + 25) * Math.sin(angle) + center[0] + 'px',
+                bottom = rect.height - (r + 25) * Math.cos(angle) - center[1] + 'px',
+                right = rect.width - (r + 25) * Math.sin(angle) - center[0] + 'px';
 
             tooltip
-                .style('left', (r + 25) * Math.sin(angle) + dx + center[0] + 'px')
-                .style('top', (r + 25) * Math.cos(angle) + dy + center[1]+ 'px')
+                .style('top', null)
+                .style('left', null)
+                .style('bottom', null)
+                .style('right', null)
                 .style('display', 'block')
                 .html(iD.ui.tooltipHtml(d.tooltip(), d.keys[0]));
+
+            if (i === 0) {
+                tooltip
+                    .style('right', right)
+                    .style('top', top);
+            } else if (i >= 4) {
+                tooltip
+                    .style('left', left)
+                    .style('bottom', bottom);
+            } else {
+                tooltip
+                    .style('left', left)
+                    .style('top', top);
+            }
         }
 
         function mouseout() {
@@ -28421,7 +28959,7 @@ iD.ui.intro.line = function(context, reveal) {
         var intersection = [-85.62974496187628, 41.95742515554585];
 
         context.map().centerZoom(start, 18);
-        reveal('button.add-line', t('intro.lines.add'), {tooltipClass: 'intro-areas-add'});
+        reveal('button.add-line', t('intro.lines.add'), {tooltipClass: 'intro-lines-add'});
 
         context.on('enter.intro', addLine);
 
@@ -28459,7 +28997,7 @@ iD.ui.intro.line = function(context, reveal) {
         // ended line before creating intersection
         function retry(mode) {
             if (mode.id !== 'select') return;
-            var pointBox = iD.ui.intro.pad(intersection, 30);
+            var pointBox = iD.ui.intro.pad(intersection, 30, context);
             reveal(pointBox, t('intro.lines.restart'));
             timeout(function() {
                 context.replace(iD.actions.DeleteMultiple(mode.selectedIDs()));
@@ -28493,6 +29031,10 @@ iD.ui.intro.line = function(context, reveal) {
             context.on('enter.intro', null);
             d3.select('#curtain').style('pointer-events', 'all');
 
+            presetCategory();
+        }
+
+        function presetCategory() {
             timeout(function() {
                 d3.select('#curtain').style('pointer-events', 'none');
                 var road = d3.select('.preset-category-road .preset-list-button');
@@ -28505,9 +29047,20 @@ iD.ui.intro.line = function(context, reveal) {
             timeout(function() {
                 var grid = d3.select('.subgrid');
                 reveal(grid.node(), t('intro.lines.residential'));
+                grid.selectAll(':not(.preset-highway-residential) .preset-list-button')
+                    .one('click.intro', retryPreset);
                 grid.selectAll('.preset-highway-residential .preset-list-button')
                     .one('click.intro', roadDetails);
-            }, 200);
+            }, 500);
+        }
+
+        // selected wrong road type
+        function retryPreset(mode) {
+            timeout(function() {
+                var preset = d3.select('.entity-editor-pane .preset-list-button');
+                reveal(preset.node(), t('intro.lines.wrong_preset'));
+                preset.one('click.intro', presetCategory);
+            }, 500);
         }
 
         function roadDetails() {
@@ -29355,6 +29908,8 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
     ],
     "discarded": [
         "created_by",
+        "odbl",
+        "odbl:note",
         "tiger:upload_uuid",
         "tiger:tlid",
         "tiger:source",
@@ -29362,8 +29917,30 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
         "geobase:datasetName",
         "geobase:uuid",
         "sub_sea:type",
-        "odbl",
-        "odbl:note",
+        "KSJ2:ADS",
+        "KSJ2:ARE",
+        "KSJ2:AdminArea",
+        "KSJ2:COP_label",
+        "KSJ2:DFD",
+        "KSJ2:INT",
+        "KSJ2:INT_label",
+        "KSJ2:LOC",
+        "KSJ2:LPN",
+        "KSJ2:OPC",
+        "KSJ2:PubFacAdmin",
+        "KSJ2:RAC",
+        "KSJ2:RAC_label",
+        "KSJ2:RIC",
+        "KSJ2:RIN",
+        "KSJ2:WSC",
+        "KSJ2:coordinate",
+        "KSJ2:curve_id",
+        "KSJ2:curve_type",
+        "KSJ2:filename",
+        "KSJ2:lake_id",
+        "KSJ2:lat",
+        "KSJ2:long",
+        "KSJ2:river_id",
         "yh:LINE_NAME",
         "yh:LINE_NUM",
         "yh:STRUCTURE",
@@ -29374,637 +29951,23480 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
     ],
     "imagery": [
         {
-            "name": "Bing aerial imagery",
-            "template": "http://ecn.t{t}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=587&mkt=en-gb&n=z",
-            "description": "Satellite imagery.",
-            "scaleExtent": [
-                0,
-                20
-            ],
-            "subdomains": [
-                "0",
-                "1",
-                "2",
-                "3"
-            ],
-            "default": true,
-            "sourcetag": "Bing",
-            "logo": "bing_maps.png",
-            "logo_url": "http://www.bing.com/maps",
-            "terms_url": "http://opengeodata.org/microsoft-imagery-details"
+            "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": "Locator Overlay",
-            "template": "http://{t}.tiles.mapbox.com/v3/openstreetmap.map-btyhiati/{z}/{x}/{y}.png",
-            "description": "Shows major features to help orient you.",
-            "overlay": true,
-            "default": true,
-            "scaleExtent": [
-                0,
-                16
-            ],
-            "subdomains": [
-                "a",
-                "b",
-                "c"
+            "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_url": "http://mapbox.com/tos/"
+            "terms_text": "AGRI"
         },
         {
-            "name": "MapBox Satellite",
-            "template": "http://{t}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/{z}/{x}/{y}.png",
+            "name": "Bing aerial imagery",
+            "type": "bing",
             "description": "Satellite and aerial imagery.",
+            "template": "http://www.bing.com/maps/",
             "scaleExtent": [
                 0,
-                16
-            ],
-            "subdomains": [
-                "a",
-                "b",
-                "c"
-            ],
-            "terms_url": "http://mapbox.com/tos/"
-        },
-        {
-            "name": "OpenStreetMap",
-            "template": "http://{t}.tile.openstreetmap.org/{z}/{x}/{y}.png",
-            "description": "The default OpenStreetMap layer.",
-            "scaleExtent": [
-                0,
-                18
+                22
             ],
-            "subdomains": [
-                "a",
-                "b",
-                "c"
-            ]
+            "id": "Bing",
+            "default": true
         },
         {
-            "name": "TIGER 2012 Roads Overlay",
-            "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png",
-            "sourcetag": "TIGER 2012",
-            "overlay": 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": [
-                16,
-                19
-            ],
-            "subdomains": [
-                "a",
-                "b",
-                "c"
+                9,
+                20
             ],
-            "extents": [
+            "polygon": [
                 [
                     [
-                        -124.81,
-                        24.055
+                        -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": "Imagerie Drone (Haiti)",
+            "type": "tms",
+            "template": "http://wms.openstreetmap.fr/tms/1.0.0/iomhaiti/{zoom}/{x}/{y}",
+            "polygon": [
+                [
+                    [
+                        -72.1547401,
+                        19.6878969
+                    ],
+                    [
+                        -72.162234,
+                        19.689011
+                    ],
+                    [
+                        -72.164995,
+                        19.6932445
+                    ],
+                    [
+                        -72.1657838,
+                        19.6979977
+                    ],
+                    [
+                        -72.161603,
+                        19.7035677
+                    ],
+                    [
+                        -72.1487449,
+                        19.7028993
+                    ],
+                    [
+                        -72.1477194,
+                        19.7026765
+                    ],
+                    [
+                        -72.1485082,
+                        19.7001514
+                    ],
+                    [
+                        -72.1436963,
+                        19.7011169
+                    ],
+                    [
+                        -72.1410143,
+                        19.7000029
+                    ],
+                    [
+                        -72.139476,
+                        19.6973664
+                    ],
+                    [
+                        -72.1382533,
+                        19.6927617
+                    ],
+                    [
+                        -72.1386872,
+                        19.6923161
+                    ],
+                    [
+                        -72.1380561,
+                        19.6896423
+                    ],
+                    [
+                        -72.1385294,
+                        19.6894938
+                    ],
+                    [
+                        -72.1388055,
+                        19.6901251
+                    ],
+                    [
+                        -72.1388844,
+                        19.6876741
+                    ],
+                    [
+                        -72.1378195,
+                        19.6872656
+                    ],
+                    [
+                        -72.13778,
+                        19.6850003
+                    ],
+                    [
+                        -72.1369517,
+                        19.6855945
+                    ],
+                    [
+                        -72.136794,
+                        19.6840719
+                    ],
+                    [
+                        -72.135729,
+                        19.6835148
+                    ],
+                    [
+                        -72.1355713,
+                        19.6740817
+                    ],
+                    [
+                        -72.1366362,
+                        19.6708133
+                    ],
+                    [
+                        -72.1487843,
+                        19.6710733
+                    ],
+                    [
+                        -72.1534779,
+                        19.6763843
+                    ],
+                    [
+                        -72.1530835,
+                        19.6769414
+                    ],
+                    [
+                        -72.1533251,
+                        19.6769768
+                    ],
+                    [
+                        -72.1532807,
+                        19.6796525
+                    ],
+                    [
+                        -72.1523834,
+                        19.6797175
+                    ],
+                    [
+                        -72.1522749,
+                        19.6803488
+                    ],
+                    [
+                        -72.1519101,
+                        19.6803395
+                    ],
+                    [
+                        -72.1518608,
+                        19.6805067
+                    ],
+                    [
+                        -72.1528173,
+                        19.6806552
+                    ],
+                    [
+                        -72.1522299,
+                        19.6833011
+                    ],
+                    [
+                        -72.1507801,
+                        19.6831499
+                    ],
+                    [
+                        -72.1504457,
+                        19.6847862
+                    ],
+                    [
+                        -72.1508591,
+                        19.6843492
+                    ],
+                    [
+                        -72.1530087,
+                        19.6849898
+                    ],
+                    [
+                        -72.1546258,
+                        19.6854354
+                    ],
+                    [
+                        -72.1543103,
+                        19.6870694
+                    ],
+                    [
+                        -72.1547244,
+                        19.6868466
+                    ],
+                    [
+                        -72.1548501,
+                        19.6877564
+                    ],
+                    [
+                        -72.1545814,
+                        19.6877982
+                    ]
+                ],
+                [
+                    [
+                        -72.1310601,
+                        19.6718929
+                    ],
+                    [
+                        -72.1259842,
+                        19.6772765
+                    ],
+                    [
+                        -72.1255379,
+                        19.6776179
+                    ],
+                    [
+                        -72.1216891,
+                        19.6776442
+                    ],
+                    [
+                        -72.1149677,
+                        19.672602
+                    ],
+                    [
+                        -72.1152745,
+                        19.6687152
+                    ],
+                    [
+                        -72.1198205,
+                        19.6627535
+                    ],
+                    [
+                        -72.1227768,
+                        19.6625696
+                    ],
+                    [
+                        -72.1248965,
+                        19.662701
+                    ],
+                    [
+                        -72.1285779,
+                        19.6645394
+                    ],
+                    [
+                        -72.1308091,
+                        19.6661677
+                    ],
+                    [
+                        -72.1316737,
+                        19.668794
+                    ],
+                    [
+                        -72.1315621,
+                        19.671
+                    ]
+                ],
+                [
+                    [
+                        -71.845795,
+                        19.6709758
+                    ],
+                    [
+                        -71.8429354,
+                        19.6759525
+                    ],
+                    [
+                        -71.8410027,
+                        19.6759525
+                    ],
+                    [
+                        -71.8380249,
+                        19.6755254
+                    ],
+                    [
+                        -71.8378671,
+                        19.6745041
+                    ],
+                    [
+                        -71.8390504,
+                        19.6743927
+                    ],
+                    [
+                        -71.8390109,
+                        19.6741141
+                    ],
+                    [
+                        -71.8398392,
+                        19.673947
+                    ],
+                    [
+                        -71.8389123,
+                        19.6736127
+                    ],
+                    [
+                        -71.8380249,
+                        19.67209
+                    ],
+                    [
+                        -71.8380052,
+                        19.6726285
+                    ],
+                    [
+                        -71.8376699,
+                        19.6727214
+                    ],
+                    [
+                        -71.8376305,
+                        19.672545
+                    ],
+                    [
+                        -71.8354414,
+                        19.6732135
+                    ],
+                    [
+                        -71.835333,
+                        19.6729999
+                    ],
+                    [
+                        -71.8331242,
+                        19.6734642
+                    ],
+                    [
+                        -71.8326706,
+                        19.6716815
+                    ],
+                    [
+                        -71.8321579,
+                        19.67209
+                    ],
+                    [
+                        -71.8307183,
+                        19.6694902
+                    ],
+                    [
+                        -71.8306009,
+                        19.6697594
+                    ],
+                    [
+                        -71.8302174,
+                        19.6698907
+                    ],
+                    [
+                        -71.8291833,
+                        19.6672095
+                    ],
+                    [
+                        -71.8290749,
+                        19.6672095
+                    ],
+                    [
+                        -71.8289122,
+                        19.6667916
+                    ],
+                    [
+                        -71.8289516,
+                        19.6666199
+                    ],
+                    [
+                        -71.8288333,
+                        19.6663506
+                    ],
+                    [
+                        -71.8285572,
+                        19.6664759
+                    ],
+                    [
+                        -71.8288678,
+                        19.6672466
+                    ],
+                    [
+                        -71.8287593,
+                        19.6674138
+                    ],
+                    [
+                        -71.8277979,
+                        19.6678177
+                    ],
+                    [
+                        -71.8277112,
+                        19.6678586
+                    ],
+                    [
+                        -71.8278263,
+                        19.6679637
+                    ],
+                    [
+                        -71.8271831,
+                        19.6681212
+                    ],
+                    [
+                        -71.8271761,
+                        19.6680917
+                    ],
+                    [
+                        -71.8264405,
+                        19.6683921
+                    ],
+                    [
+                        -71.8264074,
+                        19.6683231
+                    ],
+                    [
+                        -71.8261954,
+                        19.6684253
+                    ],
+                    [
+                        -71.8261806,
+                        19.6683556
+                    ],
+                    [
+                        -71.8258946,
+                        19.6684206
+                    ],
+                    [
+                        -71.8258897,
+                        19.6686574
+                    ],
+                    [
+                        -71.8251551,
+                        19.6687549
+                    ],
+                    [
+                        -71.8254509,
+                        19.6691588
+                    ],
+                    [
+                        -71.8229332,
+                        19.6695739
+                    ],
+                    [
+                        -71.822713,
+                        19.6696658
+                    ],
+                    [
+                        -71.8227688,
+                        19.6697577
+                    ],
+                    [
+                        -71.8201751,
+                        19.6709855
+                    ],
+                    [
+                        -71.8198474,
+                        19.6704537
+                    ],
+                    [
+                        -71.8197985,
+                        19.6706014
+                    ],
+                    [
+                        -71.8194674,
+                        19.6707557
+                    ],
+                    [
+                        -71.8182472,
+                        19.6713433
+                    ],
+                    [
+                        -71.8181426,
+                        19.6711431
+                    ],
+                    [
+                        -71.8175813,
+                        19.6714254
+                    ],
+                    [
+                        -71.816959,
+                        19.6707672
+                    ],
+                    [
+                        -71.8176388,
+                        19.6718965
+                    ],
+                    [
+                        -71.8171403,
+                        19.6720376
+                    ],
+                    [
+                        -71.8158225,
+                        19.6718045
+                    ],
+                    [
+                        -71.8138354,
+                        19.6711874
+                    ],
+                    [
+                        -71.8123259,
+                        19.6706982
+                    ],
+                    [
+                        -71.8121759,
+                        19.6704258
+                    ],
+                    [
+                        -71.8124304,
+                        19.6701467
+                    ],
+                    [
+                        -71.8119184,
+                        19.6700141
+                    ],
+                    [
+                        -71.8118765,
+                        19.6705828
+                    ],
+                    [
+                        -71.811169,
+                        19.6703483
+                    ],
+                    [
+                        -71.8095938,
+                        19.6698516
+                    ],
+                    [
+                        -71.8077992,
+                        19.6692829
+                    ],
+                    [
+                        -71.8056028,
+                        19.668612
+                    ],
+                    [
+                        -71.8051443,
+                        19.6668942
+                    ],
+                    [
+                        -71.8051196,
+                        19.6652322
+                    ],
+                    [
+                        -71.8052315,
+                        19.661979
+                    ],
+                    [
+                        -71.8065603,
+                        19.6523921
+                    ],
+                    [
+                        -71.8073412,
+                        19.6482946
+                    ],
+                    [
+                        -71.8099686,
+                        19.6468292
+                    ],
+                    [
+                        -71.8147517,
+                        19.6454502
+                    ],
+                    [
+                        -71.8147726,
+                        19.6455619
+                    ],
+                    [
+                        -71.8150027,
+                        19.6455093
+                    ],
+                    [
+                        -71.8149469,
+                        19.6453846
+                    ],
+                    [
+                        -71.8159928,
+                        19.6450234
+                    ],
+                    [
+                        -71.8158882,
+                        19.6448855
+                    ],
+                    [
+                        -71.8165854,
+                        19.6446097
+                    ],
+                    [
+                        -71.8190119,
+                        19.643802
+                    ],
+                    [
+                        -71.8211524,
+                        19.643454
+                    ],
+                    [
+                        -71.8221564,
+                        19.6433292
+                    ],
+                    [
+                        -71.8269046,
+                        19.643211
+                    ],
+                    [
+                        -71.8280481,
+                        19.6432241
+                    ],
+                    [
+                        -71.8304466,
+                        19.6440778
+                    ],
+                    [
+                        -71.8306419,
+                        19.6448592
+                    ],
+                    [
+                        -71.8295263,
+                        19.6450365
+                    ],
+                    [
+                        -71.8296064,
+                        19.6456111
+                    ],
+                    [
+                        -71.8299411,
+                        19.6455651
+                    ],
+                    [
+                        -71.8303699,
+                        19.6451744
+                    ],
+                    [
+                        -71.830471,
+                        19.6453452
+                    ],
+                    [
+                        -71.8308092,
+                        19.6451974
+                    ],
+                    [
+                        -71.8310184,
+                        19.6451088
+                    ],
+                    [
+                        -71.8312519,
+                        19.6458541
+                    ],
+                    [
+                        -71.8311125,
+                        19.6458245
+                    ],
+                    [
+                        -71.831367,
+                        19.6465862
+                    ],
+                    [
+                        -71.8328939,
+                        19.646189
+                    ],
+                    [
+                        -71.8344566,
+                        19.6457062
+                    ],
+                    [
+                        -71.8344664,
+                        19.6463052
+                    ],
+                    [
+                        -71.834215,
+                        19.6461938
+                    ],
+                    [
+                        -71.8342002,
+                        19.6465513
+                    ],
+                    [
+                        -71.8346702,
+                        19.6463
+                    ],
+                    [
+                        -71.8349118,
+                        19.6463905
+                    ],
+                    [
+                        -71.8347984,
+                        19.6462187
+                    ],
+                    [
+                        -71.8354393,
+                        19.6458496
+                    ],
+                    [
+                        -71.8355034,
+                        19.6458032
+                    ],
+                    [
+                        -71.8364747,
+                        19.6461328
+                    ],
+                    [
+                        -71.8376382,
+                        19.6472658
+                    ],
+                    [
+                        -71.8379143,
+                        19.647888
+                    ],
+                    [
+                        -71.8390483,
+                        19.6508039
+                    ],
+                    [
+                        -71.8456942,
+                        19.6696203
+                    ]
+                ],
+                [
+                    [
+                        -72.098878,
+                        18.54843
+                    ],
+                    [
+                        -72.096993,
+                        18.5501994
+                    ],
+                    [
+                        -72.0972888,
+                        18.5503209
+                    ],
+                    [
+                        -72.0968451,
+                        18.5503489
+                    ],
+                    [
+                        -72.0955632,
+                        18.551854
+                    ],
+                    [
+                        -72.0956428,
+                        18.5526742
+                    ],
+                    [
+                        -72.0959914,
+                        18.5533748
+                    ],
+                    [
+                        -72.0962145,
+                        18.553203
+                    ],
+                    [
+                        -72.0962842,
+                        18.5535665
+                    ],
+                    [
+                        -72.0964446,
+                        18.5535533
+                    ],
+                    [
+                        -72.0965352,
+                        18.5539764
+                    ],
+                    [
+                        -72.0965056,
+                        18.554173
+                    ],
+                    [
+                        -72.0966085,
+                        18.5541747
+                    ],
+                    [
+                        -72.0965178,
+                        18.5542127
+                    ],
+                    [
+                        -72.0968769,
+                        18.5546588
+                    ],
+                    [
+                        -72.0979018,
+                        18.5552141
+                    ],
+                    [
+                        -72.1006211,
+                        18.5555875
+                    ],
+                    [
+                        -72.1014926,
+                        18.5556206
+                    ],
+                    [
+                        -72.1024339,
+                        18.5555016
+                    ],
+                    [
+                        -72.103417,
+                        18.5543515
+                    ],
+                    [
+                        -72.1034798,
+                        18.5516215
+                    ],
+                    [
+                        -72.1030789,
+                        18.5516149
+                    ],
+                    [
+                        -72.1033752,
+                        18.5515224
+                    ],
+                    [
+                        -72.1035042,
+                        18.5515224
+                    ],
+                    [
+                        -72.1035239,
+                        18.5502417
+                    ],
+                    [
+                        -72.1028701,
+                        18.5503062
+                    ],
+                    [
+                        -72.1029015,
+                        18.55025
+                    ],
+                    [
+                        -72.1028457,
+                        18.5501773
+                    ],
+                    [
+                        -72.1035081,
+                        18.5500252
+                    ],
+                    [
+                        -72.103491,
+                        18.5497396
+                    ],
+                    [
+                        -72.1035181,
+                        18.5497361
+                    ],
+                    [
+                        -72.1035398,
+                        18.5489039
+                    ],
+                    [
+                        -72.1034317,
+                        18.5487056
+                    ],
+                    [
+                        -72.102717,
+                        18.5481437
+                    ],
+                    [
+                        -72.1025601,
+                        18.5481536
+                    ],
+                    [
+                        -72.10229,
+                        18.5482751
+                    ],
+                    [
+                        -72.1022891,
+                        18.5482569
+                    ],
+                    [
+                        -72.1025201,
+                        18.5481396
+                    ],
+                    [
+                        -72.1023388,
+                        18.5481321
+                    ],
+                    [
+                        -72.0999082,
+                        18.5480901
+                    ],
+                    [
+                        -72.09907,
+                        18.5483799
+                    ]
+                ],
+                [
+                    [
+                        -72.2542503,
+                        18.568262
+                    ],
+                    [
+                        -72.2560252,
+                        18.5717765
+                    ],
+                    [
+                        -72.2557886,
+                        18.5748049
+                    ],
+                    [
+                        -72.2535009,
+                        18.5755526
+                    ],
+                    [
+                        -72.2522782,
+                        18.5755526
+                    ],
+                    [
+                        -72.2499906,
+                        18.5740945
+                    ],
+                    [
+                        -72.2473874,
+                        18.5698323
+                    ],
+                    [
+                        -72.2460069,
+                        18.566729
+                    ],
+                    [
+                        -72.2458492,
+                        18.5629527
+                    ],
+                    [
+                        -72.2479396,
+                        18.5625414
+                    ],
+                    [
+                        -72.2501483,
+                        18.5628031
+                    ],
+                    [
+                        -72.2519232,
+                        18.5650839
+                    ]
+                ],
+                [
+                    [
+                        -72.303145,
+                        18.5332749
+                    ],
+                    [
+                        -72.3031275,
+                        18.5331799
+                    ],
+                    [
+                        -72.3048311,
+                        18.5311081
+                    ],
+                    [
+                        -72.3097397,
+                        18.5311081
+                    ],
+                    [
+                        -72.3164332,
+                        18.5324302
+                    ],
+                    [
+                        -72.3234056,
+                        18.5366083
+                    ],
+                    [
+                        -72.3261388,
+                        18.5387765
+                    ],
+                    [
+                        -72.3261946,
+                        18.5426371
+                    ],
+                    [
+                        -72.3170468,
+                        18.5540596
+                    ],
+                    [
+                        -72.3130864,
+                        18.5540596
+                    ],
+                    [
+                        -72.2987511,
+                        18.5453342
+                    ],
+                    [
+                        -72.2988627,
+                        18.5407333
+                    ],
+                    [
+                        -72.2962969,
+                        18.5404689
+                    ],
+                    [
+                        -72.2954602,
+                        18.5395169
+                    ],
+                    [
+                        -72.2961853,
+                        18.5338582
+                    ],
+                    [
+                        -72.2971893,
+                        18.5332235
+                    ],
+                    [
+                        -72.3007034,
+                        18.5332764
+                    ],
+                    [
+                        -72.3022652,
+                        18.5342284
+                    ],
+                    [
+                        -72.3028486,
+                        18.5335189
+                    ],
+                    [
+                        -72.303104,
+                        18.5333361
+                    ],
+                    [
+                        -72.303181,
+                        18.5334007
+                    ],
+                    [
+                        -72.3035793,
+                        18.5335614
+                    ],
+                    [
+                        -72.3030793,
+                        18.5346463
+                    ],
+                    [
+                        -72.303715,
+                        18.5339873
+                    ],
+                    [
+                        -72.3045286,
+                        18.5344052
+                    ],
+                    [
+                        -72.3044015,
+                        18.5345097
+                    ],
+                    [
+                        -72.3062747,
+                        18.5352571
+                    ],
+                    [
+                        -72.3063107,
+                        18.5352741
+                    ],
+                    [
+                        -72.3061219,
+                        18.5357628
+                    ],
+                    [
+                        -72.3061219,
+                        18.5358196
+                    ],
+                    [
+                        -72.30637,
+                        18.5358928
+                    ],
+                    [
+                        -72.3062726,
+                        18.5354869
+                    ],
+                    [
+                        -72.3066688,
+                        18.5350891
+                    ],
+                    [
+                        -72.3061963,
+                        18.5349706
+                    ],
+                    [
+                        -72.3058869,
+                        18.5349385
+                    ],
+                    [
+                        -72.3055373,
+                        18.5346833
+                    ],
+                    [
+                        -72.3054864,
+                        18.534613
+                    ],
+                    [
+                        -72.3055585,
+                        18.5345065
+                    ],
+                    [
+                        -72.3046749,
+                        18.5342293
+                    ],
+                    [
+                        -72.3047617,
+                        18.5338817
+                    ],
+                    [
+                        -72.3043252,
+                        18.5337511
+                    ],
+                    [
+                        -72.3042595,
+                        18.5336346
+                    ]
+                ],
+                [
+                    [
+                        -72.2981405,
+                        18.477502
+                    ],
+                    [
+                        -72.2935652,
+                        18.4948587
+                    ],
+                    [
+                        -72.2922242,
+                        18.4964297
+                    ],
+                    [
+                        -72.2931708,
+                        18.4972526
+                    ],
+                    [
+                        -72.2892266,
+                        18.5057058
+                    ],
+                    [
+                        -72.2878067,
+                        18.5080996
+                    ],
+                    [
+                        -72.2850458,
+                        18.5119893
+                    ],
+                    [
+                        -72.2840203,
+                        18.5113161
+                    ],
+                    [
+                        -72.2808649,
+                        18.515879
+                    ],
+                    [
+                        -72.2773151,
+                        18.5175994
+                    ],
+                    [
+                        -72.2723454,
+                        18.5175246
+                    ],
+                    [
+                        -72.2662714,
+                        18.5144578
+                    ],
+                    [
+                        -72.2665869,
+                        18.5066783
+                    ],
+                    [
+                        -72.2692643,
+                        18.5046154
+                    ],
+                    [
+                        -72.2661965,
+                        18.5029756
+                    ],
+                    [
+                        -72.2688181,
+                        18.4965222
+                    ],
+                    [
+                        -72.2691528,
+                        18.4959403
+                    ],
+                    [
+                        -72.2702684,
+                        18.4961519
+                    ],
+                    [
+                        -72.2702684,
+                        18.4955964
+                    ],
+                    [
+                        -72.2690691,
+                        18.49557
+                    ],
+                    [
+                        -72.2692922,
+                        18.4937714
+                    ],
+                    [
+                        -72.2736988,
+                        18.4859951
+                    ],
+                    [
+                        -72.2746749,
+                        18.4850429
+                    ],
+                    [
+                        -72.2751769,
+                        18.483403
+                    ],
+                    [
+                        -72.2765435,
+                        18.4813398
+                    ],
+                    [
+                        -72.2773523,
+                        18.4814985
+                    ],
+                    [
+                        -72.2783006,
+                        18.4809694
+                    ],
+                    [
+                        -72.2778544,
+                        18.4807049
+                    ],
+                    [
+                        -72.2771013,
+                        18.480123
+                    ],
+                    [
+                        -72.2789978,
+                        18.4775836
+                    ],
+                    [
+                        -72.279723,
+                        18.4772927
+                    ],
+                    [
+                        -72.2806433,
+                        18.4776365
+                    ],
+                    [
+                        -72.2813685,
+                        18.4771604
+                    ],
+                    [
+                        -72.2808386,
+                        18.4769752
+                    ],
+                    [
+                        -72.2812848,
+                        18.4758378
+                    ],
+                    [
+                        -72.2823167,
+                        18.4751765
+                    ],
+                    [
+                        -72.2851615,
+                        18.4750971
+                    ],
+                    [
+                        -72.2849941,
+                        18.4763668
+                    ],
+                    [
+                        -72.2854404,
+                        18.4769752
+                    ],
+                    [
+                        -72.286277,
+                        18.4756262
+                    ],
+                    [
+                        -72.2869325,
+                        18.4754675
+                    ],
+                    [
+                        -72.2865978,
+                        18.4751897
+                    ],
+                    [
+                        -72.2865978,
+                        18.4750046
+                    ],
+                    [
+                        -72.2909765,
+                        18.4747268
+                    ],
+                    [
+                        -72.2946579,
+                        18.4749384
+                    ],
+                    [
+                        -72.2973911,
+                        18.476843
+                    ]
+                ],
+                [
+                    [
+                        -72.3466657,
+                        18.5222375
+                    ],
+                    [
+                        -72.346833,
+                        18.5244325
+                    ],
+                    [
+                        -72.3475303,
+                        18.5277645
+                    ],
+                    [
+                        -72.3455501,
+                        18.5291131
+                    ],
+                    [
+                        -72.3403069,
+                        18.5292189
+                    ],
+                    [
+                        -72.3383267,
+                        18.5280289
+                    ],
+                    [
+                        -72.3369043,
+                        18.530118
+                    ],
+                    [
+                        -72.3338086,
+                        18.5296684
+                    ],
+                    [
+                        -72.3289279,
+                        18.5270769
+                    ],
+                    [
+                        -72.328649,
+                        18.5253316
+                    ],
+                    [
+                        -72.3292068,
+                        18.5232689
+                    ],
+                    [
+                        -72.330406,
+                        18.5220524
+                    ],
+                    [
+                        -72.3321631,
+                        18.5221847
+                    ],
+                    [
+                        -72.3322467,
+                        18.5191963
+                    ],
+                    [
+                        -72.3369183,
+                        18.5183633
+                    ],
+                    [
+                        -72.3382012,
+                        18.5184691
+                    ],
+                    [
+                        -72.3381454,
+                        18.5181782
+                    ],
+                    [
+                        -72.3411993,
+                        18.5177947
+                    ],
+                    [
+                        -72.3454943,
+                        18.5171997
+                    ],
+                    [
+                        -72.3492595,
+                        18.517279
+                    ],
+                    [
+                        -72.3504308,
+                        18.5188922
+                    ],
+                    [
+                        -72.3503472,
+                        18.5206112
+                    ],
+                    [
+                        -72.3496778,
+                        18.5220392
+                    ]
+                ],
+                [
+                    [
+                        -72.3303078,
+                        18.5486462
+                    ],
+                    [
+                        -72.3429687,
+                        18.5508149
+                    ],
+                    [
+                        -72.3433236,
+                        18.5530585
+                    ],
+                    [
+                        -72.3413121,
+                        18.5614341
+                    ],
+                    [
+                        -72.3390639,
+                        18.5613593
+                    ],
+                    [
+                        -72.3384723,
+                        18.5638271
+                    ],
+                    [
+                        -72.3375257,
+                        18.5654348
+                    ],
+                    [
+                        -72.3348436,
+                        18.5650609
+                    ],
+                    [
+                        -72.3311755,
+                        18.5638271
+                    ],
+                    [
+                        -72.3312149,
+                        18.5616211
+                    ],
+                    [
+                        -72.3232082,
+                        18.5606863
+                    ],
+                    [
+                        -72.3212361,
+                        18.559602
+                    ],
+                    [
+                        -72.3208023,
+                        18.5587046
+                    ],
+                    [
+                        -72.3208811,
+                        18.557882
+                    ],
+                    [
+                        -72.3259493,
+                        18.5580274
+                    ],
+                    [
+                        -72.3266186,
+                        18.5581993
+                    ],
+                    [
+                        -72.3259214,
+                        18.5577498
+                    ],
+                    [
+                        -72.3250986,
+                        18.5573797
+                    ],
+                    [
+                        -72.3233767,
+                        18.552263
+                    ],
+                    [
+                        -72.3245994,
+                        18.5478507
+                    ],
+                    [
+                        -72.3288986,
+                        18.5483742
+                    ],
+                    [
+                        -72.329979,
+                        18.5489548
+                    ]
+                ],
+                [
+                    [
+                        -72.3231383,
+                        18.5269828
+                    ],
+                    [
+                        -72.3223434,
+                        18.528067
+                    ],
+                    [
+                        -72.3209629,
+                        18.5279745
+                    ],
+                    [
+                        -72.3207816,
+                        18.5271282
+                    ],
+                    [
+                        -72.3208513,
+                        18.5253697
+                    ],
+                    [
+                        -72.3214649,
+                        18.5249598
+                    ],
+                    [
+                        -72.3225666,
+                        18.5248937
+                    ],
+                    [
+                        -72.3228454,
+                        18.52533
+                    ],
+                    [
+                        -72.3232359,
+                        18.5264804
+                    ]
+                ],
+                [
+                    [
+                        -72.2160832,
+                        18.6457752
+                    ],
+                    [
+                        -72.2159649,
+                        18.6553795
+                    ],
+                    [
+                        -72.2030279,
+                        18.6558279
+                    ],
+                    [
+                        -72.1947057,
+                        18.6553421
+                    ],
+                    [
+                        -72.1922208,
+                        18.6545573
+                    ],
+                    [
+                        -72.1920631,
+                        18.6521283
+                    ],
+                    [
+                        -72.193483,
+                        18.6477559
+                    ],
+                    [
+                        -72.201253,
+                        18.6385249
+                    ],
+                    [
+                        -72.2069327,
+                        18.6388239
+                    ],
+                    [
+                        -72.2120996,
+                        18.6424117
+                    ],
+                    [
+                        -72.2118068,
+                        18.6430591
+                    ],
+                    [
+                        -72.2121693,
+                        18.6426892
+                    ],
+                    [
+                        -72.2127968,
+                        18.6427552
+                    ],
+                    [
+                        -72.2134662,
+                        18.6431252
+                    ],
+                    [
+                        -72.2135638,
+                        18.6437462
+                    ],
+                    [
+                        -72.2154176,
+                        18.6443947
+                    ],
+                    [
+                        -72.2158909,
+                        18.6450301
+                    ]
+                ],
+                [
+                    [
+                        -72.2867654,
+                        18.6482017
+                    ],
+                    [
+                        -72.2900977,
+                        18.6527446
+                    ],
+                    [
+                        -72.28981,
+                        18.6536532
+                    ],
+                    [
+                        -72.2900738,
+                        18.6542664
+                    ],
+                    [
+                        -72.290721,
+                        18.6537667
+                    ],
+                    [
+                        -72.2910327,
+                        18.6544709
+                    ],
+                    [
+                        -72.2912485,
+                        18.654221
+                    ],
+                    [
+                        -72.29168,
+                        18.6558905
+                    ],
+                    [
+                        -72.2912245,
+                        18.656606
+                    ],
+                    [
+                        -72.2922673,
+                        18.65597
+                    ],
+                    [
+                        -72.2926869,
+                        18.6567536
+                    ],
+                    [
+                        -72.2930705,
+                        18.6567309
+                    ],
+                    [
+                        -72.2941253,
+                        18.6581846
+                    ],
+ &nb