From 4bfc91cc8508f7ba7fb248b4e5ecdbd1e1be490e Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 12:34:11 -0500 Subject: [PATCH 01/25] Fix dragging cursor off of edge while drawing --- js/id/behavior/draw.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/js/id/behavior/draw.js b/js/id/behavior/draw.js index 625fc04a4..6536b590f 100644 --- a/js/id/behavior/draw.js +++ b/js/id/behavior/draw.js @@ -1,8 +1,7 @@ iD.behavior.Draw = function(context) { var event = d3.dispatch('move', 'click', 'clickWay', 'clickNode', 'clickMidpoint', 'undo', 'cancel', 'finish'), keybinding = d3.keybinding('draw'), - hover = iD.behavior.Hover(), - down; + hover = iD.behavior.Hover(); function datum() { if (d3.event.altKey) { @@ -13,17 +12,17 @@ iD.behavior.Draw = function(context) { } function mousedown() { - down = true; - } + var selection = d3.select(this); + selection.on('mousemove.draw', null); - function mouseup() { - down = false; + d3.select(window) + .on('mouseup.draw', function() { + selection.on('mousemove.draw', mousemove); + }); } function mousemove() { - if (!down) { - event.move(datum()); - } + event.move(datum()); } function click() { @@ -81,7 +80,6 @@ iD.behavior.Draw = function(context) { selection .on('mousedown.draw', mousedown) - .on('mouseup.draw', mouseup) .on('mousemove.draw', mousemove) .on('click.draw', click); @@ -98,7 +96,6 @@ iD.behavior.Draw = function(context) { selection .on('mousedown.draw', null) - .on('mouseup.draw', null) .on('mousemove.draw', null) .on('click.draw', null); From e4a8fbd0f6de74edbca05734d142ab368a2b9750 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 13:34:14 -0500 Subject: [PATCH 02/25] Eliminate flickering --- js/id/behavior/draw_way.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/id/behavior/draw_way.js b/js/id/behavior/draw_way.js index 1cc52ab1f..a0a6aa308 100644 --- a/js/id/behavior/draw_way.js +++ b/js/id/behavior/draw_way.js @@ -17,7 +17,13 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { var loc = context.map().mouseCoordinates(); if (datum.type === 'node') { - loc = datum.loc; + if (datum.id === nodeId) { + context.surface().selectAll('.way, .node') + .filter(function (d) { return d.id === nodeId; }) + .classed('active', true); + } else { + loc = datum.loc; + } } else if (datum.type === 'midpoint' || datum.type === 'way') { var way = datum.type === 'way' ? datum : From c2ddf67cc0639661d2534ab9c9c90c2b0374a03b Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 4 Feb 2013 11:20:23 -0800 Subject: [PATCH 03/25] Show appropriate tooltips for disabled undo/redo buttons Implementing this cross-browser requires using a `.disabled` class rather than the `disabled` property. No browsers except Opera dispatch mouse events on disabled buttons. Fixes #620. --- css/app.css | 11 ++++++++--- js/id/ui.js | 12 ++++++------ locale/en.js | 3 +++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/css/app.css b/css/app.css index e660d5989..a43133f3d 100644 --- a/css/app.css +++ b/css/app.css @@ -273,7 +273,12 @@ button.active { cursor:url(../img/cursor-pointing.png) 6 1, auto; } -button.active:not([disabled]) { +button.disabled { + background: #6c6c6c; + cursor: auto; +} + +button.active:not([disabled]):not(.disabled) { background: #6bc641; } @@ -450,8 +455,8 @@ button[disabled] .icon.browse { background-position: 0px -40px;} button[disabled] .icon.add-point { background-position: -20px -40px;} button[disabled] .icon.add-line { background-position: -40px -40px;} button[disabled] .icon.add-area { background-position: -60px -40px;} -button[disabled] .icon.undo { background-position: -80px -40px;} -button[disabled] .icon.redo { background-position: -100px -40px;} +button.disabled .icon.undo { background-position: -80px -40px;} +button.disabled .icon.redo { background-position: -100px -40px;} button[disabled] .apply.icon { background-position: -120px -40px;} button[disabled] .save.icon { background-position: -140px -40px;} button[disabled] .close.icon { background-position: -160px -40px;} diff --git a/js/id/ui.js b/js/id/ui.js index 69f20c2fd..f8c58903f 100644 --- a/js/id/ui.js +++ b/js/id/ui.js @@ -91,14 +91,14 @@ iD.ui = function (context) { undo_buttons.append('button') .attr({ id: 'undo', 'class': 'col6' }) - .property('disabled', true) + .classed('disabled', true) .html("") .on('click.editor', history.undo) .call(undo_tooltip); undo_buttons.append('button') .attr({ id: 'redo', 'class': 'col6' }) - .property('disabled', true) + .classed('disabled', true) .html("") .on('click.editor', history.redo) .call(undo_tooltip); @@ -209,13 +209,13 @@ iD.ui = function (context) { } limiter.select('#undo') - .property('disabled', !undo) - .attr('data-original-title', hintprefix('⌘ + Z', undo)) + .classed('disabled', !undo) + .attr('data-original-title', hintprefix('⌘ + Z', undo || t('nothing_to_undo'))) .call(refreshTooltip); limiter.select('#redo') - .property('disabled', !redo) - .attr('data-original-title', hintprefix('⌘ + ⇧ + Z', redo)) + .classed('disabled', !redo) + .attr('data-original-title', hintprefix('⌘ + ⇧ + Z', redo || t('nothing_to_redo'))) .call(refreshTooltip); }); diff --git a/locale/en.js b/locale/en.js index 31d6a13de..b446c4ae4 100644 --- a/locale/en.js +++ b/locale/en.js @@ -141,6 +141,9 @@ locale.en = { "zoom-in": "Zoom In", "zoom-out": "Zoom Out", + nothing_to_undo: "Nothing to undo.", + nothing_to_redo: "Nothing to redo.", + "browser_notice": "This editor is supported in Firefox, Chrome, Safari, Opera, and Internet Explorer 9 and above. Please upgrade your browser or use Potlatch 2 to edit the map.", "layer_settings": "Layer Settings", From 6e74456b3134c49e72391fa6b3133dcf6ab07d93 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Feb 2013 14:57:43 -0500 Subject: [PATCH 04/25] Fix dragging around resized edges. Fixes #552 --- js/id/behavior/drag_node.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/id/behavior/drag_node.js b/js/id/behavior/drag_node.js index b62162e94..a0cb06e75 100644 --- a/js/id/behavior/drag_node.js +++ b/js/id/behavior/drag_node.js @@ -1,8 +1,7 @@ iD.behavior.DragNode = function(context) { - var size = context.map().size(), - nudgeInterval; + var nudgeInterval; - function edge(point) { + 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]; @@ -39,7 +38,7 @@ iD.behavior.DragNode = function(context) { .on('move', function(entity) { d3.event.sourceEvent.stopPropagation(); - var nudge = edge(d3.event.point); + var nudge = edge(d3.event.point, context.map().size()); if (nudge) startNudge(nudge); else stopNudge(); From ad5c819f49617bf5626045978af43e4c9ffeb39c Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Feb 2013 15:01:18 -0500 Subject: [PATCH 05/25] Do not use keywords --- locale/en.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/en.js b/locale/en.js index b446c4ae4..d99e88908 100644 --- a/locale/en.js +++ b/locale/en.js @@ -44,7 +44,7 @@ locale.en = { area: "Started an area." } }, - continue: { + 'continue': { annotation: { line: "Continued a line.", area: "Continued an area." @@ -74,7 +74,7 @@ locale.en = { area: "Squared the corners of an area." } }, - delete: { + 'delete': { title: "Delete", description: "Remove this from the map.", key: "⌫", From 0450e57acfc2ad217f8b946660f18586540a1c15 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 4 Feb 2013 12:05:41 -0800 Subject: [PATCH 06/25] Layers -> Background (#525) --- js/id/ui/layerswitcher.js | 4 ++-- locale/en.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/id/ui/layerswitcher.js b/js/id/ui/layerswitcher.js index 9e5e4dd4f..ecdbab0f9 100644 --- a/js/id/ui/layerswitcher.js +++ b/js/id/ui/layerswitcher.js @@ -35,7 +35,7 @@ iD.ui.layerswitcher = function(context) { .append('button') .attr('tabindex', -1) .attr('class', 'fillD') - .attr('title', t('layer_settings')) + .attr('title', t('layerswitcher.description')) .html("") .on('click.layerswitcher-toggle', toggle); @@ -59,7 +59,7 @@ iD.ui.layerswitcher = function(context) { .append('div') .attr('class', 'opacity-options-wrapper'); - opa.append('h4').text(t('layerswitcher.layers')); + opa.append('h4').text(t('layerswitcher.title')); var opacityList = opa.append('ul') .attr('class', 'opacity-options'); diff --git a/locale/en.js b/locale/en.js index d99e88908..88861bdee 100644 --- a/locale/en.js +++ b/locale/en.js @@ -146,8 +146,6 @@ locale.en = { "browser_notice": "This editor is supported in Firefox, Chrome, Safari, Opera, and Internet Explorer 9 and above. Please upgrade your browser or use Potlatch 2 to edit the map.", - "layer_settings": "Layer Settings", - inspector: { no_documentation_combination: "This is no documentation available for this tag combination", no_documentation_key: "This is no documentation available for this key", @@ -168,8 +166,10 @@ locale.en = { "description": "Description", "logout": "logout", + layerswitcher: { - layers: "Layers", + title: "Background", + description: "Background Settings", percent_brightness: "{opacity}% brightness" } }; From 7ddfcaed3962536ce11308aaf3a1679745fe672d Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 4 Feb 2013 12:08:30 -0800 Subject: [PATCH 07/25] i18n --- js/id/ui/layerswitcher.js | 4 ++-- locale/en.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/js/id/ui/layerswitcher.js b/js/id/ui/layerswitcher.js index ecdbab0f9..9eb063517 100644 --- a/js/id/ui/layerswitcher.js +++ b/js/id/ui/layerswitcher.js @@ -151,7 +151,7 @@ iD.ui.layerswitcher = function(context) { } adjustments.append('a') - .text('Fix misalignment') + .text(t('layerswitcher.fix_misalignment')) .attr('href', '#') .classed('alignment-toggle', true) .classed('expanded', false) @@ -179,7 +179,7 @@ iD.ui.layerswitcher = function(context) { .on('click', nudge); nudge_container.append('button') - .text('reset') + .text(t('layerswitcher.reset')) .attr('class', 'reset') .on('click', function() { context.background().offset([0, 0]); diff --git a/locale/en.js b/locale/en.js index 88861bdee..0fa3c1ea2 100644 --- a/locale/en.js +++ b/locale/en.js @@ -170,6 +170,8 @@ locale.en = { layerswitcher: { title: "Background", description: "Background Settings", - percent_brightness: "{opacity}% brightness" + percent_brightness: "{opacity}% brightness", + fix_misalignment: "Fix misalignment", + reset: "reset" } }; From 940a7a9a6af301c38fdb949fcf474547899da4f8 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 4 Feb 2013 12:18:11 -0800 Subject: [PATCH 08/25] Revise README --- README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 08c6764c0..8cf1daeeb 100644 --- a/README.md +++ b/README.md @@ -2,30 +2,28 @@ [![Build Status](https://secure.travis-ci.org/systemed/iD.png)](https://travis-ci.org/systemed/iD) -[![](http://ideditor.com/img/editor.png)](http://geowiki.com/iD/) - -[Try the online demo of the most recent code.](http://geowiki.com/iD/) and -[open issues for bugs and ideas!](https://github.com/systemed/iD/issues) +[![](http://ideditor.com/img/editor.png)](http://ideditor.com/) ## Basics * iD is a JavaScript [OpenStreetMap](http://www.openstreetmap.org/) editor. * It's intentionally simple. It lets you do the most basic tasks while not breaking other people's data. -* We support modern browsers. Data is rendered with [d3](http://d3js.org/). +* It supports modern browsers. Data is rendered with [d3](http://d3js.org/). ## Participate! +* [Try out the latest stable release](http://geowiki.com/iD/) * [Read up on Contributing and the code style of iD](CONTRIBUTING.md) -* See [open issues in the issue tracker if you're looking for something to do](https://github.com/systemed/iD/issues?state=open) +* See [open issues in the issue tracker](https://github.com/systemed/iD/issues?state=open) if you're looking for something to do -To run the code locally, just fork this project and run it from a local webserver. -With a Mac, you can enable Web Sharing and drop this in your website directory. - -If you have Python handy, just `cd` into `iD` and run +To run the current development version, fork this project and serve it locally. +If you have Python handy, just `cd` into the project root directory and run python -m SimpleHTTPServer +Or, with a Mac, you can enable Web Sharing and clone iD into your website directory. + Come on in, the water's lovely. More help? Ping RichardF, tmcw, or jfire on IRC (`irc.oftc.net`, in `#osm-dev` or `#osm`), on the OSM mailing lists or at richard@systemeD.net. From 6dd1bebe89b8d7456114ca9c8e10eaff47a16fd8 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 4 Feb 2013 12:26:57 -0800 Subject: [PATCH 09/25] Fix drawing in Firefox (fixes #628) --- js/id/behavior/draw_way.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/id/behavior/draw_way.js b/js/id/behavior/draw_way.js index a0a6aa308..717218c8d 100644 --- a/js/id/behavior/draw_way.js +++ b/js/id/behavior/draw_way.js @@ -165,5 +165,5 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { context.enter(iD.modes.Browse(context)); }; - return d3.rebind(drawWay, event, 'on'); + return drawWay; }; From 83e241083d5cd5d678a56b874c8b13711327065f Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 15:30:59 -0500 Subject: [PATCH 10/25] Remove event --- js/id/behavior/draw.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/id/behavior/draw.js b/js/id/behavior/draw.js index 6536b590f..eb207eeb5 100644 --- a/js/id/behavior/draw.js +++ b/js/id/behavior/draw.js @@ -99,6 +99,8 @@ iD.behavior.Draw = function(context) { .on('mousemove.draw', null) .on('click.draw', null); + d3.select(window).on('mouseup.draw', null); + d3.select(document) .call(keybinding.off) .on('keydown.draw', null) From 3449a680a75cea1ea45e360a4bb61d97926b1379 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Feb 2013 16:02:34 -0500 Subject: [PATCH 11/25] Add tag deprecation action and data, not yet integrated. --- data/data.js | 1 + data/deprecated.js | 112 ++++++++++++++++++++++++++++ index.html | 3 + js/id/actions/deprecate_tags.js | 36 +++++++++ test/index.html | 5 ++ test/spec/actions/deprecate_tags.js | 40 ++++++++++ 6 files changed, 197 insertions(+) create mode 100644 data/data.js create mode 100644 data/deprecated.js create mode 100644 js/id/actions/deprecate_tags.js create mode 100644 test/spec/actions/deprecate_tags.js diff --git a/data/data.js b/data/data.js new file mode 100644 index 000000000..279b1ea86 --- /dev/null +++ b/data/data.js @@ -0,0 +1 @@ +iD.data = {}; diff --git a/data/deprecated.js b/data/deprecated.js new file mode 100644 index 000000000..53457c9f3 --- /dev/null +++ b/data/deprecated.js @@ -0,0 +1,112 @@ +// from http://wiki.openstreetmap.org/wiki/Deprecated_features +// TODO: deal with deprecated 'class' tag +// does not deal with landuse=wood because of indecision +// we will not care about http://taginfo.openstreetmap.org/tags/bicycle_parking=sheffield +iD.data.deprecated = [ + { + old: { barrier: 'wire_fence' }, + replace: { + barrier: 'fence', + fence_type: 'chain' + } + }, + { + old: { barrier: 'wood_fence' }, + replace: { + barrier: 'fence', + fence_type: 'wood' + } + }, + { + old: { highway: 'ford' }, + replace: { + ford: 'yes' + } + }, + { + old: { highway: 'ford' }, + replace: { + ford: 'yes' + } + }, + { + old: { highway: 'ford' }, + replace: { + ford: 'yes' + } + }, + { + old: { highway: 'stile' }, + replace: { + barrier: 'stile' + } + }, + { + old: { highway: 'incline' }, + replace: { + highway: 'road', + incline: 'up' + } + }, + { + old: { highway: 'incline_steep' }, + replace: { + highway: 'road', + incline: 'up' + } + }, + { + old: { highway: 'unsurfaced' }, + replace: { + highway: 'road', + incline: 'unpaved' + } + }, + { + old: { highway: 'unsurfaced' }, + replace: { + highway: 'road', + incline: 'unpaved' + } + }, + { + old: { landuse: 'wood' }, + replace: { + highway: 'road', + incline: 'unpaved' + } + }, + { + old: { natural: 'marsh' }, + replace: { + natural: 'wetland', + wetland: 'marsh' + } + }, + { + old: { shop: 'organic' }, + replace: { + shop: 'supermarket', + organic: 'only' + } + }, + { + old: { power_source: '*' }, + replace: { + 'generator:source': '$1' + } + }, + { + old: { power_rating: '*' }, + replace: { + 'generator:output': '$1' + } + }, + { + old: { bicycle_parking: 'organic' }, + replace: { + shop: 'supermarket', + organic: 'only' + } + } +]; diff --git a/index.html b/index.html index 83ae066eb..c03ac29ae 100644 --- a/index.html +++ b/index.html @@ -134,6 +134,9 @@ + + +
+ @@ -130,6 +131,9 @@ + + + + diff --git a/test/spec/actions/deprecate_tags.js b/test/spec/actions/deprecate_tags.js new file mode 100644 index 000000000..4f202e97f --- /dev/null +++ b/test/spec/actions/deprecate_tags.js @@ -0,0 +1,40 @@ +describe('iD.actions.DeprecateTags', function () { + it('deprecates tags', function () { + var entity = iD.Entity({ tags: { barrier: 'wire_fence' } }), + graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])), + undeprecated = { + barrier: 'fence', + fence_type: 'chain' + }; + expect(graph.entity(entity.id).tags).to.eql(undeprecated); + }); + + it('does not overwrite explicit tags', function () { + var entity = iD.Entity({ tags: { barrier: 'wire_fence', fence_type: 'foo' } }), + graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])), + undeprecated = { + barrier: 'fence', + fence_type: 'foo' + }; + expect(graph.entity(entity.id).tags).to.eql(undeprecated); + }); + + it('leaves other tags alone', function () { + var entity = iD.Entity({ tags: { highway: 'ford', name: 'Foo' } }), + graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])), + undeprecated = { + ford: 'yes', + name: 'Foo' + }; + expect(graph.entity(entity.id).tags).to.eql(undeprecated); + }); + + it('replaces keys', function () { + var entity = iD.Entity({ tags: { power_rating: '1 billion volts' } }), + graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])), + undeprecated = { + 'generator:output': '1 billion volts' + }; + expect(graph.entity(entity.id).tags).to.eql(undeprecated); + }); +}); From 3d8f2ffb84646a81fa8458c470e18322a01e97a4 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Feb 2013 16:08:34 -0500 Subject: [PATCH 12/25] Consistify syntax --- js/id/graph/history.js | 24 ++++++++++++------------ js/id/modes/select.js | 12 ++++++------ js/id/ui.js | 16 ++++++++-------- js/id/ui/save.js | 4 +++- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/js/id/graph/history.js b/js/id/graph/history.js index 7d1098027..a0930203c 100644 --- a/js/id/graph/history.js +++ b/js/id/graph/history.js @@ -27,11 +27,11 @@ iD.History = function() { } var history = { - graph: function () { + graph: function() { return stack[index].graph; }, - merge: function (entities) { + merge: function(entities) { for (var i = 0; i < stack.length; i++) { stack[i].graph.rebase(entities); } @@ -39,7 +39,7 @@ iD.History = function() { dispatch.change(); }, - perform: function () { + perform: function() { var previous = stack[index].graph; stack = stack.slice(0, index + 1); @@ -49,7 +49,7 @@ iD.History = function() { return change(previous); }, - replace: function () { + replace: function() { var previous = stack[index].graph; // assert(index == stack.length - 1) @@ -58,7 +58,7 @@ iD.History = function() { return change(previous); }, - pop: function () { + pop: function() { var previous = stack[index].graph; if (index > 0) { @@ -68,7 +68,7 @@ iD.History = function() { } }, - undo: function () { + undo: function() { var previous = stack[index].graph; // Pop to the first annotated state. @@ -87,7 +87,7 @@ iD.History = function() { return change(previous); }, - redo: function () { + redo: function() { var previous = stack[index].graph; while (index < stack.length - 1) { @@ -99,7 +99,7 @@ iD.History = function() { return change(previous); }, - undoAnnotation: function () { + undoAnnotation: function() { var i = index; while (i >= 0) { if (stack[i].annotation) return stack[i].annotation; @@ -107,7 +107,7 @@ iD.History = function() { } }, - redoAnnotation: function () { + redoAnnotation: function() { var i = index + 1; while (i <= stack.length - 1) { if (stack[i].annotation) return stack[i].annotation; @@ -115,13 +115,13 @@ iD.History = function() { } }, - difference: function () { + difference: function() { var base = stack[0].graph, head = stack[index].graph; return iD.Difference(base, head); }, - changes: function () { + changes: function() { var difference = history.difference(); return { modified: difference.modified(), @@ -145,7 +145,7 @@ iD.History = function() { undefined, 'Custom'); }, - reset: function () { + reset: function() { stack = [{graph: iD.Graph()}]; index = 0; dispatch.change(); diff --git a/js/id/modes/select.js b/js/id/modes/select.js index 02db6a57f..ec6017ae3 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -39,11 +39,11 @@ iD.modes.Select = function(context, selection, initial) { }); var operations = d3.values(iD.operations) - .map(function (o) { return o(selection, context); }) - .filter(function (o) { return o.available(); }); + .map(function(o) { return o(selection, context); }) + .filter(function(o) { return o.available(); }); operations.forEach(function(operation) { - keybinding.on(operation.key, function () { + keybinding.on(operation.key, function() { if (operation.enabled()) { operation(); } @@ -87,7 +87,7 @@ iD.modes.Select = function(context, selection, initial) { context.history().on('change.select', function() { context.surface().call(radialMenu.close); - if (_.any(selection, function (id) { return !context.entity(id); })) { + if (_.any(selection, function(id) { return !context.entity(id); })) { // Exit mode if selected entity gets undone context.enter(iD.modes.Browse(context)); @@ -128,7 +128,7 @@ iD.modes.Select = function(context, selection, initial) { context.surface() .on('dblclick.select', dblclick) .selectAll("*") - .filter(function (d) { return d && selection.indexOf(d.id) >= 0; }) + .filter(function(d) { return d && selection.indexOf(d.id) >= 0; }) .classed('selected', true); radialMenu = iD.ui.RadialMenu(operations); @@ -144,7 +144,7 @@ iD.modes.Select = function(context, selection, initial) { } }; - mode.exit = function () { + mode.exit = function() { if (singular()) { changeTags(singular(), inspector.tags()); } diff --git a/js/id/ui.js b/js/id/ui.js index f8c58903f..03e5c6199 100644 --- a/js/id/ui.js +++ b/js/id/ui.js @@ -1,4 +1,4 @@ -iD.ui = function (context) { +iD.ui = function(context) { return function(container) { context.container(container); @@ -42,12 +42,12 @@ iD.ui = function (context) { .data(modes) .enter().append('button') .attr('tabindex', -1) - .attr('class', function (mode) { return mode.title + ' add-button col3'; }) + .attr('class', function(mode) { return mode.title + ' add-button col3'; }) .call(bootstrap.tooltip().placement('bottom').html(true)) - .attr('data-original-title', function (mode) { + .attr('data-original-title', function(mode) { return hintprefix(mode.key, mode.description); }) - .on('click.editor', function (mode) { context.enter(mode); }); + .on('click.editor', function(mode) { context.enter(mode); }); function disableTooHigh() { if (map.editable()) { @@ -74,14 +74,14 @@ iD.ui = function (context) { return d.id + ' icon icon-pre-text'; }); - buttons.append('span').attr('class', 'label').text(function (mode) { return mode.title; }); + buttons.append('span').attr('class', 'label').text(function(mode) { return mode.title; }); - context.on('enter.editor', function (entered) { - buttons.classed('active', function (mode) { return entered.button === mode.button; }); + context.on('enter.editor', function(entered) { + buttons.classed('active', function(mode) { return entered.button === mode.button; }); container.classed("mode-" + entered.id, true); }); - context.on('exit.editor', function (exited) { + context.on('exit.editor', function(exited) { container.classed("mode-" + exited.id, false); }); diff --git a/js/id/ui/save.js b/js/id/ui/save.js index 773ae4d50..fc593c463 100644 --- a/js/id/ui/save.js +++ b/js/id/ui/save.js @@ -17,7 +17,9 @@ iD.ui.save = function(context) { d3.select('.shaded').remove(); var l = iD.ui.loading(t('uploading_changes'), true); - connection.putChangeset(history.changes(), e.comment, history.imagery_used(), function(err, changeset_id) { + connection.putChangeset(history.changes(), + e.comment, + history.imagery_used(), function(err, changeset_id) { l.remove(); history.reset(); map.flush().redraw(); From d756e3c2a2b76139c397c76abf9bc8c19d20ae20 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 16:30:19 -0500 Subject: [PATCH 13/25] Let ways be self-intersected --- js/id/behavior/draw_way.js | 45 ++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/js/id/behavior/draw_way.js b/js/id/behavior/draw_way.js index 717218c8d..32d05538f 100644 --- a/js/id/behavior/draw_way.js +++ b/js/id/behavior/draw_way.js @@ -1,25 +1,37 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { var way = context.entity(wayId), + isArea = way.geometry() === 'area', finished = false, annotation = t((way.isDegenerate() ? 'operations.start.annotation.' : 'operations.continue.annotation.') + context.geometry(wayId)), draw = iD.behavior.Draw(context); - var node = iD.Node({loc: context.map().mouseCoordinates()}), - nodeId = node.id; + var startIndex = typeof index === 'undefined' ? way.nodes.length - 1 : 0, + start = iD.Node({loc: context.graph().entity(way.nodes[startIndex]).loc}), + end = iD.Node({loc: context.map().mouseCoordinates()}), + segment = iD.Way({ + nodes: [start.id, end.id], + tags: _.clone(way.tags) + }); - context[way.isDegenerate() ? 'replace' : 'perform']( - iD.actions.AddEntity(node), - iD.actions.AddVertex(wayId, node.id, index)); + var f = context[way.isDegenerate() ? 'replace' : 'perform']; + if (isArea) { + f(iD.actions.AddEntity(end), + iD.actions.AddVertex(wayId, end.id, index)); + } else { + f(iD.actions.AddEntity(start), + iD.actions.AddEntity(end), + iD.actions.AddEntity(segment)); + } function move(datum) { var loc = context.map().mouseCoordinates(); if (datum.type === 'node') { - if (datum.id === nodeId) { + if (datum.id === end.id) { context.surface().selectAll('.way, .node') - .filter(function (d) { return d.id === nodeId; }) + .filter(function (d) { return d.id === end.id; }) .classed('active', true); } else { loc = datum.loc; @@ -31,7 +43,7 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { loc = iD.geo.chooseIndex(way, d3.mouse(context.surface().node()), context).loc; } - context.replace(iD.actions.MoveNode(nodeId, loc)); + context.replace(iD.actions.MoveNode(end.id, loc)); } function undone() { @@ -55,7 +67,7 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { surface.call(draw) .selectAll('.way, .node') - .filter(function (d) { return d.id === wayId || d.id === nodeId; }) + .filter(function (d) { return d.id === segment.id || d.id === start.id || d.id === end.id; }) .classed('active', true); context.history() @@ -85,9 +97,18 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { function ReplaceTemporaryNode(newNode) { return function(graph) { - return graph - .replace(way.removeNode(nodeId).addNode(newNode.id, index)) - .remove(node); + if (isArea) { + return graph + .replace(way.removeNode(end.id).addNode(newNode.id, index)) + .remove(end); + + } else { + return graph + .replace(graph.entity(wayId).addNode(newNode.id, index)) + .remove(end) + .remove(segment) + .remove(start); + } }; } From bd7f30273006de51326b58e5a6a76ed2ad0bfecc Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Feb 2013 16:45:18 -0500 Subject: [PATCH 14/25] Show deprecated tags in save commit, validate them, add deprecatedTags to entity type. --- js/id/graph/entity.js | 27 ++++++++++++++++++++++----- js/id/ui/save.js | 1 + js/id/util.js | 4 ++-- js/id/validate.js | 8 ++++++++ locale/en.js | 3 ++- test/spec/graph/entity.js | 10 ++++++++++ test/spec/util.js | 4 ++-- 7 files changed, 47 insertions(+), 10 deletions(-) diff --git a/js/id/graph/entity.js b/js/id/graph/entity.js index bce9675ee..bd402552e 100644 --- a/js/id/graph/entity.js +++ b/js/id/graph/entity.js @@ -9,22 +9,22 @@ iD.Entity = function(attrs) { return (new iD.Entity()).initialize(arguments); }; -iD.Entity.id = function (type) { +iD.Entity.id = function(type) { return iD.Entity.id.fromOSM(type, iD.Entity.id.next[type]--); }; iD.Entity.id.next = {node: -1, way: -1, relation: -1}; -iD.Entity.id.fromOSM = function (type, id) { +iD.Entity.id.fromOSM = function(type, id) { return type[0] + id; }; -iD.Entity.id.toOSM = function (id) { +iD.Entity.id.toOSM = function(id) { return id.slice(1); }; // A function suitable for use as the second argument to d3.selection#data(). -iD.Entity.key = function (entity) { +iD.Entity.key = function(entity) { return entity.id; }; @@ -84,7 +84,7 @@ iD.Entity.prototype = { }, hasInterestingTags: function() { - return _.keys(this.tags).some(function (key) { + return _.keys(this.tags).some(function(key) { return key != "attribution" && key != "created_by" && key != "source" && @@ -93,6 +93,23 @@ iD.Entity.prototype = { }); }, + deprecatedTags: function() { + var tags = _.pairs(this.tags); + var deprecated = {}; + + iD.data.deprecated.forEach(function(d) { + var match = _.pairs(d.old)[0]; + tags.forEach(function(t) { + if (t[0] == match[0] && + (t[1] == match[1] || match[1] == '*')) { + deprecated[t[0]] = t[1]; + } + }); + }); + + return deprecated; + }, + friendlyName: function() { // Generate a string such as 'river' or 'Fred's House' for an entity. if (!this.tags || !Object.keys(this.tags).length) { return ''; } diff --git a/js/id/ui/save.js b/js/id/ui/save.js index fc593c463..4e3bf883c 100644 --- a/js/id/ui/save.js +++ b/js/id/ui/save.js @@ -17,6 +17,7 @@ iD.ui.save = function(context) { d3.select('.shaded').remove(); var l = iD.ui.loading(t('uploading_changes'), true); + connection.putChangeset(history.changes(), e.comment, history.imagery_used(), function(err, changeset_id) { diff --git a/js/id/util.js b/js/id/util.js index 645d15363..9ebd4d761 100644 --- a/js/id/util.js +++ b/js/id/util.js @@ -8,8 +8,8 @@ iD.util.trueObj = function(arr) { iD.util.tagText = function(entity) { return d3.entries(entity.tags).map(function(e) { - return e.key + ': ' + e.value; - }).join('\n'); + return e.key + '=' + e.value; + }).join(', '); }; iD.util.stringQs = function(str) { diff --git a/js/id/validate.js b/js/id/validate.js index 6329b626f..dacff7889 100644 --- a/js/id/validate.js +++ b/js/id/validate.js @@ -29,6 +29,14 @@ iD.validate = function(changes, graph) { warnings.push({ message: t('validations.untagged_line'), entity: change }); } + var deprecatedTags = change.deprecatedTags(); + if (!_.isEmpty(deprecatedTags)) { + warnings.push({ + message: t('validations.deprecated_tags', { + tags: iD.util.tagText({ tags: deprecatedTags }) + }), entity: change }); + } + if (change.geometry(graph) === 'area' && _.isEmpty(change.tags)) { warnings.push({ message: t('validations.untagged_area'), entity: change }); } diff --git a/locale/en.js b/locale/en.js index 0fa3c1ea2..8f00590c6 100644 --- a/locale/en.js +++ b/locale/en.js @@ -127,7 +127,8 @@ locale.en = { untagged_point: "Untagged point which is not part of a line or area", untagged_line: "Untagged line", untagged_area: "Untagged area", - tag_suggests_area: "The tag {tag} suggests line should be area, but it is not an area" + tag_suggests_area: "The tag {tag} suggests line should be area, but it is not an area", + deprecated_tags: "Deprecated tags: {tags}" }, "save": "Save", diff --git a/test/spec/graph/entity.js b/test/spec/graph/entity.js index f2ac85f17..f0b7e0b19 100644 --- a/test/spec/graph/entity.js +++ b/test/spec/graph/entity.js @@ -114,6 +114,16 @@ describe('iD.Entity', function () { }); }); + describe("#hasDeprecatedTags", function () { + it("returns false if entity has no tags", function () { + expect(iD.Entity().deprecatedTags()).to.eql({}); + }); + + it("returns true if entity has deprecated tags", function () { + expect(iD.Entity({ tags: { barrier: 'wire_fence' } }).deprecatedTags()).to.eql({ barrier: 'wire_fence' }); + }); + }); + describe("#hasInterestingTags", function () { it("returns false if the entity has no tags", function () { expect(iD.Entity().hasInterestingTags()).to.equal(false); diff --git a/test/spec/util.js b/test/spec/util.js index de3fab735..d866a7b39 100644 --- a/test/spec/util.js +++ b/test/spec/util.js @@ -6,8 +6,8 @@ describe('iD.Util', function() { it('.tagText', function() { expect(iD.util.tagText({})).to.eql(''); - expect(iD.util.tagText({tags:{foo:'bar'}})).to.eql('foo: bar'); - expect(iD.util.tagText({tags:{foo:'bar',two:'three'}})).to.eql('foo: bar\ntwo: three'); + expect(iD.util.tagText({tags:{foo:'bar'}})).to.eql('foo=bar'); + expect(iD.util.tagText({tags:{foo:'bar',two:'three'}})).to.eql('foo=bar, two=three'); }); it('.stringQs', function() { From 9ec7491645dd5977646e6b23fef64074f64e4097 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 16:45:34 -0500 Subject: [PATCH 15/25] Fix baseline shifting for opera --- css/map.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/map.css b/css/map.css index ab2a352c9..f1998277c 100644 --- a/css/map.css +++ b/css/map.css @@ -620,7 +620,7 @@ text.pointlabel { } .pathlabel .textpath { - dominant-baseline: middle; + baseline-shift: -33%; } .pointlabel-halo, From b7cfaf08da7db5507944d012c4d8a4998b1d90bb Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Feb 2013 16:48:44 -0500 Subject: [PATCH 16/25] userDetails should handle errors properly --- js/id/connection.js | 1 + js/id/ui/userpanel.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/js/id/connection.js b/js/id/connection.js index 794232682..5f5f17482 100644 --- a/js/id/connection.js +++ b/js/id/connection.js @@ -208,6 +208,7 @@ iD.Connection = function(context) { function userDetails(callback) { function done(err, user_details) { + if (err) return callback(err); var u = user_details.getElementsByTagName('user')[0], img = u.getElementsByTagName('img'), image_url = ''; diff --git a/js/id/ui/userpanel.js b/js/id/ui/userpanel.js index 2b28411a6..fda2fc463 100644 --- a/js/id/ui/userpanel.js +++ b/js/id/ui/userpanel.js @@ -5,10 +5,12 @@ iD.ui.userpanel = function(connection) { function update() { if (connection.authenticated()) { selection.style('display', 'block'); - connection.userDetails(function(user_details) { + connection.userDetails(function(err, user_details) { selection.html(''); + if (err) return; + // Link var userLink = selection.append('a') .attr('href', connection.url() + '/user/' + From d0d1a16c0ac4ff8d419b51406a9a8026a91b1c7e Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 17:04:33 -0500 Subject: [PATCH 17/25] Fix label halo sizing --- js/id/svg/labels.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/id/svg/labels.js b/js/id/svg/labels.js index 551c29e81..9b2cbd1e9 100644 --- a/js/id/svg/labels.js +++ b/js/id/svg/labels.js @@ -33,8 +33,11 @@ iD.svg.Labels = function(projection) { var font_sizes = label_stack.map(function(d) { var style = iD.util.getStyle('text.' + d[0] + '.tag-' + d[1]); var m = style && style.cssText.match("font-size: ([0-9]{1,2})px;"); - if (!m) return default_size; - return parseInt(m[1], 10); + if (m) return parseInt(m[1], 10); + style = iD.util.getStyle('text.' + d[0]); + m = style && style.cssText.match("font-size: ([0-9]{1,2})px;"); + if (m) return parseInt(m[1], 10); + return default_size; }); var pointOffsets = [ @@ -281,7 +284,7 @@ iD.svg.Labels = function(projection) { p = getAreaLabel(entity, width, font_size); } if (p) { - p.classes = entity.geometry(graph) + ' tag-' + label_stack[k].slice(1).join('-'); + p.classes = entity.geometry(graph) + ' tag-' + label_stack[k][1]; positions[entity.geometry(graph)].push(p); labelled[entity.geometry(graph)].push(entity); } From 1b70a68214c559b7c4d0bbde1f5cfbc8ba3adf85 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 17:14:56 -0500 Subject: [PATCH 18/25] Revert "Don't snap to midpoints, snap to their parent way" This reverts commit 13b0b540a7cbc15d0c67f067f72a3f3f16092e62. Conflicts: js/id/behavior/draw_way.js --- js/id/behavior/draw_way.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/js/id/behavior/draw_way.js b/js/id/behavior/draw_way.js index 32d05538f..64ec15e51 100644 --- a/js/id/behavior/draw_way.js +++ b/js/id/behavior/draw_way.js @@ -28,19 +28,10 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { function move(datum) { var loc = context.map().mouseCoordinates(); - if (datum.type === 'node') { - if (datum.id === end.id) { - context.surface().selectAll('.way, .node') - .filter(function (d) { return d.id === end.id; }) - .classed('active', true); - } else { - loc = datum.loc; - } - } else if (datum.type === 'midpoint' || datum.type === 'way') { - var way = datum.type === 'way' ? - datum : - context.entity(datum.ways[0].id); - loc = iD.geo.chooseIndex(way, d3.mouse(context.surface().node()), context).loc; + if (datum.type === 'node' || datum.type === 'midpoint') { + loc = datum.loc; + } else if (datum.type === 'way') { + loc = iD.geo.chooseIndex(datum, d3.mouse(context.surface().node()), context).loc; } context.replace(iD.actions.MoveNode(end.id, loc)); From 3417a1639c1a3fd60c11a46782bb833e48ab3746 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 17:16:14 -0500 Subject: [PATCH 19/25] Hide midpoints when drawing (no snapping) --- css/map.css | 8 ++++++++ js/id/behavior/draw_way.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/css/map.css b/css/map.css index f1998277c..63950671f 100644 --- a/css/map.css +++ b/css/map.css @@ -117,6 +117,14 @@ g.vertex.selected .shadow { /* midpoints */ +.mode-draw-area g.midpoint, +.mode-draw-line g.midpoint, +.mode-add-area g.midpoint, +.mode-add-line g.midpoint, +.mode-add-point g.midpoint { + display: none; +} + g.midpoint .fill { fill:#aaa; } diff --git a/js/id/behavior/draw_way.js b/js/id/behavior/draw_way.js index 64ec15e51..fa2c24c87 100644 --- a/js/id/behavior/draw_way.js +++ b/js/id/behavior/draw_way.js @@ -28,7 +28,7 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { function move(datum) { var loc = context.map().mouseCoordinates(); - if (datum.type === 'node' || datum.type === 'midpoint') { + if (datum.type === 'node') { loc = datum.loc; } else if (datum.type === 'way') { loc = iD.geo.chooseIndex(datum, d3.mouse(context.surface().node()), context).loc; From 3e71dd56cd90915938f9d3fe433d53b69be8cd00 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Feb 2013 17:20:06 -0500 Subject: [PATCH 20/25] Wipe out some tags entirely, refs #585 --- data/deprecated.js | 10 +++++++++- js/id/actions/deprecate_tags.js | 6 +++--- test/spec/actions/deprecate_tags.js | 7 +++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/data/deprecated.js b/data/deprecated.js index 53457c9f3..7cc6904ed 100644 --- a/data/deprecated.js +++ b/data/deprecated.js @@ -108,5 +108,13 @@ iD.data.deprecated = [ shop: 'supermarket', organic: 'only' } - } + }, + // entirely discarded tags + { old: { 'tiger:upload_uuid': '*' } }, + { old: { 'tiger:tlid': '*' } }, + { old: { 'tiger:source': '*' } }, + { old: { 'tiger:separated': '*' } }, + { old: { 'geobase:datasetName': '*' } }, + { old: { 'geobase:uuid': '*' } }, + { old: { 'sub_sea:type': '*' } } ]; diff --git a/js/id/actions/deprecate_tags.js b/js/id/actions/deprecate_tags.js index 8f7a56404..68b9f9d2e 100644 --- a/js/id/actions/deprecate_tags.js +++ b/js/id/actions/deprecate_tags.js @@ -10,19 +10,19 @@ iD.actions.DeprecateTags = function(entityId) { rule = iD.data.deprecated[i]; var match = _.pairs(rule.old)[0], - replacements = _.pairs(rule.replace); + replacements = rule.replace ? _.pairs(rule.replace) : null; if (entity.tags[match[0]] && match[1] === '*') { var value = entity.tags[match[0]]; - if (!newtags[replacements[0][0]]) { + if (replacements && !newtags[replacements[0][0]]) { newtags[replacements[0][0]] = value; } delete newtags[match[0]]; change = true; } else if (entity.tags[match[0]] === match[1]) { - newtags = _.assign({}, rule.replace, _.omit(newtags, match[0])); + newtags = _.assign({}, rule.replace || {}, _.omit(newtags, match[0])); change = true; } } diff --git a/test/spec/actions/deprecate_tags.js b/test/spec/actions/deprecate_tags.js index 4f202e97f..61d1da4fb 100644 --- a/test/spec/actions/deprecate_tags.js +++ b/test/spec/actions/deprecate_tags.js @@ -29,6 +29,13 @@ describe('iD.actions.DeprecateTags', function () { expect(graph.entity(entity.id).tags).to.eql(undeprecated); }); + it('wipes out tags that should be entirely removed', function () { + var entity = iD.Entity({ tags: { 'tiger:source': 'foo' } }), + graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])), + undeprecated = { }; + expect(graph.entity(entity.id).tags).to.eql(undeprecated); + }); + it('replaces keys', function () { var entity = iD.Entity({ tags: { power_rating: '1 billion volts' } }), graph = iD.actions.DeprecateTags(entity.id)(iD.Graph([entity])), From 7e997af9b8391e7189b9eac023cbdea60ff758d6 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 17:24:00 -0500 Subject: [PATCH 21/25] Hide midpoints when vertices hidden --- js/id/svg/midpoints.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/id/svg/midpoints.js b/js/id/svg/midpoints.js index 935f84719..c59ef0bca 100644 --- a/js/id/svg/midpoints.js +++ b/js/id/svg/midpoints.js @@ -2,6 +2,10 @@ iD.svg.Midpoints = function(projection) { return function drawMidpoints(surface, graph, entities, filter) { var midpoints = {}; + if (!surface.select('.layer-hit').select('g.vertex').node()) { + return surface.select('.layer-hit').selectAll('g.midpoint').remove(); + } + for (var i = 0; i < entities.length; i++) { if (entities[i].type !== 'way') continue; From d5937907a45f7c405a072e96ff5e39eb9c2b71e4 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 17:39:16 -0500 Subject: [PATCH 22/25] Hide midpoints without breaking drawing I always forget d3 works this way. --- js/id/svg/midpoints.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/id/svg/midpoints.js b/js/id/svg/midpoints.js index c59ef0bca..96048b1ed 100644 --- a/js/id/svg/midpoints.js +++ b/js/id/svg/midpoints.js @@ -2,8 +2,8 @@ iD.svg.Midpoints = function(projection) { return function drawMidpoints(surface, graph, entities, filter) { var midpoints = {}; - if (!surface.select('.layer-hit').select('g.vertex').node()) { - return surface.select('.layer-hit').selectAll('g.midpoint').remove(); + if (!surface.select('.layer-hit.g.vertex').node()) { + return surface.select('.layer-hit.g.midpoint').remove(); } for (var i = 0; i < entities.length; i++) { From c8ab057f19b58e724fba124360c4d05840a28726 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 18:26:45 -0500 Subject: [PATCH 23/25] Remove unused midpoint code --- js/id/behavior/add_way.js | 3 +-- js/id/behavior/draw.js | 5 +---- js/id/behavior/draw_way.js | 14 -------------- js/id/modes/add_area.js | 15 --------------- js/id/modes/add_line.js | 14 -------------- js/id/modes/add_point.js | 1 - 6 files changed, 2 insertions(+), 50 deletions(-) diff --git a/js/id/behavior/add_way.js b/js/id/behavior/add_way.js index 207c88566..782d7f183 100644 --- a/js/id/behavior/add_way.js +++ b/js/id/behavior/add_way.js @@ -1,12 +1,11 @@ iD.behavior.AddWay = function(context) { - var event = d3.dispatch('start', 'startFromWay', 'startFromNode', 'startFromMidpoint'), + var event = d3.dispatch('start', 'startFromWay', 'startFromNode') draw = iD.behavior.Draw(context); var addWay = function(surface) { draw.on('click', event.start) .on('clickWay', event.startFromWay) .on('clickNode', event.startFromNode) - .on('clickMidpoint', event.startFromMidpoint) .on('cancel', addWay.cancel) .on('finish', addWay.cancel); diff --git a/js/id/behavior/draw.js b/js/id/behavior/draw.js index eb207eeb5..656eb7988 100644 --- a/js/id/behavior/draw.js +++ b/js/id/behavior/draw.js @@ -1,5 +1,5 @@ iD.behavior.Draw = function(context) { - var event = d3.dispatch('move', 'click', 'clickWay', 'clickNode', 'clickMidpoint', 'undo', 'cancel', 'finish'), + var event = d3.dispatch('move', 'click', 'clickWay', 'clickNode', 'undo', 'cancel', 'finish'), keybinding = d3.keybinding('draw'), hover = iD.behavior.Hover(); @@ -34,9 +34,6 @@ iD.behavior.Draw = function(context) { } else if (d.type === 'node') { event.clickNode(d); - } else if (d.type === 'midpoint') { - event.clickMidpoint(d); - } else { event.click(context.map().mouseCoordinates()); } diff --git a/js/id/behavior/draw_way.js b/js/id/behavior/draw_way.js index fa2c24c87..6b648db0e 100644 --- a/js/id/behavior/draw_way.js +++ b/js/id/behavior/draw_way.js @@ -46,7 +46,6 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { .on('click', drawWay.add) .on('clickWay', drawWay.addWay) .on('clickNode', drawWay.addNode) - .on('clickMidpoint', drawWay.addMidpoint) .on('undo', context.undo) .on('cancel', drawWay.cancel) .on('finish', drawWay.finish); @@ -140,19 +139,6 @@ iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) { context.enter(mode); }; - // Add a midpoint, connect the way to it, and continue drawing. - drawWay.addMidpoint = function(midpoint) { - var node = iD.Node(); - - context.perform( - iD.actions.AddMidpoint(midpoint, node), - ReplaceTemporaryNode(node), - annotation); - - finished = true; - context.enter(mode); - }; - // Finish the draw operation, removing the temporary node. If the way has enough // nodes to be valid, it's selected. Otherwise, return to browse mode. drawWay.finish = function() { diff --git a/js/id/modes/add_area.js b/js/id/modes/add_area.js index 0a9496bb6..ae83423cb 100644 --- a/js/id/modes/add_area.js +++ b/js/id/modes/add_area.js @@ -11,7 +11,6 @@ iD.modes.AddArea = function(context) { .on('start', start) .on('startFromWay', startFromWay) .on('startFromNode', startFromNode) - .on('startFromMidpoint', startFromMidpoint), defaultTags = {area: 'yes'}; function start(loc) { @@ -55,20 +54,6 @@ iD.modes.AddArea = function(context) { context.enter(iD.modes.DrawArea(context, way.id, graph)); } - function startFromMidpoint(midpoint) { - var graph = context.graph(), - node = iD.Node(), - way = iD.Way({tags: defaultTags}); - - context.perform( - iD.actions.AddMidpoint(midpoint, node), - iD.actions.AddEntity(way), - iD.actions.AddVertex(way.id, node.id), - iD.actions.AddVertex(way.id, node.id)); - - context.enter(iD.modes.DrawArea(context, way.id, graph)); - } - mode.enter = function() { context.install(behavior); context.tail(t('modes.add_area.tail')); diff --git a/js/id/modes/add_line.js b/js/id/modes/add_line.js index 7845e6e6f..3d45df2a0 100644 --- a/js/id/modes/add_line.js +++ b/js/id/modes/add_line.js @@ -11,7 +11,6 @@ iD.modes.AddLine = function(context) { .on('start', start) .on('startFromWay', startFromWay) .on('startFromNode', startFromNode) - .on('startFromMidpoint', startFromMidpoint), defaultTags = {highway: 'residential'}; function start(loc) { @@ -63,19 +62,6 @@ iD.modes.AddLine = function(context) { } } - function startFromMidpoint(midpoint) { - var graph = context.graph(), - node = iD.Node(), - way = iD.Way({tags: defaultTags}); - - context.perform( - iD.actions.AddMidpoint(midpoint, node), - iD.actions.AddEntity(way), - iD.actions.AddVertex(way.id, node.id)); - - context.enter(iD.modes.DrawLine(context, way.id, 'forward', graph)); - } - mode.enter = function() { context.install(behavior); context.tail(t('modes.add_line.tail')); diff --git a/js/id/modes/add_point.js b/js/id/modes/add_point.js index 5a24dad25..457ed87a4 100644 --- a/js/id/modes/add_point.js +++ b/js/id/modes/add_point.js @@ -10,7 +10,6 @@ iD.modes.AddPoint = function(context) { .on('click', add) .on('clickWay', addWay) .on('clickNode', addNode) - .on('clickMidpoint', addNode) .on('cancel', cancel) .on('finish', cancel); From ab7c1fa80aa41cee16ef29daed005c6b8171ff0f Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Feb 2013 18:32:16 -0500 Subject: [PATCH 24/25] Fix midpoint hiding. really --- js/id/svg/midpoints.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/id/svg/midpoints.js b/js/id/svg/midpoints.js index 96048b1ed..1db622612 100644 --- a/js/id/svg/midpoints.js +++ b/js/id/svg/midpoints.js @@ -2,8 +2,8 @@ iD.svg.Midpoints = function(projection) { return function drawMidpoints(surface, graph, entities, filter) { var midpoints = {}; - if (!surface.select('.layer-hit.g.vertex').node()) { - return surface.select('.layer-hit.g.midpoint').remove(); + if (!surface.select('.layer-hit g.vertex').node()) { + return surface.selectAll('.layer-hit g.midpoint').remove(); } for (var i = 0; i < entities.length; i++) { From d3c7c4be4b1e04eb594d174ed0a1182707a06ee8 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 4 Feb 2013 18:48:49 -0500 Subject: [PATCH 25/25] Add imagery convert script, source, and output --- data/imagery.json | 490 ++++++++++++++++++++++++++++++++++++++++ data/imagery.xml | 231 +++++++++++++++++++ data/imagery_convert.js | 45 ++++ 3 files changed, 766 insertions(+) create mode 100644 data/imagery.json create mode 100644 data/imagery.xml create mode 100644 data/imagery_convert.js diff --git a/data/imagery.json b/data/imagery.json new file mode 100644 index 000000000..2055c1cf5 --- /dev/null +++ b/data/imagery.json @@ -0,0 +1,490 @@ +[ + { + "name": "Bing aerial imagery", + "url": "http://ecn.t0.tiles.virtualearth.net/tiles/a{q}uadkey.jpeg?g=587&mkt=en-gb&n=z", + "sourcetag": "Bing", + "logo": "bing_maps.png", + "logo_url": "http://www.bing.com/maps", + "terms_url": "http://opengeodata.org/microsoft-imagery-details" + }, + { + "name": "MapBox Satellite", + "url": "http://{t}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c" + ] + }, + { + "name": "MapQuest Open Aerial", + "url": "http://oatile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg" + }, + { + "name": "OSM - Mapnik", + "url": "http://{t}.tile.openstreetmap.org/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c" + ] + }, + { + "name": "OSM - OpenCycleMap", + "url": "http://tile.opencyclemap.org/cycle/{z}/{x}/{y}.png" + }, + { + "name": "OSM - MapQuest", + "url": "http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg" + }, + { + "name": "OSM - Tiger Edited Map", + "url": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", + "extent": [ + 24.055, + -124.81, + 49.386, + -66.865 + ] + }, + { + "name": "OSM - Tiger Edited Map", + "url": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", + "extent": [ + 50.858, + -179.754, + 71.463, + -129.899 + ] + }, + { + "name": "OSM - Tiger Edited Map", + "url": "http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/{z}/{x}/{y}.png", + "extent": [ + 18.702, + -174.46, + 26.501, + -154.516 + ] + }, + { + "name": "OSM US TIGER 2012 Roads Overlay", + "url": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c" + ], + "extent": [ + 24.055, + -124.81, + 49.386, + -66.865 + ] + }, + { + "name": "OSM US TIGER 2012 Roads Overlay", + "url": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c" + ], + "extent": [ + 50.858, + -179.754, + 71.463, + -129.899 + ] + }, + { + "name": "OSM US TIGER 2012 Roads Overlay", + "url": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c" + ], + "extent": [ + 18.702, + -174.46, + 26.501, + -154.516 + ] + }, + { + "name": "OSM US USGS Topographic Maps", + "url": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c" + ], + "extent": [ + 24.005, + -125.991, + 50.009, + -65.988 + ] + }, + { + "name": "OSM US USGS Topographic Maps", + "url": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c" + ], + "extent": [ + 18.902, + -160.579, + 22.508, + -154.793 + ] + }, + { + "name": "OSM US USGS Topographic Maps", + "url": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c" + ], + "extent": [ + 51.255, + -178.001, + 71.999, + -130.004 + ] + }, + { + "name": "OSM US USGS Large Scale Aerial Imagery", + "url": "http://{t}.tile.openstreetmap.us/usgs_large_scale/{z}/{x}/{y}.jpg", + "subdomains": [ + "a", + "b", + "c" + ], + "extent": [ + 24.496, + -124.819, + 49.443, + -66.931 + ] + }, + { + "name": "British Columbia bc_mosaic", + "url": "http://{t}.imagery.paulnorman.ca/tiles/bc_mosaic/{z}/{x}/{y}.png", + "subdomains": [ + "a", + "b", + "c", + "d" + ], + "extent": [ + 48.995, + -123.441, + 50.426, + -121.346 + ], + "sourcetag": "bc_mosaic", + "terms_url": "http://imagery.paulnorman.ca/tiles/about.html" + }, + { + "name": "OS OpenData Streetview", + "url": "http://os.openstreetmap.org/sv/{z}/{x}/{y}.png", + "extent": [ + 49.86, + -8.72, + 60.92, + 1.84 + ], + "sourcetag": "OS_OpenData_StreetView" + }, + { + "name": "OS OpenData Locator", + "url": "http://tiles.itoworld.com/os_locator/{z}/{x}/{y}.png", + "extent": [ + 49.8, + -9, + 61.1, + 1.9 + ], + "sourcetag": "OS_OpenData_Locator" + }, + { + "name": "OS 1:25k historic (OSM)", + "url": "http://ooc.openstreetmap.org/os1/{z}/{x}/{y}.jpg", + "extent": [ + 49.8, + -9, + 61.1, + 1.9 + ], + "sourcetag": "OS 1:25k" + }, + { + "name": "OS 1:25k historic (NLS)", + "url": "http://geo.nls.uk/mapdata2/os/25000/{z}/{x}/{y}.png", + "extent": [ + 49.8, + -9, + 61.1, + 1.9 + ], + "sourcetag": "OS 1:25k", + "logo": "icons/logo_nls70-nq8.png", + "logo_url": "http://geo.nls.uk/maps/" + }, + { + "name": "OS 7th Series historic (OSM)", + "url": "http://ooc.openstreetmap.org/os7/{z}/{x}/{y}.jpg", + "extent": [ + 49.8, + -9, + 61.1, + 1.9 + ], + "sourcetag": "OS7" + }, + { + "name": "OS 7th Series historic (NLS)", + "url": "http://geo.nls.uk/mapdata2/os/seventh/{z}/{x}/{y}.png", + "extent": [ + 49.8, + -9, + 61.1, + 1.9 + ], + "sourcetag": "OS7", + "logo": "icons/logo_nls70-nq8.png", + "logo_url": "http://geo.nls.uk/maps/" + }, + { + "name": "OS New Popular Edition historic", + "url": "http://ooc.openstreetmap.org/npe/{z}/{x}/{y}.png", + "extent": [ + 49.8, + -5.8, + 55.8, + 1.9 + ], + "sourcetag": "NPE" + }, + { + "name": "OS Scottish Popular historic", + "url": "http://ooc.openstreetmap.org/npescotland/tiles/{z}/{x}/{y}.jpg", + "extent": [ + 54.5, + -7.8, + 61.1, + -1.1 + ], + "sourcetag": "NPE" + }, + { + "name": "Surrey aerial", + "url": "http://gravitystorm.dev.openstreetmap.org/surrey/{z}/{x}/{y}.png", + "extent": [ + 51.071, + -0.856, + 51.473, + 0.062 + ], + "sourcetag": "Surrey aerial" + }, + { + "name": "Haiti - GeoEye Jan 13", + "url": "http://gravitystorm.dev.openstreetmap.org/imagery/haiti/{z}/{x}/{y}.jpg", + "extent": [ + 17.95, + -74.5, + 20.12, + -71.58 + ], + "sourcetag": "Haiti GeoEye" + }, + { + "name": "Haiti - GeoEye Jan 13+", + "url": "http://maps.nypl.org/tilecache/1/geoeye/{z}/{x}/{y}.jpg", + "extent": [ + 17.95, + -74.5, + 20.12, + -71.58 + ], + "sourcetag": "Haiti GeoEye" + }, + { + "name": "Haiti - DigitalGlobe", + "url": "http://maps.nypl.org/tilecache/1/dg_crisis/{z}/{x}/{y}.jpg", + "extent": [ + 17.95, + -74.5, + 20.12, + -71.58 + ], + "sourcetag": "Haiti DigitalGlobe" + }, + { + "name": "Haiti - Street names", + "url": "http://hypercube.telascience.org/tiles/1.0.0/haiti-city/{z}/{x}/{y}.jpg", + "extent": [ + 17.95, + -74.5, + 20.12, + -71.58 + ], + "sourcetag": "Haiti streetnames" + }, + { + "name": "National Agriculture Imagery Program", + "url": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png", + "extent": [ + 24.2, + -125.8, + 49.5, + -62.3 + ], + "sourcetag": "NAIP" + }, + { + "name": "National Agriculture Imagery Program", + "url": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png", + "extent": [ + 55.3, + -168.5, + 71.5, + -140 + ], + "sourcetag": "NAIP" + }, + { + "name": "Ireland - NLS Historic Maps", + "url": "http://geo.nls.uk/maps/ireland/gsgs4136/{z}/{x}/{y}.png", + "extent": [ + 51.32, + -10.71, + 55.46, + -5.37 + ], + "sourcetag": "NLS Historic Maps", + "logo": "icons/logo_nls70-nq8.png", + "logo_url": "http://geo.nls.uk/maps/" + }, + { + "name": "Denmark - Fugro Aerial Imagery", + "url": "http://tile.openstreetmap.dk/fugro2005/{z}/{x}/{y}.jpg", + "extent": [ + 54.44, + 7.81, + 57.86, + 15.49 + ], + "sourcetag": "Fugro (2005)" + }, + { + "name": "Denmark - Stevns Kommune", + "url": "http://tile.openstreetmap.dk/stevns/2009/{z}/{x}/{y}.jpg", + "extent": [ + 55.23403, + 12.09144, + 55.43647, + 12.47712 + ], + "sourcetag": "Stevns Kommune (2009)" + }, + { + "name": "Austria - geoimage.at", + "url": "http://geoimage.openstreetmap.at/4d80de696cd562a63ce463a58a61488d/{z}/{x}/{y}.jpg", + "extent": [ + 46.33, + 9.36, + 49.09, + 17.28 + ], + "sourcetag": "geoimage.at" + }, + { + "name": "Russia - Kosmosnimki.ru IRS Satellite", + "url": "http://irs.gis-lab.info/?layers=irs&request=GetTile&z={z}&x={x}&y={y}", + "extent": [ + 40.96, + 19.02, + 70.48, + 77.34 + ], + "sourcetag": "Kosmosnimki.ru IRS" + }, + { + "name": "Belarus - Kosmosnimki.ru SPOT4 Satellite", + "url": "http://irs.gis-lab.info/?layers=spot&request=GetTile&z={z}&x={x}&y={y}", + "extent": [ + 51.25, + 23.16, + 56.19, + 32.83 + ], + "sourcetag": "Kosmosnimki.ru SPOT4" + }, + { + "name": "Australia - Geographic Reference Image", + "url": "http://agri.openstreetmap.org/{z}/{x}/{y}.png", + "extent": [ + -44, + 96, + -9, + 168 + ], + "sourcetag": "AGRI" + }, + { + "name": "Switzerland - Canton Aargau - AGIS 25cm 2011", + "url": "http://tiles.poole.ch/AGIS/OF2011/{z}/{x}/{y}.png", + "extent": [ + 47.13, + 7.69, + 47.63, + 8.48 + ], + "sourcetag": "AGIS OF2011" + }, + { + "name": "Switzerland - Canton Solothurn - SOGIS 2007", + "url": "http://mapproxy.sosm.ch:8080/tiles/sogis2007/EPSG900913/{z}/{x}/{y}.png?origin=nw", + "extent": [ + 47.06, + 7.33, + 47.5, + 8.04 + ], + "sourcetag": "Orthofoto 2007 WMS Solothurn" + }, + { + "name": "Poland - Media-Lab fleet GPS masstracks", + "url": "http://masstracks.media-lab.com.pl/{z}/{x}/{y}.png", + "extent": [ + 48.9, + 14, + 55, + 24.2 + ], + "sourcetag": "masstracks" + }, + { + "name": "South Africa - CD:NGI Aerial", + "url": "http://{t}.aerial.openstreetmap.org.za/ngi-aerial/{z}/{x}/{y}.jpg", + "subdomains": [ + "a", + "b", + "c" + ], + "extent": [ + -34.95, + 17.64, + -22.05, + 32.87 + ], + "sourcetag": "ngi-aerial" + } +] \ No newline at end of file diff --git a/data/imagery.xml b/data/imagery.xml new file mode 100644 index 000000000..c829ab141 --- /dev/null +++ b/data/imagery.xml @@ -0,0 +1,231 @@ + + + + Bing aerial imagery + http://ecn.t0.tiles.virtualearth.net/tiles/a$quadkey.jpeg?g=587&mkt=en-gb&n=z + microsoft + Bing + http://dev.virtualearth.net/REST/v1/Imagery/Metadata/Aerial/0,0?zl=1&mapVersion=v1&key=Arzdiw4nlOJzRwOz__qailc8NiR31Tt51dN2D7cm57NrnceZnCpgOkmJhNpGoppU&include=ImageryProviders&output=xml + bing_maps.png + http://www.bing.com/maps + http://opengeodata.org/microsoft-imagery-details + yes + + + MapBox Satellite + http://${a|b|c}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/$z/$x/$y.png + + + MapQuest Open Aerial + http://oatile1.mqcdn.com/tiles/1.0.0/sat/$z/$x/$y.jpg + + + OSM - Mapnik + http://${a|b|c}.tile.openstreetmap.org/$z/$x/$y.png + + + OSM - OpenCycleMap + http://tile.opencyclemap.org/cycle/$z/$x/$y.png + + + OSM - MapQuest + http://otile1.mqcdn.com/tiles/1.0.0/osm/$z/$x/$y.jpg + + + OSM - Tiger Edited Map + 900913 + http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/$z/$x/$y.png + + + OSM - Tiger Edited Map + 900913 + http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/$z/$x/$y.png + + + OSM - Tiger Edited Map + 900913 + http://tiger-osm.mapquest.com/tiles/1.0.0/tiger/$z/$x/$y.png + + + OSM US TIGER 2012 Roads Overlay + 900913 + http://${a|b|c}.tile.openstreetmap.us/tiger2012_roads_expanded/$z/$x/$y.png + + + OSM US TIGER 2012 Roads Overlay + 900913 + http://${a|b|c}.tile.openstreetmap.us/tiger2012_roads_expanded/$z/$x/$y.png + + + OSM US TIGER 2012 Roads Overlay + 900913 + http://${a|b|c}.tile.openstreetmap.us/tiger2012_roads_expanded/$z/$x/$y.png + + + OSM US USGS Topographic Maps + 900913 + http://${a|b|c}.tile.openstreetmap.us/usgs_scanned_topos/$z/$x/$y.png + + + OSM US USGS Topographic Maps + 900913 + http://${a|b|c}.tile.openstreetmap.us/usgs_scanned_topos/$z/$x/$y.png + + + OSM US USGS Topographic Maps + 900913 + http://${a|b|c}.tile.openstreetmap.us/usgs_scanned_topos/$z/$x/$y.png + + + OSM US USGS Large Scale Aerial Imagery + 900913 + http://${a|b|c}.tile.openstreetmap.us/usgs_large_scale/$z/$x/$y.jpg + + + British Columbia bc_mosaic + 900913 + http://${a|b|c|d}.imagery.paulnorman.ca/tiles/bc_mosaic/$z/$x/$y.png + http://imagery.paulnorman.ca/tiles/about.html + bc_mosaic + + + OS OpenData Streetview + http://os.openstreetmap.org/sv/$z/$x/$y.png + OS_OpenData_StreetView + + + OS OpenData Locator + http://tiles.itoworld.com/os_locator/$z/$x/$y.png + OS_OpenData_Locator + source:name + + + OS 1:25k historic (OSM) + http://ooc.openstreetmap.org/os1/$z/$x/$y.jpg + OS 1:25k + + + OS 1:25k historic (NLS) + tms + http://geo.nls.uk/mapdata2/os/25000/$z/$x/$y.png + icons/logo_nls70-nq8.png + http://geo.nls.uk/maps/ + OS 1:25k + + + OS 7th Series historic (OSM) + http://ooc.openstreetmap.org/os7/$z/$x/$y.jpg + OS7 + + + OS 7th Series historic (NLS) + tms + http://geo.nls.uk/mapdata2/os/seventh/$z/$x/$y.png + icons/logo_nls70-nq8.png + http://geo.nls.uk/maps/ + OS7 + + + OS New Popular Edition historic + http://ooc.openstreetmap.org/npe/$z/$x/$y.png + NPE + + + OS Scottish Popular historic + http://ooc.openstreetmap.org/npescotland/tiles/$z/$x/$y.jpg + NPE + + + Surrey aerial + http://gravitystorm.dev.openstreetmap.org/surrey/$z/$x/$y.png + Surrey aerial + + + Haiti - GeoEye Jan 13 + http://gravitystorm.dev.openstreetmap.org/imagery/haiti/$z/$x/$y.jpg + Haiti GeoEye + + + Haiti - GeoEye Jan 13+ + http://maps.nypl.org/tilecache/1/geoeye/$z/$x/$y.jpg + Haiti GeoEye + + + Haiti - DigitalGlobe + http://maps.nypl.org/tilecache/1/dg_crisis/$z/$x/$y.jpg + Haiti DigitalGlobe + + + Haiti - Street names + http://hypercube.telascience.org/tiles/1.0.0/haiti-city/$z/$x/$y.jpg + Haiti streetnames + + + National Agriculture Imagery Program + http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/$z/$x/$y.png + NAIP + + + National Agriculture Imagery Program + http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/$z/$x/$y.png + NAIP + + + Ireland - NLS Historic Maps + tms + NLS Historic Maps + http://geo.nls.uk/maps/ireland/gsgs4136/$z/$x/$y.png + icons/logo_nls70-nq8.png + http://geo.nls.uk/maps/ + + + Denmark - Fugro Aerial Imagery + http://tile.openstreetmap.dk/fugro2005/$z/$x/$y.jpg + Fugro (2005) + + + Denmark - Stevns Kommune + http://tile.openstreetmap.dk/stevns/2009/$z/$x/$y.jpg + Stevns Kommune (2009) + + + Austria - geoimage.at + http://geoimage.openstreetmap.at/4d80de696cd562a63ce463a58a61488d/$z/$x/$y.jpg + geoimage.at + + + Russia - Kosmosnimki.ru IRS Satellite + http://irs.gis-lab.info/?layers=irs&request=GetTile&z=$z&x=$x&y=$y + Kosmosnimki.ru IRS + + + Belarus - Kosmosnimki.ru SPOT4 Satellite + http://irs.gis-lab.info/?layers=spot&request=GetTile&z=$z&x=$x&y=$y + Kosmosnimki.ru SPOT4 + + + Australia - Geographic Reference Image + http://agri.openstreetmap.org/$z/$x/$y.png + AGRI + + + Switzerland - Canton Aargau - AGIS 25cm 2011 + http://tiles.poole.ch/AGIS/OF2011/$z/$x/$y.png + AGIS OF2011 + + + Switzerland - Canton Solothurn - SOGIS 2007 + http://mapproxy.sosm.ch:8080/tiles/sogis2007/EPSG900913/$z/$x/$y.png?origin=nw + Orthofoto 2007 WMS Solothurn + + + Poland - Media-Lab fleet GPS masstracks + http://masstracks.media-lab.com.pl/$z/$x/$y.png + masstracks + + + South Africa - CD:NGI Aerial + http://${a|b|c}.aerial.openstreetmap.org.za/ngi-aerial/$z/$x/$y.jpg + ngi-aerial + + diff --git a/data/imagery_convert.js b/data/imagery_convert.js new file mode 100644 index 000000000..16cc23317 --- /dev/null +++ b/data/imagery_convert.js @@ -0,0 +1,45 @@ +var fs = require('fs'), + cheerio = require('cheerio'); + +$ = cheerio.load(fs.readFileSync('imagery.xml')); + +var imagery = []; + +$('set').each(function(i) { + var elem = $(this); + + var im = { + name: $(this).find('name').first().text(), + url: $(this).find('url').first().text() + }; + + var subdomains = []; + + im.url = im.url + .replace(/\$(\w)/g, function(m) { + return '{' + m[1] + '}'; + }) + .replace(/\$\{([^}.]+)\}/g, function(m) { + subdomains = m.slice(2, m.length - 1).split('|'); + return '{t}'; + }); + + if (subdomains.length) im.subdomains = subdomains; + + if (elem.attr('minlat')) { + im.extent = [ + +elem.attr('minlat'), + +elem.attr('minlon'), + +elem.attr('maxlat'), + +elem.attr('maxlon')]; + } + + ['sourcetag', 'logo', 'logo_url', 'terms_url'].forEach(function(a) { + if (elem.find(a).length) { + im[a] = elem.find(a).first().text(); + } + }); + imagery.push(im); +}); + +fs.writeFileSync('imagery.json', JSON.stringify(imagery, null, 4));