diff --git a/Makefile b/Makefile index 8d93c46a6..f286a939b 100644 --- a/Makefile +++ b/Makefile @@ -10,14 +10,43 @@ all: \ iD.js \ iD.min.js +# TODO: write a nice node script for this +data/data.js: \ + data/deprecated.json \ + data/discarded.json \ + data/imagery.json \ + data/keys.json + echo 'iD.data = {' > $@ + echo 'deprecated: ' >> $@ + cat data/deprecated.json >> $@ + echo ', discarded: ' >> $@ + cat data/discarded.json >> $@ + echo ', imagery: ' >> $@ + cat data/imagery.json >> $@ + echo ', keys: ' >> $@ + cat data/keys.json >> $@ + echo ', presets: {' >> $@ + echo 'presets: ' >> $@ + cat data/presets/presets.json >> $@ + echo ', defaults: ' >> $@ + cat data/presets/defaults.json >> $@ + echo ', categories: ' >> $@ + cat data/presets/categories.json >> $@ + echo ', forms: ' >> $@ + cat data/presets/forms.json >> $@ + echo '}' >> $@ + echo '};' >> $@ + .INTERMEDIATE iD.js: \ js/lib/bootstrap-tooltip.js \ js/lib/d3.v3.js \ + js/lib/d3.checkselect.js \ js/lib/d3.clip.js \ js/lib/d3.combobox.js \ js/lib/d3.geo.tile.js \ js/lib/d3.keybinding.js \ js/lib/d3.one.js \ + js/lib/d3.rowselect.js \ js/lib/d3.size.js \ js/lib/d3.trigger.js \ js/lib/d3.typeahead.js \ @@ -32,8 +61,6 @@ all: \ js/id/oauth.js \ js/id/services/*.js \ data/data.js \ - data/imagery.js \ - data/deprecated.js \ js/id/util.js \ js/id/geo.js \ js/id/geo/*.js \ diff --git a/NOTES.md b/NOTES.md index abd5738c2..cd52520eb 100644 --- a/NOTES.md +++ b/NOTES.md @@ -306,3 +306,15 @@ The graph supports `transient`, which is storage for non-versioned mutable properties _about_ entities that are stored outside of entities. For instance, `extent` is about an entity, but can be invalidated and stored without getting a new graph. + +## Data sources + +*deprecated.json* +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 + +*discarded.json* +entirely discarded tags +https://github.com/systemed/potlatch2/blob/master/net/systemeD/halcyon/connection/XMLConnection.as#L24 diff --git a/css/map.css b/css/map.css index 203719af8..36cbc1b37 100644 --- a/css/map.css +++ b/css/map.css @@ -459,16 +459,23 @@ path.casing.tag-highway-living_street { stroke-width:6; } -path.stroke.tag-highway-pedestrian { +path.stroke.line.tag-highway-pedestrian { stroke:#fff; stroke-dasharray: 2, 8; stroke-width:4 !important; shapeRendering: auto; } -path.casing.tag-highway-pedestrian { +path.casing.line.tag-highway-pedestrian { stroke:#8cd05f; stroke-width:6 !important; } +path.stroke.area.tag-highway-pedestrian { + stroke:#fff; + stroke-width: 2; +} +path.fill.area.tag-highway-pedestrian { + fill:#ccc; +} path.stroke.tag-highway-service { stroke:#fff; @@ -684,6 +691,10 @@ text { opacity: .7; } +.oneway .textpath.tag-waterway { + fill: #002F35; +} + text.tag-oneway { fill:#91CFFF; stroke:#2C6B9B; diff --git a/data/data.js b/data/data.js deleted file mode 100644 index 279b1ea86..000000000 --- a/data/data.js +++ /dev/null @@ -1 +0,0 @@ -iD.data = {}; diff --git a/data/data_dev.js b/data/data_dev.js new file mode 100644 index 000000000..e5f1fb069 --- /dev/null +++ b/data/data_dev.js @@ -0,0 +1,33 @@ +iD.data = { + load: function(path, callback) { + if (!callback) { + callback = path; + path = ''; + } + iD.util.asyncMap([ + path + 'data/deprecated.json', + path + 'data/discarded.json', + path + 'data/imagery.json', + path + 'data/keys.json', + path + 'data/presets/presets.json', + path + 'data/presets/defaults.json', + path + 'data/presets/categories.json', + path + 'data/presets/forms.json'], d3.json, function (err, data) { + + iD.data = { + deprecated: data[0], + discarded: data[1], + imagery: data[2], + keys: data[3], + presets: { + presets: data[4], + defaults: data[5], + categories: data[6], + forms: data[7] + } + }; + + callback(); + }); + } +}; diff --git a/data/deprecated.js b/data/deprecated.js deleted file mode 100644 index 53457c9f3..000000000 --- a/data/deprecated.js +++ /dev/null @@ -1,112 +0,0 @@ -// 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/data/deprecated.json b/data/deprecated.json new file mode 100644 index 000000000..fcead3030 --- /dev/null +++ b/data/deprecated.json @@ -0,0 +1,108 @@ +[ + { + "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/data/discarded.js b/data/discarded.js deleted file mode 100644 index 3a38a1534..000000000 --- a/data/discarded.js +++ /dev/null @@ -1,20 +0,0 @@ -// entirely discarded tags -// https://github.com/systemed/potlatch2/blob/master/net/systemeD/halcyon/connection/XMLConnection.as#L24 -iD.data.discarded = [ - "created_by", - 'tiger:upload_uuid', - 'tiger:tlid', - 'tiger:source', - 'tiger:separated', - 'geobase:datasetName', - 'geobase:uuid', - 'sub_sea:type', - "odbl", - "odbl:note", - "yh:LINE_NAME", - "yh:LINE_NUM", - "yh:STRUCTURE", - "yh:TOTYUMONO", - "yh:TYPE", - "yh:WIDTH_RANK" -]; diff --git a/data/discarded.json b/data/discarded.json new file mode 100644 index 000000000..5bf8c817d --- /dev/null +++ b/data/discarded.json @@ -0,0 +1,18 @@ +[ + "created_by", + "tiger:upload_uuid", + "tiger:tlid", + "tiger:source", + "tiger:separated", + "geobase:datasetName", + "geobase:uuid", + "sub_sea:type", + "odbl", + "odbl:note", + "yh:LINE_NAME", + "yh:LINE_NUM", + "yh:STRUCTURE", + "yh:TOTYUMONO", + "yh:TYPE", + "yh:WIDTH_RANK" +] diff --git a/data/imagery.js b/data/imagery.js deleted file mode 100644 index 5cda27b95..000000000 --- a/data/imagery.js +++ /dev/null @@ -1,609 +0,0 @@ -iD.data.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": "yes", - "sourcetag": "Bing", - "logo": "bing_maps.png", - "logo_url": "http://www.bing.com/maps", - "terms_url": "http://opengeodata.org/microsoft-imagery-details" - }, - { - "name": "MapBox Satellite", - "template": "http://{t}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/{z}/{x}/{y}.png", - "description": "Satellite and aerial imagery", - "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 - ], - "subdomains": [ - "a", - "b", - "c" - ] - }, - { - "name": " TIGER 2012 Roads Overlay", - "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "subdomains": [ - "a", - "b", - "c" - ], - "extent": [ - [ - -124.81, - 24.055 - ], - [ - -66.865, - 49.386 - ] - ] - }, - { - "name": " TIGER 2012 Roads Overlay", - "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "subdomains": [ - "a", - "b", - "c" - ], - "extent": [ - [ - -179.754, - 50.858 - ], - [ - -129.899, - 71.463 - ] - ] - }, - { - "name": " TIGER 2012 Roads Overlay", - "template": "http://{t}.tile.openstreetmap.us/tiger2012_roads_expanded/{z}/{x}/{y}.png", - "subdomains": [ - "a", - "b", - "c" - ], - "extent": [ - [ - -174.46, - 18.702 - ], - [ - -154.516, - 26.501 - ] - ] - }, - { - "name": " USGS Topographic Maps", - "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", - "subdomains": [ - "a", - "b", - "c" - ], - "extent": [ - [ - -125.991, - 24.005 - ], - [ - -65.988, - 50.009 - ] - ] - }, - { - "name": " USGS Topographic Maps", - "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", - "subdomains": [ - "a", - "b", - "c" - ], - "extent": [ - [ - -160.579, - 18.902 - ], - [ - -154.793, - 22.508 - ] - ] - }, - { - "name": " USGS Topographic Maps", - "template": "http://{t}.tile.openstreetmap.us/usgs_scanned_topos/{z}/{x}/{y}.png", - "subdomains": [ - "a", - "b", - "c" - ], - "extent": [ - [ - -178.001, - 51.255 - ], - [ - -130.004, - 71.999 - ] - ] - }, - { - "name": " USGS Large Scale Aerial Imagery", - "template": "http://{t}.tile.openstreetmap.us/usgs_large_scale/{z}/{x}/{y}.jpg", - "subdomains": [ - "a", - "b", - "c" - ], - "extent": [ - [ - -124.819, - 24.496 - ], - [ - -66.931, - 49.443 - ] - ] - }, - { - "name": "British Columbia bc_mosaic", - "template": "http://{t}.imagery.paulnorman.ca/tiles/bc_mosaic/{z}/{x}/{y}.png", - "subdomains": [ - "a", - "b", - "c", - "d" - ], - "extent": [ - [ - -123.441, - 48.995 - ], - [ - -121.346, - 50.426 - ] - ], - "sourcetag": "bc_mosaic", - "terms_url": "http://imagery.paulnorman.ca/tiles/about.html" - }, - { - "name": "OS OpenData Streetview", - "template": "http://os.openstreetmap.org/sv/{z}/{x}/{y}.png", - "extent": [ - [ - -8.72, - 49.86 - ], - [ - 1.84, - 60.92 - ] - ], - "sourcetag": "OS_OpenData_StreetView" - }, - { - "name": "OS OpenData Locator", - "template": "http://tiles.itoworld.com/os_locator/{z}/{x}/{y}.png", - "extent": [ - [ - -9, - 49.8 - ], - [ - 1.9, - 61.1 - ] - ], - "sourcetag": "OS_OpenData_Locator" - }, - { - "name": "OS 1:25k historic (OSM)", - "template": "http://ooc.openstreetmap.org/os1/{z}/{x}/{y}.jpg", - "extent": [ - [ - -9, - 49.8 - ], - [ - 1.9, - 61.1 - ] - ], - "sourcetag": "OS 1:25k" - }, - { - "name": "OS 1:25k historic (NLS)", - "template": "http://geo.nls.uk/mapdata2/os/25000/{z}/{x}/{y}.png", - "extent": [ - [ - -9, - 49.8 - ], - [ - 1.9, - 61.1 - ] - ], - "sourcetag": "OS 1:25k", - "logo": "icons/logo_nls70-nq8.png", - "logo_url": "http://geo.nls.uk/maps/" - }, - { - "name": "OS 7th Series historic (OSM)", - "template": "http://ooc.openstreetmap.org/os7/{z}/{x}/{y}.jpg", - "extent": [ - [ - -9, - 49.8 - ], - [ - 1.9, - 61.1 - ] - ], - "sourcetag": "OS7" - }, - { - "name": "OS 7th Series historic (NLS)", - "template": "http://geo.nls.uk/mapdata2/os/seventh/{z}/{x}/{y}.png", - "extent": [ - [ - -9, - 49.8 - ], - [ - 1.9, - 61.1 - ] - ], - "sourcetag": "OS7", - "logo": "icons/logo_nls70-nq8.png", - "logo_url": "http://geo.nls.uk/maps/" - }, - { - "name": "OS New Popular Edition historic", - "template": "http://ooc.openstreetmap.org/npe/{z}/{x}/{y}.png", - "extent": [ - [ - -5.8, - 49.8 - ], - [ - 1.9, - 55.8 - ] - ], - "sourcetag": "NPE" - }, - { - "name": "OS Scottish Popular historic", - "template": "http://ooc.openstreetmap.org/npescotland/tiles/{z}/{x}/{y}.jpg", - "extent": [ - [ - -7.8, - 54.5 - ], - [ - -1.1, - 61.1 - ] - ], - "sourcetag": "NPE" - }, - { - "name": "Surrey aerial", - "template": "http://gravitystorm.dev.openstreetmap.org/surrey/{z}/{x}/{y}.png", - "extent": [ - [ - -0.856, - 51.071 - ], - [ - 0.062, - 51.473 - ] - ], - "sourcetag": "Surrey aerial" - }, - { - "name": "Haiti - GeoEye Jan 13", - "template": "http://gravitystorm.dev.openstreetmap.org/imagery/haiti/{z}/{x}/{y}.jpg", - "extent": [ - [ - -74.5, - 17.95 - ], - [ - -71.58, - 20.12 - ] - ], - "sourcetag": "Haiti GeoEye" - }, - { - "name": "Haiti - GeoEye Jan 13+", - "template": "http://maps.nypl.org/tilecache/1/geoeye/{z}/{x}/{y}.jpg", - "extent": [ - [ - -74.5, - 17.95 - ], - [ - -71.58, - 20.12 - ] - ], - "sourcetag": "Haiti GeoEye" - }, - { - "name": "Haiti - DigitalGlobe", - "template": "http://maps.nypl.org/tilecache/1/dg_crisis/{z}/{x}/{y}.jpg", - "extent": [ - [ - -74.5, - 17.95 - ], - [ - -71.58, - 20.12 - ] - ], - "sourcetag": "Haiti DigitalGlobe" - }, - { - "name": "Haiti - Street names", - "template": "http://hypercube.telascience.org/tiles/1.0.0/haiti-city/{z}/{x}/{y}.jpg", - "extent": [ - [ - -74.5, - 17.95 - ], - [ - -71.58, - 20.12 - ] - ], - "sourcetag": "Haiti streetnames" - }, - { - "name": "NAIP", - "template": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png", - "description": "National Agriculture Imagery Program", - "extent": [ - [ - -125.8, - 24.2 - ], - [ - -62.3, - 49.5 - ] - ], - "sourcetag": "NAIP" - }, - { - "name": "NAIP", - "template": "http://cube.telascience.org/tilecache/tilecache.py/NAIP_ALL/{z}/{x}/{y}.png", - "description": "National Agriculture Imagery Program", - "extent": [ - [ - -168.5, - 55.3 - ], - [ - -140, - 71.5 - ] - ], - "sourcetag": "NAIP" - }, - { - "name": "Ireland - NLS Historic Maps", - "template": "http://geo.nls.uk/maps/ireland/gsgs4136/{z}/{x}/{y}.png", - "extent": [ - [ - -10.71, - 51.32 - ], - [ - -5.37, - 55.46 - ] - ], - "sourcetag": "NLS Historic Maps", - "logo": "icons/logo_nls70-nq8.png", - "logo_url": "http://geo.nls.uk/maps/" - }, - { - "name": "Denmark - Fugro Aerial Imagery", - "template": "http://tile.openstreetmap.dk/fugro2005/{z}/{x}/{y}.jpg", - "extent": [ - [ - 7.81, - 54.44 - ], - [ - 15.49, - 57.86 - ] - ], - "sourcetag": "Fugro (2005)" - }, - { - "name": "Denmark - Stevns Kommune", - "template": "http://tile.openstreetmap.dk/stevns/2009/{z}/{x}/{y}.jpg", - "extent": [ - [ - 12.09144, - 55.23403 - ], - [ - 12.47712, - 55.43647 - ] - ], - "sourcetag": "Stevns Kommune (2009)" - }, - { - "name": "Austria - geoimage.at", - "template": "http://geoimage.openstreetmap.at/4d80de696cd562a63ce463a58a61488d/{z}/{x}/{y}.jpg", - "extent": [ - [ - 9.36, - 46.33 - ], - [ - 17.28, - 49.09 - ] - ], - "sourcetag": "geoimage.at" - }, - { - "name": "Russia - Kosmosnimki.ru IRS Satellite", - "template": "http://irs.gis-lab.info/?layers=irs&request=GetTile&z={z}&x={x}&y={y}", - "extent": [ - [ - 19.02, - 40.96 - ], - [ - 77.34, - 70.48 - ] - ], - "sourcetag": "Kosmosnimki.ru IRS" - }, - { - "name": "Belarus - Kosmosnimki.ru SPOT4 Satellite", - "template": "http://irs.gis-lab.info/?layers=spot&request=GetTile&z={z}&x={x}&y={y}", - "extent": [ - [ - 23.16, - 51.25 - ], - [ - 32.83, - 56.19 - ] - ], - "sourcetag": "Kosmosnimki.ru SPOT4" - }, - { - "name": "Australia - Geographic Reference Image", - "template": "http://agri.openstreetmap.org/{z}/{x}/{y}.png", - "extent": [ - [ - 96, - -44 - ], - [ - 168, - -9 - ] - ], - "sourcetag": "AGRI" - }, - { - "name": "Switzerland - Canton Aargau - AGIS 25cm 2011", - "template": "http://tiles.poole.ch/AGIS/OF2011/{z}/{x}/{y}.png", - "extent": [ - [ - 7.69, - 47.13 - ], - [ - 8.48, - 47.63 - ] - ], - "sourcetag": "AGIS OF2011" - }, - { - "name": "Switzerland - Canton Solothurn - SOGIS 2007", - "template": "http://mapproxy.sosm.ch:8080/tiles/sogis2007/EPSG900913/{z}/{x}/{y}.png?origin=nw", - "extent": [ - [ - 7.33, - 47.06 - ], - [ - 8.04, - 47.5 - ] - ], - "sourcetag": "Orthofoto 2007 WMS Solothurn" - }, - { - "name": "Poland - Media-Lab fleet GPS masstracks", - "template": "http://masstracks.media-lab.com.pl/{z}/{x}/{y}.png", - "extent": [ - [ - 14, - 48.9 - ], - [ - 24.2, - 55 - ] - ], - "sourcetag": "masstracks" - }, - { - "name": "South Africa - CD:NGI Aerial", - "template": "http://{t}.aerial.openstreetmap.org.za/ngi-aerial/{z}/{x}/{y}.jpg", - "subdomains": [ - "a", - "b", - "c" - ], - "extent": [ - [ - 17.64, - -34.95 - ], - [ - 32.87, - -22.05 - ] - ], - "sourcetag": "ngi-aerial" - } -]; \ No newline at end of file diff --git a/data/imagery_convert.js b/data/imagery_convert.js index abc5cbef6..6b297322a 100644 --- a/data/imagery_convert.js +++ b/data/imagery_convert.js @@ -84,4 +84,3 @@ $('set').each(function(i) { }); fs.writeFileSync('imagery.json', JSON.stringify(imagery, null, 4)); -fs.writeFileSync('imagery.js', 'iD.data.imagery = ' + JSON.stringify(imagery, null, 4) + ';'); diff --git a/keys.json b/data/keys.json similarity index 100% rename from keys.json rename to data/keys.json diff --git a/presets/categories.json b/data/presets/categories.json similarity index 100% rename from presets/categories.json rename to data/presets/categories.json diff --git a/presets/convert_josm.py b/data/presets/convert_josm.py similarity index 100% rename from presets/convert_josm.py rename to data/presets/convert_josm.py diff --git a/presets/convert_potlatch.py b/data/presets/convert_potlatch.py similarity index 100% rename from presets/convert_potlatch.py rename to data/presets/convert_potlatch.py diff --git a/presets/defaults.json b/data/presets/defaults.json similarity index 100% rename from presets/defaults.json rename to data/presets/defaults.json diff --git a/presets/editors/bus.json b/data/presets/editors/bus.json similarity index 100% rename from presets/editors/bus.json rename to data/presets/editors/bus.json diff --git a/presets/editors/cycle_route.json b/data/presets/editors/cycle_route.json similarity index 100% rename from presets/editors/cycle_route.json rename to data/presets/editors/cycle_route.json diff --git a/presets/editors/cycling.json b/data/presets/editors/cycling.json similarity index 100% rename from presets/editors/cycling.json rename to data/presets/editors/cycling.json diff --git a/presets/editors/rail.json b/data/presets/editors/rail.json similarity index 100% rename from presets/editors/rail.json rename to data/presets/editors/rail.json diff --git a/presets/editors/road.json b/data/presets/editors/road.json similarity index 100% rename from presets/editors/road.json rename to data/presets/editors/road.json diff --git a/presets/forms.json b/data/presets/forms.json similarity index 96% rename from presets/forms.json rename to data/presets/forms.json index 340155844..2f0b77256 100644 --- a/presets/forms.json +++ b/data/presets/forms.json @@ -73,10 +73,6 @@ "key": "tunnel", "type": "check" }, - "access": { - "key": "access", - "type": "combo" - }, "maxspeed": { "key": "maxspeed", "type": "combo" diff --git a/presets/josm.xml b/data/presets/josm.xml similarity index 100% rename from presets/josm.xml rename to data/presets/josm.xml diff --git a/data/presets/lint.js b/data/presets/lint.js new file mode 100644 index 000000000..439db0b1a --- /dev/null +++ b/data/presets/lint.js @@ -0,0 +1,11 @@ +var fs = require('fs'); +var p = JSON.parse(fs.readFileSync('presets.json', 'utf8')); + +p = p.map(function(preset) { + preset.match.terms = (preset.match.terms || []).map(function(t) { + return t.trim(); + }); + return preset; +}); + +fs.writeFileSync('presets.json', JSON.stringify(p, null, 4)); diff --git a/presets/mapzen-license.txt b/data/presets/mapzen-license.txt similarity index 100% rename from presets/mapzen-license.txt rename to data/presets/mapzen-license.txt diff --git a/presets/node.json b/data/presets/node.json similarity index 100% rename from presets/node.json rename to data/presets/node.json diff --git a/presets/potlatch.xml b/data/presets/potlatch.xml similarity index 100% rename from presets/potlatch.xml rename to data/presets/potlatch.xml diff --git a/presets/prefs.json b/data/presets/prefs.json similarity index 100% rename from presets/prefs.json rename to data/presets/prefs.json diff --git a/data/presets/presets.json b/data/presets/presets.json new file mode 100644 index 000000000..c72d5f5ec --- /dev/null +++ b/data/presets/presets.json @@ -0,0 +1,1060 @@ +[ + { + "name": "cafe", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "coffee", + "tea", + "coffee shop" + ], + "tags": { + "amenity": "cafe" + } + }, + "icon": "cafe", + "form": [ + "cuisine", + "internet_access", + "building_area", + "address" + ] + }, + { + "name": "park", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "esplanade", + "estate", + "forest", + "garden", + "grass", + "green", + "grounds", + "lawn", + "lot", + "meadow", + "parkland", + "place", + "playground", + "plaza", + "pleasure garden", + "recreation area", + "square", + "tract", + "village green", + "woodland" + ], + "tags": { + "leisure": "park" + } + }, + "icon": "park" + }, + { + "name": "water", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "natural": "water" + }, + "terms": [] + }, + "icon": "" + }, + { + "name": "wetland", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "natural": "wetland" + }, + "terms": [] + }, + "icon": "" + }, + { + "name": "wood", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "natural": "wood" + }, + "terms": [] + }, + "icon": "" + }, + { + "name": "coastline", + "match": { + "type": [ + "line" + ], + "terms": [ + "shore" + ], + "tags": { + "natural": "coastline" + } + }, + "icon": "" + }, + { + "name": "supermarket", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "bazaar", + "boutique", + "chain", + "co-op", + "cut-rate store", + "discount store", + "five-and-dime", + "flea market", + "galleria", + "mall", + "mart", + "outlet", + "outlet store", + "shop", + "shopping center", + "shopping plaza", + "stand", + "store", + "supermarket", + "thrift shop" + ], + "tags": { + "shop": "supermarket" + } + }, + "icon": "grocery", + "form": [ + "operator", + "building_area", + "address" + ] + }, + { + "name": "restaurant", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "bar", + "cafeteria", + "café", + "canteen", + "chophouse", + "coffee shop", + "diner", + "dining room", + "dive*", + "doughtnut shop", + "drive-in", + "eatery", + "eating house", + "eating place", + "fast-food place", + "greasy spoon", + "grill", + "hamburger stand", + "hashery", + "hideaway", + "hotdog stand", + "inn", + "joint*", + "luncheonette", + "lunchroom", + "night club", + "outlet*", + "pizzeria", + "saloon", + "soda fountain", + "watering hole" + ], + "tags": { + "amenity": "restaurant" + } + }, + "icon": "restaurant", + "form": [ + "cuisine", + "building_area", + "address" + ] + }, + { + "name": "place of worship", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "abbey", + "basilica", + "bethel", + "cathedral", + "chancel", + "chantry", + "chapel", + "church", + "fold", + "house of God", + "house of prayer", + "house of worship", + "minster", + "mission", + "mosque", + "oratory", + "parish", + "sacellum", + "sanctuary", + "shrine", + "synagogue", + "tabernacle", + "temple" + ], + "tags": { + "amenity": "place_of_worship" + } + }, + "icon": "place-of-worship", + "form": [ + "religion", + "denomination", + "building_area", + "address" + ] + }, + { + "name": "school", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "academy", + "alma mater", + "blackboard", + "college", + "department", + "discipline", + "establishment", + "faculty", + "hall", + "halls of ivy", + "institute", + "institution", + "jail*", + "schoolhouse", + "seminary", + "university" + ], + "tags": { + "amenity": "school" + } + }, + "icon": "school", + "form": [ + "operator", + "building", + "address" + ] + }, + { + "name": "parking", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "amenity": "parking" + }, + "terms": [] + }, + "icon": "parking", + "form": [ + "fee", + "access", + "address" + ] + }, + { + "name": "bank", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "coffer", + "countinghouse", + "credit union", + "depository", + "exchequer", + "fund", + "hoard", + "investment firm", + "repository", + "reserve", + "reservoir", + "safe", + "savings", + "stock", + "stockpile", + "store", + "storehouse", + "thrift", + "treasury", + "trust company", + "vault" + ], + "tags": { + "amenity": "bank" + } + }, + "icon": "bank", + "form": [ + "atm", + "building_area", + "address" + ] + }, + { + "name": "fast food", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "amenity": "fast_food" + }, + "terms": [] + }, + "icon": "fast-food", + "form": [ + "cuisine", + "building_area", + "address" + ] + }, + { + "name": "bar", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "amenity": "bar" + }, + "terms": [] + }, + "icon": "bar", + "form": [ + "building_area", + "address" + ] + }, + { + "name": "bus stop", + "match": { + "type": [ + "point" + ], + "tags": { + "highway": "bus_stop" + }, + "terms": [] + }, + "icon": "bus", + "form": [ + "operator", + "shelter" + ] + }, + { + "name": "cinema", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "big screen", + "bijou", + "cine", + "drive-in", + "film", + "flicks", + "motion pictures", + "movie house", + "movie theater", + "moving pictures", + "nabes", + "photoplay", + "picture show", + "pictures", + "playhouse", + "show", + "silver screen" + ], + "tags": { + "amenity": "cinema" + } + }, + "icon": "cinema", + "form": [ + "building_area", + "address" + ] + }, + { + "name": "hospital", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "clinic", + "emergency room", + "health service", + "hospice", + "infirmary", + "institution", + "nursing home", + "rest home", + "sanatorium", + "sanitarium", + "sick bay", + "surgery", + "ward" + ], + "tags": { + "amenity": "hospital" + } + }, + "icon": "hospital", + "form": [ + "emergency", + "building_area", + "address" + ] + }, + { + "name": "pharmacy", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "amenity": "pharmacy" + }, + "terms": [] + }, + "icon": "police", + "form": [ + "dispensing", + "operator", + "building_area", + "address" + ] + }, + { + "name": "fire station", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "amenity": "fire_station" + }, + "terms": [] + }, + "icon": "fire-station", + "form": [ + "operator", + "building_area", + "address" + ] + }, + { + "name": "police", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "badge", + "bear", + "blue", + "bluecoat", + "bobby", + "boy scout", + "bull", + "constable", + "constabulary", + "cop", + "copper", + "corps", + "county mounty", + "detective", + "fed", + "flatfoot", + "force", + "fuzz", + "gendarme", + "gumshoe", + "heat", + "law", + "law enforcement", + "man", + "narc", + "officers", + "patrolman", + "police" + ], + "tags": { + "amenity": "police" + } + }, + "icon": "pharmacy", + "form": [ + "operator", + "building_area", + "address" + ] + }, + { + "name": "library", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "amenity": "library" + } + }, + "icon": "library", + "form": [ + "operator", + "building_area", + "address" + ] + }, + { + "name": "museum", + "match": { + "type": [ + "point", + "area" + ], + "terms": [ + "exhibition", + "exhibits archive", + "foundation", + "gallery", + "hall", + "institution", + "library", + "menagerie", + "repository", + "salon", + "storehouse", + "treasury", + "vault" + ], + "tags": { + "tourism": "museum" + } + }, + "icon": "museum", + "form": [ + "operator", + "building_area", + "address" + ] + }, + { + "name": "golf course", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "leisure": "golf_course" + }, + "terms": [] + }, + "icon": "golf", + "form": [ + "operator", + "address" + ] + }, + { + "name": "river", + "match": { + "type": [ + "line" + ], + "terms": [ + "beck", + "branch", + "brook", + "course", + "creek", + "estuary", + "rill", + "rivulet", + "run", + "runnel", + "stream", + "tributary", + "watercourse" + ], + "tags": { + "waterway": "river" + } + }, + "icon": "waterway-river" + }, + { + "name": "stream", + "match": { + "type": [ + "line" + ], + "terms": [ + "beck", + "branch", + "brook", + "burn", + "course", + "creek", + "current", + "drift", + "flood", + "flow", + "freshet", + "race", + "rill", + "rindle", + "rivulet", + "run", + "runnel", + "rush", + "spate", + "spritz", + "surge", + "tide", + "torrent", + "tributary", + "watercourse" + ], + "tags": { + "waterway": "stream" + } + }, + "icon": "waterway-river", + "form": [ + "layer" + ] + }, + { + "name": "motorway", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "motorway" + }, + "terms": [] + }, + "icon": "highway-motorway", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "residential road", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "residential" + }, + "terms": [] + }, + "icon": "highway-residential", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "primary road", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "primary" + }, + "terms": [] + }, + "icon": "highway-primary", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "secondary road", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "secondary" + }, + "terms": [] + }, + "icon": "highway-secondary", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "tertiary road", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "tertiary" + }, + "terms": [] + }, + "icon": "highway-tertiary", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "service road", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "service" + }, + "terms": [] + }, + "icon": "highway-service", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "track", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "track" + }, + "terms": [] + }, + "icon": "highway-track", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "rail", + "match": { + "type": [ + "line" + ], + "tags": { + "railway": "rail" + }, + "terms": [] + }, + "icon": "railway-rail" + }, + { + "name": "subway", + "match": { + "type": [ + "line" + ], + "tags": { + "railway": "subway" + }, + "terms": [] + }, + "icon": "railway-rail" + }, + { + "name": "trunk highway", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "trunk" + }, + "terms": [] + }, + "icon": "highway-trunk", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "foot path", + "match": { + "type": [ + "line" + ], + "terms": [ + "beaten path", + "boulevard", + "clearing", + "course", + "cut*", + "drag*", + "footpath", + "highway", + "lane", + "line", + "orbit", + "passage", + "pathway", + "rail", + "rails", + "road", + "roadway", + "route", + "street", + "thoroughfare", + "trackway", + "trail", + "trajectory", + "walk" + ], + "tags": { + "highway": "footway" + } + }, + "icon": "highway-footway" + }, + { + "name": "cycle path", + "match": { + "type": [ + "line" + ], + "tags": { + "highway": "cycleway" + }, + "terms": [] + }, + "icon": "highway-cycleway", + "form": [ + "oneway", + "bridge", + "tunnel", + "access", + "maxspeed" + ] + }, + { + "name": "sport pitch", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "leisure": "pitch" + }, + "terms": [] + }, + "icon": "pitch", + "form": [ + "surface" + ] + }, + { + "name": "basketball court", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "leisure": "pitch", + "sport": "basketball" + }, + "terms": [] + }, + "icon": "basketball", + "form": [ + "surface" + ] + }, + { + "name": "baseball diamond", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "leisure": "pitch", + "sport": "baseball" + }, + "terms": [] + }, + "icon": "baseball", + "form": [ + "surface" + ] + }, + { + "name": "soccer field", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "leisure": "pitch", + "sport": "soccer" + }, + "terms": [] + }, + "icon": "soccer", + "form": [ + "surface" + ] + }, + { + "name": "tennis court", + "match": { + "type": [ + "point", + "area" + ], + "tags": { + "leisure": "pitch", + "sport": "tennis" + }, + "terms": [] + }, + "icon": "tennis", + "form": [ + "surface" + ] + }, + { + "name": "building", + "match": { + "type": [ + "area" + ], + "tags": { + "building": "*" + }, + "terms": [] + }, + "icon": "warehouse", + "form": [ + "building_yes", + "address" + ] + }, + { + "name": "turning circle", + "match": { + "type": [ + "vertex" + ], + "tags": { + "highway": "turning_circle" + }, + "terms": [] + }, + "icon": "circle" + } +] diff --git a/presets/presets_josm.json b/data/presets/presets_josm.json similarity index 100% rename from presets/presets_josm.json rename to data/presets/presets_josm.json diff --git a/presets/presets_potlatch.json b/data/presets/presets_potlatch.json similarity index 100% rename from presets/presets_potlatch.json rename to data/presets/presets_potlatch.json diff --git a/presets/way.json b/data/presets/way.json similarity index 100% rename from presets/way.json rename to data/presets/way.json diff --git a/presets/ways/highway__bridleway.png b/data/presets/ways/highway__bridleway.png similarity index 100% rename from presets/ways/highway__bridleway.png rename to data/presets/ways/highway__bridleway.png diff --git a/presets/ways/highway__cycleway.png b/data/presets/ways/highway__cycleway.png similarity index 100% rename from presets/ways/highway__cycleway.png rename to data/presets/ways/highway__cycleway.png diff --git a/presets/ways/highway__footway.png b/data/presets/ways/highway__footway.png similarity index 100% rename from presets/ways/highway__footway.png rename to data/presets/ways/highway__footway.png diff --git a/presets/ways/highway__light_rail.png b/data/presets/ways/highway__light_rail.png similarity index 100% rename from presets/ways/highway__light_rail.png rename to data/presets/ways/highway__light_rail.png diff --git a/presets/ways/highway__living_street.png b/data/presets/ways/highway__living_street.png similarity index 100% rename from presets/ways/highway__living_street.png rename to data/presets/ways/highway__living_street.png diff --git a/presets/ways/highway__motorway.png b/data/presets/ways/highway__motorway.png similarity index 100% rename from presets/ways/highway__motorway.png rename to data/presets/ways/highway__motorway.png diff --git a/presets/ways/highway__pedestrian.png b/data/presets/ways/highway__pedestrian.png similarity index 100% rename from presets/ways/highway__pedestrian.png rename to data/presets/ways/highway__pedestrian.png diff --git a/presets/ways/highway__primary.png b/data/presets/ways/highway__primary.png similarity index 100% rename from presets/ways/highway__primary.png rename to data/presets/ways/highway__primary.png diff --git a/presets/ways/highway__residential.png b/data/presets/ways/highway__residential.png similarity index 100% rename from presets/ways/highway__residential.png rename to data/presets/ways/highway__residential.png diff --git a/presets/ways/highway__secondary.png b/data/presets/ways/highway__secondary.png similarity index 100% rename from presets/ways/highway__secondary.png rename to data/presets/ways/highway__secondary.png diff --git a/presets/ways/highway__service.png b/data/presets/ways/highway__service.png similarity index 100% rename from presets/ways/highway__service.png rename to data/presets/ways/highway__service.png diff --git a/presets/ways/highway__tertiary.png b/data/presets/ways/highway__tertiary.png similarity index 100% rename from presets/ways/highway__tertiary.png rename to data/presets/ways/highway__tertiary.png diff --git a/presets/ways/highway__track.png b/data/presets/ways/highway__track.png similarity index 100% rename from presets/ways/highway__track.png rename to data/presets/ways/highway__track.png diff --git a/presets/ways/highway__trunk.png b/data/presets/ways/highway__trunk.png similarity index 100% rename from presets/ways/highway__trunk.png rename to data/presets/ways/highway__trunk.png diff --git a/presets/ways/highway__unclassified.png b/data/presets/ways/highway__unclassified.png similarity index 100% rename from presets/ways/highway__unclassified.png rename to data/presets/ways/highway__unclassified.png diff --git a/presets/ways/railway__abandoned.png b/data/presets/ways/railway__abandoned.png similarity index 100% rename from presets/ways/railway__abandoned.png rename to data/presets/ways/railway__abandoned.png diff --git a/presets/ways/railway__construction.png b/data/presets/ways/railway__construction.png similarity index 100% rename from presets/ways/railway__construction.png rename to data/presets/ways/railway__construction.png diff --git a/presets/ways/railway__disused.png b/data/presets/ways/railway__disused.png similarity index 100% rename from presets/ways/railway__disused.png rename to data/presets/ways/railway__disused.png diff --git a/presets/ways/railway__monorail.png b/data/presets/ways/railway__monorail.png similarity index 100% rename from presets/ways/railway__monorail.png rename to data/presets/ways/railway__monorail.png diff --git a/presets/ways/railway__narrow_gauge.png b/data/presets/ways/railway__narrow_gauge.png similarity index 100% rename from presets/ways/railway__narrow_gauge.png rename to data/presets/ways/railway__narrow_gauge.png diff --git a/presets/ways/railway__preserved.png b/data/presets/ways/railway__preserved.png similarity index 100% rename from presets/ways/railway__preserved.png rename to data/presets/ways/railway__preserved.png diff --git a/presets/ways/railway__rail.png b/data/presets/ways/railway__rail.png similarity index 100% rename from presets/ways/railway__rail.png rename to data/presets/ways/railway__rail.png diff --git a/presets/ways/railway__spur.png b/data/presets/ways/railway__spur.png similarity index 100% rename from presets/ways/railway__spur.png rename to data/presets/ways/railway__spur.png diff --git a/presets/ways/railway__tram.png b/data/presets/ways/railway__tram.png similarity index 100% rename from presets/ways/railway__tram.png rename to data/presets/ways/railway__tram.png diff --git a/presets/ways/waterway__canal.png b/data/presets/ways/waterway__canal.png similarity index 100% rename from presets/ways/waterway__canal.png rename to data/presets/ways/waterway__canal.png diff --git a/presets/ways/waterway__river.png b/data/presets/ways/waterway__river.png similarity index 100% rename from presets/ways/waterway__river.png rename to data/presets/ways/waterway__river.png diff --git a/presets/ways/waterway__stream.png b/data/presets/ways/waterway__stream.png similarity index 100% rename from presets/ways/waterway__stream.png rename to data/presets/ways/waterway__stream.png diff --git a/index.html b/index.html index 83b50cecc..1b35bb7da 100644 --- a/index.html +++ b/index.html @@ -37,10 +37,7 @@ - - - - + @@ -48,7 +45,6 @@ - @@ -187,26 +183,10 @@ -
-
+ d3.select('#iD') + .call(id.ui()); + + diff --git a/js/id/core/way.js b/js/id/core/way.js index 3e9aa8571..e520f223a 100644 --- a/js/id/core/way.js +++ b/js/id/core/way.js @@ -33,7 +33,9 @@ _.extend(iD.Way.prototype, { }, isOneWay: function() { - return this.tags.oneway === 'yes'; + return this.tags.oneway === 'yes' || + this.tags.waterway === 'river' || + this.tags.waterway === 'stream'; }, isClosed: function() { diff --git a/js/id/id.js b/js/id/id.js index 5c8fa442d..dd095dbaa 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -1,4 +1,8 @@ window.iD = function () { + locale + .current('en') + .current(iD.detect().locale); + var context = {}, storage; @@ -21,7 +25,8 @@ window.iD = function () { map = iD.Map(context); // the connection requires .storage() to be available on calling. - var connection = iD.Connection(context); + var connection = iD.Connection(context) + .keys(iD.data.keys); connection.on('load.context', function loadContext(err, result) { history.merge(result); @@ -95,8 +100,17 @@ window.iD = function () { context.zoomIn = map.zoomIn; context.zoomOut = map.zoomOut; + /* Background */ + var backgroundSources = iD.data.imagery.map(iD.BackgroundSource.template); + backgroundSources.push(iD.BackgroundSource.Custom); + + context.backgroundSources = function() { + return backgroundSources; + }; + /* Presets */ - var presets = iD.presets(context); + var presets = iD.presets(context) + .load(iD.data.presets); context.presets = function() { return presets; @@ -111,7 +125,7 @@ window.iD = function () { var q = iD.util.stringQs(location.hash.substring(1)), detected = false; if (q.layer) { context.background() - .source(_.find(iD.layers, function(l) { + .source(_.find(backgroundSources, function(l) { if (l.data.sourcetag === q.layer) { detected = true; return true; @@ -121,7 +135,7 @@ window.iD = function () { if (!detected) { context.background() - .source(_.find(iD.layers, function(l) { + .source(_.find(backgroundSources, function(l) { return l.data.name === 'Bing aerial imagery'; })); } diff --git a/js/id/oauth.js b/js/id/oauth.js index 7ade87c3e..c361d9343 100644 --- a/js/id/oauth.js +++ b/js/id/oauth.js @@ -2,7 +2,8 @@ iD.OAuth = function(context) { var baseurl = 'http://www.openstreetmap.org', o = {}, keys, - oauth = {}; + oauth = {}, + oauth_secret; function timenonce(o) { o.oauth_timestamp = ohauth.timestamp(); diff --git a/js/id/presets.js b/js/id/presets.js index ab7fa52de..d222c732e 100644 --- a/js/id/presets.js +++ b/js/id/presets.js @@ -44,6 +44,8 @@ iD.presets = function(context) { vertex: iD.presets.Collection(d.defaults.vertex.map(getItem)) }; } + + return all; }; all.defaults = function(entity, n) { diff --git a/js/id/presets/category.js b/js/id/presets/category.js index 079838c3c..21f16d939 100644 --- a/js/id/presets/category.js +++ b/js/id/presets/category.js @@ -1,4 +1,5 @@ iD.presets.Category = function(category, all) { + category = _.clone(category); category.members = iD.presets.Collection(category.members.map(function(name) { return all.item(name); diff --git a/js/id/presets/collection.js b/js/id/presets/collection.js index ce683fcb9..6181ed327 100644 --- a/js/id/presets/collection.js +++ b/js/id/presets/collection.js @@ -39,25 +39,34 @@ iD.presets.Collection = function(collection) { value = value.toLowerCase(); - // Uses levenshtein distance, with a couple of hacks - // to prioritize exact substring matches - return iD.presets.Collection(collection.sort(function(a, b) { - var ia = a.name.indexOf(value) >= 0, - ib = b.name.indexOf(value) >= 0; + var substring_name = _.filter(collection, function(a) { + return a.name.indexOf(value) !== -1; + }), + substring_terms = _.filter(collection, function(a) { + return _.any(a.match.terms || [], function(b) { + return iD.util.editDistance(value, b) - b.length + value.length < 3; + }); + }), + levenstein_name = collection.map(function(a) { + return { preset: a, dist: iD.util.editDistance(value, a.name) }; + }).filter(function(a) { + return a.dist - a.preset.name.length + value.length < 3; + }).sort(function(a, b) { + return a.dist - b.dist; + }).map(function(a) { + return a.preset; + }), + other = _.find(collection, function(a) { + return a.name === 'other'; + }); - if (ia && !ib) { - return -1; - } else if (ib && !ia) { - return 1; - } - - return iD.util.editDistance(value, a.name) - iD.util.editDistance(value, b.name); - }).filter(function(d) { - return iD.util.editDistance(value, d.name) - d.name.length + value.length < 3 || - d.name === 'other'; - })); + return iD.presets.Collection( + _.unique( + substring_name.concat( + substring_terms, + levenstein_name, + other))); } - }; return presets; diff --git a/js/id/renderer/layers.js b/js/id/renderer/layers.js deleted file mode 100644 index 966e16bb8..000000000 --- a/js/id/renderer/layers.js +++ /dev/null @@ -1,15 +0,0 @@ -iD.layers = iD.data.imagery.map(iD.BackgroundSource.template); - -iD.layers.push((function() { - function custom() { - var template = window.prompt('Enter a tile template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.'); - if (!template) return null; - if (template.match(/google/g)) return null; - return iD.BackgroundSource.template({ - template: template, - name: 'Custom (customized)' - }); - } - custom.data = { name: 'Custom' }; - return custom; -})()); diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 667b33eca..f493fbf78 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -304,8 +304,16 @@ iD.Map = function(context) { }; map.centerEase = function(loc) { - var from = map.center().slice(), t = 0; + var from = map.center().slice(), + t = 0, + stop; + + surface.one('mousedown.ease', function() { + stop = true; + }); + d3.timer(function() { + if (stop) return true; map.center(iD.geo.interp(from, loc, (t += 1) / 10)); return t == 10; }, 20); diff --git a/js/id/svg/areas.js b/js/id/svg/areas.js index adad6e03a..42b881090 100644 --- a/js/id/svg/areas.js +++ b/js/id/svg/areas.js @@ -1,18 +1,53 @@ iD.svg.Areas = function(projection) { + // For fixing up rendering of multipolygons with tags on the outer member. + // https://github.com/systemed/iD/issues/613 + function isSimpleMultipolygonOuterMember(entity, graph) { + if (entity.type !== 'way') + return false; + + var parents = graph.parentRelations(entity); + if (parents.length !== 1) + return false; + + var parent = parents[0]; + if (!parent.isMultipolygon() || Object.keys(parent.tags).length > 1) + return false; + + var members = parent.members, member; + for (var i = 0; i < members.length; i++) { + member = members[i]; + if (member.id === entity.id && member.role && member.role !== 'outer') + return false; // Not outer member + if (member.id !== entity.id && (!member.role || member.role === 'outer')) + return false; // Not a simple multipolygon + } + + return parent; + } + return function drawAreas(surface, graph, entities, filter) { var path = d3.geo.path().projection(projection), - areas = []; + areas = {}, + multipolygon; for (var i = 0; i < entities.length; i++) { var entity = entities[i]; - if (entity.geometry(graph) === 'area') { - areas.push({ + if (entity.geometry(graph) !== 'area') continue; + + if (multipolygon = isSimpleMultipolygonOuterMember(entity, graph)) { + areas[multipolygon.id] = { + entity: multipolygon.mergeTags(entity.tags), + area: Math.abs(path.area(entity.asGeoJSON(graph, true))) + }; + } else if (!areas[entity.id]) { + areas[entity.id] = { entity: entity, area: Math.abs(path.area(entity.asGeoJSON(graph, true))) - }); + }; } } + areas = d3.values(areas); areas.sort(function(a, b) { return b.area - a.area; }); function drawPaths(group, areas, filter, klass, closeWay) { diff --git a/js/id/svg/lines.js b/js/id/svg/lines.js index 81d9346f9..0e91f2ce2 100644 --- a/js/id/svg/lines.js +++ b/js/id/svg/lines.js @@ -33,6 +33,33 @@ iD.svg.Lines = function(projection) { return as - bs; } + // For fixing up rendering of multipolygons with tags on the outer member. + // https://github.com/systemed/iD/issues/613 + function simpleMultipolygonOuterMember(entity, graph) { + if (entity.type !== 'way') + return false; + + var parents = graph.parentRelations(entity); + if (parents.length !== 1) + return false; + + var parent = parents[0]; + if (!parent.isMultipolygon() || Object.keys(parent.tags).length > 1) + return false; + + var members = parent.members, member, outer; + for (var i = 0; i < members.length; i++) { + member = members[i]; + if (!member.role || member.role === 'outer') { + if (outer) + return false; // Not a simple multipolygon + outer = graph.entity(member.id); + } + } + + return outer; + } + return function drawLines(surface, graph, entities, filter, dimensions) { function drawPaths(group, lines, filter, klass, lineString) { lines = lines.filter(function(line) { @@ -78,8 +105,11 @@ iD.svg.Lines = function(projection) { var lines = []; for (var i = 0; i < entities.length; i++) { - var entity = entities[i]; - if (entity.geometry(graph) === 'line') { + var entity = entities[i], + outer = simpleMultipolygonOuterMember(entity, graph); + if (outer) { + lines.push(entity.mergeTags(outer.tags)); + } else if (entity.geometry(graph) === 'line') { lines.push(entity); } } @@ -121,11 +151,14 @@ iD.svg.Lines = function(projection) { .filter(filter) .data(oneways, iD.Entity.key); + var tagClasses = iD.svg.TagClasses(); + var tp = labels.enter() .append('text') .attr({ 'class': 'oneway', dy: 4 }) .append('textPath') - .attr('class', 'textpath'); + .attr('class', 'textpath') + .call(tagClasses); labels.exit().remove(); diff --git a/js/id/ui/background.js b/js/id/ui/background.js index 69991430f..a0f0c04a7 100644 --- a/js/id/ui/background.js +++ b/js/id/ui/background.js @@ -2,7 +2,7 @@ iD.ui.Background = function(context) { var event = d3.dispatch('cancel', 'save'), opacities = [1, 0.5, 0]; - var layers = iD.layers; + var layers = context.backgroundSources(); function getSources() { var ext = context.map().extent(); diff --git a/presets/presets.json b/presets/presets.json deleted file mode 100644 index 214e44153..000000000 --- a/presets/presets.json +++ /dev/null @@ -1,467 +0,0 @@ -[ -{ - "name": "cafe", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "cafe" - } - }, - "icon": "cafe", - "form": ["cuisine", "internet_access", "building_area", "address"] -}, -{ - "name": "park", - "match": { - "type": ["point", "area"], - "tags": { - "leisure": "park" - } - }, - "icon": "park" -}, -{ - "name": "water", - "match": { - "type": ["point", "area"], - "tags": { - "natural": "water" - } - }, - "icon": "" -}, -{ - "name": "wetland", - "match": { - "type": ["point", "area"], - "tags": { - "natural": "wetland" - } - }, - "icon": "" -}, -{ - "name": "wood", - "match": { - "type": ["point", "area"], - "tags": { - "natural": "wood" - } - }, - "icon": "" -}, -{ - "name": "coastline", - "match": { - "type": ["line"], - "tags": { - "natural": "coastline" - } - }, - "icon": "" -}, -{ - "name": "supermarket", - "match": { - "type": ["point", "area"], - "tags": { - "shop": "supermarket" - } - }, - "icon": "grocery", - "form": ["operator", "building_area", "address"] -}, -{ - "name": "restaurant", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "restaurant" - } - }, - "icon": "restaurant", - "form": ["cuisine", "building_area", "address"] -}, -{ - "name": "place of worship", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "place_of_worship" - } - }, - "icon": "place-of-worship", - "form": ["religion", "denomination", "building_area", "address"] -}, -{ - "name": "school", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "school" - } - }, - "icon": "school", - "form": ["operator", "building", "address"] -}, -{ - "name": "parking", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "parking" - } - }, - "icon": "parking", - "form": ["fee", "access", "address"] -}, -{ - "name": "bank", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "bank" - } - }, - "icon": "bank", - "form": ["atm", "building_area", "address"] -}, -{ - "name": "fast food", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "fast_food" - } - }, - "icon": "fast-food", - "form": ["cuisine", "building_area", "address"] -}, -{ - "name": "bar", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "bar" - } - }, - "icon": "bar", - "form": ["building_area", "address"] -}, -{ - "name": "bus stop", - "match": { - "type": ["point"], - "tags": { - "highway": "bus_stop" - } - }, - "icon": "bus", - "form": ["operator", "shelter"] -}, -{ - "name": "cinema", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "cinema" - } - }, - "icon": "cinema", - "form": ["building_area", "address"] -}, -{ - "name": "hospital", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "hospital" - } - }, - "icon": "hospital", - "form": ["emergency", "building_area", "address"] -}, -{ - "name": "pharmacy", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "pharmacy" - } - }, - "icon": "police", - "form": ["dispensing", "operator", "building_area", "address"] -}, -{ - "name": "fire station", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "fire_station" - } - }, - "icon": "fire-station", - "form": ["operator", "building_area", "address"] -}, -{ - "name": "police", - "match": { - "type": ["point", "area"], - "tags": { - "amenity": "police" - } - }, - "icon": "pharmacy", - "form": ["operator", "building_area", "address"] -}, -{ - "name": "museum", - "match": { - "type": ["point", "area"], - "tags": { - "tourism": "museum" - } - }, - "icon": "museum", - "form": ["operator", "building_area", "address"] -}, -{ - "name": "golf course", - "match": { - "type": ["point", "area"], - "tags": { - "leisure": "golf_course" - } - }, - "icon": "golf", - "form": ["operator", "address"] -}, -{ - "name": "river", - "match": { - "type": ["line"], - "tags": { - "waterway": "river" - } - }, - "icon": "waterway-river" -}, -{ - "name": "stream", - "match": { - "type": ["line"], - "tags": { - "waterway": "stream" - } - }, - "icon": "waterway-river", - "form": ["layer"] -}, -{ - "name": "motorway", - "match": { - "type": ["line"], - "tags": { - "highway": "motorway" - } - }, - "icon": "highway-motorway", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "residential road", - "match": { - "type": ["line"], - "tags": { - "highway": "residential" - } - }, - "icon": "highway-residential", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "primary road", - "match": { - "type": ["line"], - "tags": { - "highway": "primary" - } - }, - "icon": "highway-primary", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "secondary road", - "match": { - "type": ["line"], - "tags": { - "highway": "secondary" - } - }, - "icon": "highway-secondary", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "tertiary road", - "match": { - "type": ["line"], - "tags": { - "highway": "tertiary" - } - }, - "icon": "highway-tertiary", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "service road", - "match": { - "type": ["line"], - "tags": { - "highway": "service" - } - }, - "icon": "highway-service", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "track", - "match": { - "type": ["line"], - "tags": { - "highway": "track" - } - }, - "icon": "highway-track", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "rail", - "match": { - "type": ["line"], - "tags": { - "railway": "rail" - } - }, - "icon": "railway-rail" -}, -{ - "name": "subway", - "match": { - "type": ["line"], - "tags": { - "railway": "subway" - } - }, - "icon": "railway-rail" -}, -{ - "name": "trunk highway", - "match": { - "type": ["line"], - "tags": { - "highway": "trunk" - } - }, - "icon": "highway-trunk", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "foot path", - "match": { - "type": ["line"], - "tags": { - "highway": "footway" - } - }, - "icon": "highway-footway" -}, -{ - "name": "cycle path", - "match": { - "type": ["line"], - "tags": { - "highway": "cycleway" - } - }, - "icon": "highway-cycleway", - "form": ["oneway", "bridge", "tunnel", "access", "maxspeed"] -}, -{ - "name": "sport pitch", - "match": { - "type": ["point", "area"], - "tags": { "leisure": "pitch" } - }, - "icon": "pitch", - "form": ["surface"] -}, -{ - "name": "basketball court", - "match": { - "type": ["point", "area"], - "tags": { - "leisure": "pitch", - "sport": "basketball" - } - }, - "icon": "basketball", - "form": ["surface"] -}, -{ - "name": "baseball diamond", - "match": { - "type": ["point", "area"], - "tags": { - "leisure": "pitch", - "sport": "baseball" - } - }, - "icon": "baseball", - "form": ["surface"] -}, -{ - "name": "soccer field", - "match": { - "type": ["point", "area"], - "tags": { - "leisure": "pitch", - "sport": "soccer" - } - }, - "icon": "soccer", - "form": ["surface"] -}, -{ - "name": "tennis court", - "match": { - "type": ["point", "area"], - "tags": { - "leisure": "pitch", - "sport": "tennis" - } - }, - "icon": "tennis", - "form": ["surface"] -}, -{ - "name": "building", - "match": { - "type": ["area"], - "tags": { - "building": "*" - } - }, - "icon": "warehouse", - "form": ["building_yes", "address"] -}, -{ - "name": "turning circle", - "match": { - "type": ["vertex"], - "tags": { - "highway": "turning_circle" - } - }, - "icon": "circle" -} -] diff --git a/test/index.html b/test/index.html index f500d0b08..dc71a2bcc 100644 --- a/test/index.html +++ b/test/index.html @@ -40,10 +40,7 @@ - - - - + @@ -51,7 +48,6 @@ - @@ -260,7 +256,9 @@ diff --git a/test/index_packaged.html b/test/index_packaged.html index c8b6984fe..575d163ff 100644 --- a/test/index_packaged.html +++ b/test/index_packaged.html @@ -21,9 +21,9 @@ + - @@ -52,6 +52,7 @@ + @@ -70,19 +71,26 @@ + + + + + + + diff --git a/test/spec/renderer/background.js b/test/spec/renderer/background.js index cdfb3239d..52c825d06 100644 --- a/test/spec/renderer/background.js +++ b/test/spec/renderer/background.js @@ -20,11 +20,6 @@ describe('iD.Background', function() { expect(c.size([100, 100])).to.equal(c); expect(c.size()).to.eql([100,100]); }); - - it('#source', function() { - expect(c.source(iD.layers[0])).to.equal(c); - expect(c.source()).to.equal(iD.layers[0]); - }); }); describe('iD.BackgroundSource.Template', function() { diff --git a/test/spec/svg/areas.js b/test/spec/svg/areas.js index bbf8674ae..d84abf8f1 100644 --- a/test/spec/svg/areas.js +++ b/test/spec/svg/areas.js @@ -30,13 +30,13 @@ describe("iD.svg.Areas", function () { it("adds member classes", function () { var area = iD.Way({tags: {area: 'yes'}}), - relation = iD.Relation({members: [{id: area.id, role: 'outer'}], tags: {type: 'multipolygon'}}), + relation = iD.Relation({members: [{id: area.id, role: 'inner'}], tags: {type: 'multipolygon'}}), graph = iD.Graph([area, relation]); surface.call(iD.svg.Areas(projection), graph, [area], filter); expect(surface.select('.area')).to.be.classed('member'); - expect(surface.select('.area')).to.be.classed('member-role-outer'); + expect(surface.select('.area')).to.be.classed('member-role-inner'); expect(surface.select('.area')).to.be.classed('member-type-multipolygon'); }); @@ -111,4 +111,32 @@ describe("iD.svg.Areas", function () { expect(surface.select('.stroke')).to.be.classed('tag-natural-wood'); expect(surface.select('.fill')).not.to.be.classed('tag-natural-wood'); }); + + it("renders fill for a multipolygon with tags on the outer way", function() { + var a = iD.Node({loc: [1, 1]}), + b = iD.Node({loc: [2, 2]}), + c = iD.Node({loc: [3, 3]}), + w = iD.Way({tags: {natural: 'wood'}, nodes: [a.id, b.id, c.id, a.id]}), + r = iD.Relation({members: [{id: w.id}], tags: {type: 'multipolygon'}}), + graph = iD.Graph([a, b, c, w, r]); + + surface.call(iD.svg.Areas(projection), graph, [w, r], filter); + + expect(surface.selectAll('.way.fill')[0].length).to.equal(0); + expect(surface.selectAll('.relation.fill')[0].length).to.equal(1); + expect(surface.select('.relation.fill')).to.be.classed('tag-natural-wood'); + }); + + it("renders no strokes for a multipolygon with tags on the outer way", function() { + var a = iD.Node({loc: [1, 1]}), + b = iD.Node({loc: [2, 2]}), + c = iD.Node({loc: [3, 3]}), + w = iD.Way({tags: {natural: 'wood'}, nodes: [a.id, b.id, c.id, a.id]}), + r = iD.Relation({members: [{id: w.id}], tags: {type: 'multipolygon'}}), + graph = iD.Graph([a, b, c, w, r]); + + surface.call(iD.svg.Areas(projection), graph, [w, r], filter); + + expect(surface.selectAll('.stroke')[0].length).to.equal(0); + }); }); diff --git a/test/spec/svg/lines.js b/test/spec/svg/lines.js index 5c99336e4..0dfa32f67 100644 --- a/test/spec/svg/lines.js +++ b/test/spec/svg/lines.js @@ -58,6 +58,33 @@ describe("iD.svg.Lines", function () { expect(surface.select('.stroke')).to.be.classed('tag-natural-wood'); }); + it("renders stroke for outer way of multipolygon with tags on the outer way", function() { + var a = iD.Node({loc: [1, 1]}), + b = iD.Node({loc: [2, 2]}), + c = iD.Node({loc: [3, 3]}), + w = iD.Way({tags: {natural: 'wood'}, nodes: [a.id, b.id, c.id, a.id]}), + r = iD.Relation({members: [{id: w.id}], tags: {type: 'multipolygon'}}), + graph = iD.Graph([a, b, c, w, r]); + + surface.call(iD.svg.Lines(projection), graph, [w], filter, dimensions); + + expect(surface.select('.stroke')).to.be.classed('tag-natural-wood'); + }); + + it("adds stroke classes for the tags of the outer way of multipolygon with tags on the outer way", function() { + var a = iD.Node({loc: [1, 1]}), + b = iD.Node({loc: [2, 2]}), + c = iD.Node({loc: [3, 3]}), + o = iD.Way({tags: {natural: 'wood'}, nodes: [a.id, b.id, c.id, a.id]}), + i = iD.Way({nodes: [a.id, b.id, c.id, a.id]}), + r = iD.Relation({members: [{id: o.id, role: 'outer'}, {id: i.id, role: 'inner'}], tags: {type: 'multipolygon'}}), + graph = iD.Graph([a, b, c, o, i, r]); + + surface.call(iD.svg.Lines(projection), graph, [i], filter, dimensions); + + expect(surface.select('.stroke')).to.be.classed('tag-natural-wood'); + }); + it("preserves non-line paths", function () { var line = iD.Way(), graph = iD.Graph([line]);