[7726] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
| 2 | /**
|
---|
| 3 | * Compare and analyse the differences of the editor imagery index and the JOSM imagery list.
|
---|
| 4 | * The goal is to keep both lists in sync.
|
---|
| 5 | *
|
---|
| 6 | * The editor imagery index project (https://github.com/osmlab/editor-imagery-index)
|
---|
| 7 | * provides also a version in the JOSM format, but the JSON is the original source
|
---|
| 8 | * format, so we read that.
|
---|
| 9 | *
|
---|
| 10 | * How to run:
|
---|
| 11 | * -----------
|
---|
| 12 | *
|
---|
| 13 | * Main JOSM binary needs to be in classpath, e.g.
|
---|
| 14 | *
|
---|
| 15 | * $ groovy -cp ../dist/josm-custom.jar sync_editor-imagery-index.groovy
|
---|
[9667] | 16 | *
|
---|
[7726] | 17 | * Add option "-h" to show the available command line flags.
|
---|
| 18 | */
|
---|
| 19 | import javax.json.Json
|
---|
| 20 | import javax.json.JsonArray
|
---|
| 21 | import javax.json.JsonObject
|
---|
| 22 | import javax.json.JsonReader
|
---|
| 23 |
|
---|
[9953] | 24 | import org.openstreetmap.josm.data.imagery.ImageryInfo
|
---|
[7726] | 25 | import org.openstreetmap.josm.io.imagery.ImageryReader
|
---|
| 26 |
|
---|
[9880] | 27 | class SyncEditorImageryIndex {
|
---|
[7726] | 28 |
|
---|
| 29 | List<ImageryInfo> josmEntries;
|
---|
| 30 | JsonArray eiiEntries;
|
---|
| 31 |
|
---|
| 32 | def eiiUrls = new HashMap<String, JsonObject>()
|
---|
| 33 | def josmUrls = new HashMap<String, ImageryInfo>()
|
---|
[9667] | 34 |
|
---|
[7726] | 35 | static String eiiInputFile = 'imagery.json'
|
---|
| 36 | static String josmInputFile = 'maps.xml'
|
---|
[9505] | 37 | static FileWriter outputFile = null
|
---|
| 38 | static BufferedWriter outputStream = null
|
---|
[10515] | 39 | int skipCount = 0;
|
---|
| 40 | def skipEntries = [:]
|
---|
[9505] | 41 |
|
---|
[7726] | 42 | static def options
|
---|
[9658] | 43 |
|
---|
[7726] | 44 | /**
|
---|
| 45 | * Main method.
|
---|
| 46 | */
|
---|
| 47 | static main(def args) {
|
---|
| 48 | parse_command_line_arguments(args)
|
---|
[9880] | 49 | def script = new SyncEditorImageryIndex()
|
---|
[9505] | 50 | script.loadSkip()
|
---|
[9658] | 51 | script.start()
|
---|
[7726] | 52 | script.loadJosmEntries()
|
---|
| 53 | script.loadEIIEntries()
|
---|
| 54 | script.checkInOneButNotTheOther()
|
---|
| 55 | script.checkCommonEntries()
|
---|
[9658] | 56 | script.end()
|
---|
[9505] | 57 | if(outputStream != null) {
|
---|
| 58 | outputStream.close();
|
---|
| 59 | }
|
---|
| 60 | if(outputFile != null) {
|
---|
| 61 | outputFile.close();
|
---|
| 62 | }
|
---|
[7726] | 63 | }
|
---|
[9653] | 64 |
|
---|
[7726] | 65 | /**
|
---|
| 66 | * Parse command line arguments.
|
---|
| 67 | */
|
---|
| 68 | static void parse_command_line_arguments(args) {
|
---|
[9658] | 69 | def cli = new CliBuilder(width: 160)
|
---|
[9505] | 70 | cli.o(longOpt:'output', args:1, argName: "output", "Output file, - prints to stdout (default: -)")
|
---|
| 71 | cli.e(longOpt:'eii_input', args:1, argName:"eii_input", "Input file for the editor imagery index (json). Default is $eiiInputFile (current directory).")
|
---|
| 72 | cli.j(longOpt:'josm_input', args:1, argName:"josm_input", "Input file for the JOSM imagery list (xml). Default is $josmInputFile (current directory).")
|
---|
[7726] | 73 | cli.s(longOpt:'shorten', "shorten the output, so it is easier to read in a console window")
|
---|
[9505] | 74 | cli.n(longOpt:'noskip', argName:"noskip", "don't skip known entries")
|
---|
[9658] | 75 | cli.x(longOpt:'xhtmlbody', argName:"xhtmlbody", "create XHTML body for display in a web page")
|
---|
| 76 | cli.X(longOpt:'xhtml', argName:"xhtml", "create XHTML for display in a web page")
|
---|
[9505] | 77 | cli.m(longOpt:'nomissingeii', argName:"nomissingeii", "don't show missing editor imagery index entries")
|
---|
[7726] | 78 | cli.h(longOpt:'help', "show this help")
|
---|
| 79 | options = cli.parse(args)
|
---|
| 80 |
|
---|
| 81 | if (options.h) {
|
---|
| 82 | cli.usage()
|
---|
| 83 | System.exit(0)
|
---|
| 84 | }
|
---|
| 85 | if (options.eii_input) {
|
---|
| 86 | eiiInputFile = options.eii_input
|
---|
| 87 | }
|
---|
| 88 | if (options.josm_input) {
|
---|
| 89 | josmInputFile = options.josm_input
|
---|
| 90 | }
|
---|
[9505] | 91 | if (options.output && options.output != "-") {
|
---|
| 92 | outputFile = new FileWriter(options.output)
|
---|
| 93 | outputStream = new BufferedWriter(outputFile)
|
---|
| 94 | }
|
---|
[7726] | 95 | }
|
---|
| 96 |
|
---|
[9505] | 97 | void loadSkip() {
|
---|
[9653] | 98 | /* TMS proxies for our wms */
|
---|
[9658] | 99 | skipEntries["- [CH] Stadt Zürich Luftbild 2011 - http://mapproxy.sosm.ch:8080/tiles/zh_luftbild2011/EPSG900913/{z}/{x}/{y}.png?origin=nw"] = 1
|
---|
| 100 | skipEntries["- [CH] Übersichtsplan Zürich - http://mapproxy.sosm.ch:8080/tiles/zh_uebersichtsplan/EPSG900913/{zoom}/{x}/{y}.png?origin=nw"] = 1
|
---|
| 101 | skipEntries["- [CH] Kanton Solothurn 25cm (SOGIS 2011-2014) - http://mapproxy.osm.ch:8080/tiles/sogis2014/EPSG900913/{z}/{x}/{y}.png?origin=nw"] = 1
|
---|
[9653] | 102 | /* URL style mismatch */
|
---|
[10515] | 103 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://{switch:a,b,c,d}.tile.stamen.com/terrain-background/{z}/{x}/{y}.jpg"] = 1
|
---|
| 104 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://whoots.mapwarper.net/tms/{z}/{x}/{y}/MD_SixInchImagery/http://geodata.md.gov/imap/services/Imagery/MD_SixInchImagery/MapServer/WmsServer"] = 1
|
---|
| 105 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://whoots.mapwarper.net/tms/{z}/{x}/{y}/Infrared2015/http://geodata.state.nj.us/imagerywms/Infrared2015"] = 1
|
---|
| 106 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://whoots.mapwarper.net/tms/{z}/{x}/{y}/Natural2015/http://geodata.state.nj.us/imagerywms/Natural2015"] = 1
|
---|
[9653] | 107 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg"] = 1
|
---|
| 108 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://tms.cadastre.openstreetmap.fr/*/tout/{z}/{x}/{y}.png"] = 1
|
---|
| 109 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://mapproxy.osm.ch:8080/tiles/AGIS2014/EPSG900913/{z}/{x}/{y}.png?origin=nw"] = 1
|
---|
| 110 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://mapproxy.osm.ch:8080/tiles/sogis2014/EPSG900913/{z}/{x}/{y}.png?origin=nw"] = 1
|
---|
| 111 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://mapproxy.openmap.lt/ort10lt/g/{z}/{x}/{y}.jpeg"] = 1
|
---|
| 112 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://mapproxy.sosm.ch:8080/tiles/zh_luftbild2011/EPSG900913/{z}/{x}/{y}.png?origin=nw"] = 1
|
---|
| 113 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://mapproxy.openmap.lt/ort10lt/g/{z}/{x}/{y}.jpeg"] = 1
|
---|
[10077] | 114 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://mapproxy.osm.ch:8080/tiles/KTZUERICH2015/EPSG900913/{z}/{x}/{y}.png?origin=nw"] = 1
|
---|
| 115 | skipEntries["+++ EII-URL uses {z} instead of {zoom}: http://geoservices.buergernetz.bz.it/geoserver/gwc/service/wmts/?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=P_BZ_BASEMAP_TOPO&STYLE=default&TILEMATRIXSET=GoogleMapsCompatible&TILEMATRIX=GoogleMapsCompatible%3A{z}&TILEROW={y}&TILECOL={x}&FORMAT=image%2Fjpeg"] = 1
|
---|
[9653] | 116 |
|
---|
[9505] | 117 | skipEntries["+++ EII-URL is not unique: http://geolittoral.application.equipement.gouv.fr/wms/metropole?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=ortholittorale&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
[10516] | 118 | skipEntries["- OpenStreetMap (German Language) - http://toolserver.org/tiles/osm-locale-de/{zoom}/{x}/{y}.png"] = 1
|
---|
| 119 | skipEntries["- OpenStreetMap (Sorbian Language) - http://toolserver.org/tiles/osm-locale-hsb/{zoom}/{x}/{y}.png"] = 1
|
---|
| 120 | skipEntries["- OpenStreetMap (Standard Black & White) - http://{switch:a,b,c}.www.toolserver.org/tiles/bw-mapnik/{zoom}/{x}/{y}.png"] = 1
|
---|
| 121 | skipEntries["- OpenStreetMap (Standard) - http://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png"] = 1
|
---|
[9658] | 122 | skipEntries["- Streets NRW Geofabrik.de - http://tools.geofabrik.de/osmi/view/strassennrw/wxs?REQUEST=GetMap&SERVICE=wms&VERSION=1.1.1&FORMAT=image/png&SRS={proj}&STYLES=&LAYERS=unzugeordnete_strassen,kreisstrassen_ast,kreisstrassen,landesstrassen_ast,landesstrassen,bundesstrassen_ast,bundesstrassen,autobahnen_ast,autobahnen,endpunkte&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
| 123 | skipEntries["- [CH] Kanton Solothurn 25cm (SOGIS 2011-2014) - http://www.sogis1.so.ch/cgi-bin/sogis/sogis_orthofoto.wms?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=Orthofoto_SO&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
| 124 | skipEntries["- [CH] Kanton Solothurn Infrarot 12.5cm (SOGIS 2011) - http://www.sogis1.so.ch/cgi-bin/sogis/sogis_ortho.wms?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=Orthofoto11_CIR&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
| 125 | skipEntries["- [CH] Stadt Bern 10cm/25cm (2008) - http://map.bern.ch/arcgis/services/Orthofoto_2008/MapServer/WMSServer?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=0,1&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
[10517] | 126 | skipEntries["- [CZ] Czech CUZK:KM tiles proxy - http://osm-{switch:a,b,c}.zby.cz/tiles_cuzk.php/{zoom}/{x}/{y}.png"] = 1
|
---|
| 127 | skipEntries["- [CZ] Czech UHUL:ORTOFOTO - http://geoportal2.uhul.cz/cgi-bin/oprl.asp?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS={proj}&LAYERS=Ortofoto_cb&STYLES=default&FORMAT=image/jpeg&TRANSPARENT=TRUE&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
| 128 | skipEntries["- [CZ] Czech ÚHUL:ORTOFOTO tiles proxy - http://osm-{switch:a,b,c}.zby.cz/tiles_uhul.php/{zoom}/{x}/{y}.jpg"] = 1
|
---|
| 129 | skipEntries["- [DE] Hamburg (40 cm) - http://gateway.hamburg.de/OGCFassade/HH_WMS_DOP40.aspx?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=0&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
| 130 | skipEntries["- [DE] Hamburg (DK5) - http://gateway.hamburg.de/OGCFassade/HH_WMS_Geobasisdaten.aspx?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=1&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
[9658] | 131 | skipEntries["- [EE] Estonia Basemap (Maaamet) - http://kaart.maaamet.ee/wms/alus-geo?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=pohi_vr2&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
| 132 | skipEntries["- [EE] Estonia Forestry (Maaamet) - http://kaart.maaamet.ee/wms/alus-geo?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=cir_ngr&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
| 133 | skipEntries["- [EE] Estonia Hillshading (Maaamet) - http://kaart.maaamet.ee/wms/alus-geo?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=reljeef&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
| 134 | skipEntries["- [EE] Estonia Ortho (Maaamet) - http://kaart.maaamet.ee/wms/alus-geo?VERSION=1.1.1&REQUEST=GetMap&LAYERS=of10000&SRS={proj}&FORMAT=image/jpeg&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 1
|
---|
[9505] | 135 | skipEntries[" name differs: http://wms.openstreetmap.fr/tms/1.0.0/tours_2013/{zoom}/{x}/{y}"] = 3
|
---|
| 136 | skipEntries[" name differs: http://wms.openstreetmap.fr/tms/1.0.0/tours/{zoom}/{x}/{y}"] = 3
|
---|
| 137 | skipEntries[" name differs: https://secure.erlangen.de/arcgiser/services/Luftbilder2011/MapServer/WmsServer?FORMAT=image/bmp&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=Erlangen_ratio10_5cm_gk4.jp2&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 3
|
---|
| 138 | skipEntries[" name differs: http://wms.openstreetmap.fr/tms/1.0.0/iomhaiti/{zoom}/{x}/{y}"] = 3
|
---|
| 139 | skipEntries[" name differs: http://{switch:a,b,c}.layers.openstreetmap.fr/bano/{zoom}/{x}/{y}.png"] = 3
|
---|
| 140 | skipEntries[" name differs: http://ooc.openstreetmap.org/os1/{zoom}/{x}/{y}.jpg"] = 3
|
---|
| 141 | skipEntries[" name differs: http://www.gisnet.lv/cgi-bin/osm_latvia?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=piekraste&SRS={proj}&WIDTH={width}&height={height}&BBOX={bbox}"] = 3
|
---|
[9658] | 142 | skipEntries[" name differs: http://tms.cadastre.openstreetmap.fr/*/tout/{zoom}/{x}/{y}.png"] = 3
|
---|
[9505] | 143 | skipEntries[" name differs: http://{switch:a,b,c}.tiles.mapbox.com/v4/enf.e0b8291e/{zoom}/{x}/{y}.png?access_token=pk.eyJ1Ijoib3BlbnN0cmVldG1hcCIsImEiOiJhNVlHd29ZIn0.ti6wATGDWOmCnCYen-Ip7Q"] = 3
|
---|
| 144 | skipEntries[" name differs: http://geo.nls.uk/mapdata2/os/25_inch/scotland_1/{zoom}/{x}/{y}.png"] = 3
|
---|
| 145 | skipEntries[" name differs: http://geo.nls.uk/mapdata3/os/6_inch_gb_1900/{zoom}/{x}/{y}.png"] = 3
|
---|
[9653] | 146 | skipEntries[" name differs: http://geoserver.infobex.hu/Budapest2014/IST/{zoom}/{x}/{y}.jpg"] = 3
|
---|
| 147 | skipEntries[" name differs: http://mapproxy.openmap.lt/ort10lt/g/{zoom}/{x}/{y}.jpeg"] = 3
|
---|
| 148 | skipEntries[" name differs: http://e.tile.openstreetmap.hu/ortofoto2000/{zoom}/{x}/{y}.jpg"] = 3
|
---|
[10077] | 149 | skipEntries[" name differs: http://tools.geofabrik.de/osmi/tiles/routing/{zoom}/{x}/{y}.png"] = 3
|
---|
| 150 | skipEntries[" name differs: http://e.tile.openstreetmap.hu/ortofoto2005/{zoom}/{x}/{y}.jpg"] = 3
|
---|
[10517] | 151 | skipEntries[" name differs: http://gis3.stuttgart.de/wss/service/wms_Luftbilder2011_jpg_internet/guest?FORMAT=image/jpeg&VERSION=1.3.0&SERVICE=WMS&REQUEST=GetMap&Layers=0,1,2,3,4,5,6,7,8&STYLES=default,default,default,default,default,default,default,default,default&CRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 3
|
---|
| 152 | skipEntries[" name differs: https://secure.erlangen.de/arcgiser/services/Luftbilder2013/MapServer/WmsServer?FORMAT=image/bmp&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=Erlangen_ratio5_6.25cm.jp2&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 3
|
---|
[10077] | 153 | skipEntries[" name differs: http://tools.geofabrik.de/osmi/tiles/addresses/{zoom}/{x}/{y}.png"] = 3
|
---|
[10516] | 154 | skipEntries[" name differs: http://{switch:a,b,c}.gps-tile.openstreetmap.org/lines/{zoom}/{x}/{y}.png"] = 3
|
---|
[9658] | 155 | skipEntries[" maxzoom differs: [DE] Bavaria (2 m) - http://geodaten.bayern.de/ogc/ogc_dop200_oa.cgi?FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&Layers=adv_dop200c&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}"] = 3
|
---|
[9505] | 156 | skipEntries[" minzoom differs: [AU] LPI NSW Administrative Boundaries County - http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Administrative_Boundaries/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height}&LAYERS=County&STYLES=&FORMAT=image/png32&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE"] = 3
|
---|
| 157 | skipEntries[" minzoom differs: [AU] LPI NSW Administrative Boundaries NPWS Reserve - http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Administrative_Boundaries/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height}&LAYERS=NPWSReserve&STYLES=&FORMAT=image/png32&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE"] = 3
|
---|
| 158 | skipEntries[" minzoom differs: [AU] LPI NSW Administrative Boundaries Parish - http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Administrative_Boundaries/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height}&LAYERS=Parish&STYLES=&FORMAT=image/png32&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE"] = 3
|
---|
| 159 | skipEntries[" minzoom differs: [AU] LPI NSW Administrative Boundaries Suburb - http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Administrative_Boundaries/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height}&LAYERS=Suburb&STYLES=&FORMAT=image/png32&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE"] = 3
|
---|
| 160 | skipEntries[" minzoom differs: [AU] LPI NSW Imagery - http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Imagery/MapServer/tile/{zoom}/{y}/{x}"] = 3
|
---|
| 161 | skipEntries[" minzoom differs: [AU] LPI NSW Topographic Map - http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Topo_Map/MapServer/tile/{zoom}/{y}/{x}"] = 3
|
---|
| 162 | skipEntries[" minzoom differs: [AU] LPI NSW Administrative Boundaries State Forest - http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Administrative_Boundaries/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height}&LAYERS=StateForest&STYLES=&FORMAT=image/png32&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE"] = 3
|
---|
| 163 | skipEntries[" minzoom differs: [AU] LPI NSW Administrative Boundaries LGA - http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Administrative_Boundaries/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height}&LAYERS=LocalGovernmentArea&STYLES=&FORMAT=image/png32&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE"] = 3
|
---|
| 164 | skipEntries[" minzoom differs: [AU] LPI NSW Base Map - http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Base_Map/MapServer/tile/{zoom}/{y}/{x}"] = 3
|
---|
[10077] | 165 | skipEntries[" country code differs: [EU] OSM Inspector: Boundaries (EU) - http://tools.geofabrik.de/osmi/tiles/boundaries/{zoom}/{x}/{y}.png"] = 3
|
---|
| 166 | skipEntries[" country code differs: [TH] Cambodia, Laos, Thailand, Vietnam bilingual - http://{switch:a,b,c,d}.tile.osm-tools.org/osm_then/{zoom}/{x}/{y}.png"] = 3
|
---|
[9505] | 167 | }
|
---|
[9653] | 168 |
|
---|
[9658] | 169 | void myprintlnfinal(String s) {
|
---|
| 170 | if(outputStream != null) {
|
---|
| 171 | outputStream.write(s);
|
---|
| 172 | outputStream.newLine();
|
---|
| 173 | } else {
|
---|
| 174 | println s;
|
---|
| 175 | }
|
---|
| 176 | }
|
---|
| 177 |
|
---|
[9505] | 178 | void myprintln(String s) {
|
---|
| 179 | if(skipEntries.containsKey(s)) {
|
---|
| 180 | skipCount = skipEntries.get(s)
|
---|
[9658] | 181 | skipEntries.remove(s)
|
---|
[9505] | 182 | }
|
---|
| 183 | if(skipCount) {
|
---|
| 184 | skipCount -= 1;
|
---|
[9658] | 185 | if(options.xhtmlbody || options.xhtml) {
|
---|
| 186 | s = "<pre style=\"margin:3px;color:green\">"+s.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")+"</pre>"
|
---|
| 187 | }
|
---|
[9662] | 188 | if (!options.noskip) {
|
---|
| 189 | return;
|
---|
| 190 | }
|
---|
[9658] | 191 | } else if(options.xhtmlbody || options.xhtml) {
|
---|
| 192 | String color = s.startsWith("***") ? "black" : (s.startsWith("+ ") ? "blue" : "red")
|
---|
| 193 | s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")+"</pre>"
|
---|
[9505] | 194 | }
|
---|
[9658] | 195 | myprintlnfinal(s)
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | void start() {
|
---|
| 199 | if (options.xhtml) {
|
---|
| 200 | myprintlnfinal "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
|
---|
| 201 | myprintlnfinal "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><title>JOSM - EII differences</title></head><body>\n"
|
---|
[9505] | 202 | }
|
---|
| 203 | }
|
---|
[9653] | 204 |
|
---|
[9658] | 205 | void end() {
|
---|
| 206 | for (def s: skipEntries.keySet()) {
|
---|
| 207 | myprintln "+++ Obsolete skip entry: " + s
|
---|
| 208 | }
|
---|
| 209 | if (options.xhtml) {
|
---|
| 210 | myprintlnfinal "</body></html>\n"
|
---|
| 211 | }
|
---|
| 212 | }
|
---|
| 213 |
|
---|
[7726] | 214 | void loadEIIEntries() {
|
---|
| 215 | FileReader fr = new FileReader(eiiInputFile)
|
---|
| 216 | JsonReader jr = Json.createReader(fr)
|
---|
| 217 | eiiEntries = jr.readArray()
|
---|
| 218 | jr.close()
|
---|
[9653] | 219 |
|
---|
[7726] | 220 | for (def e : eiiEntries) {
|
---|
| 221 | def url = getUrl(e)
|
---|
[9653] | 222 | if (url.contains("{z}")) {
|
---|
| 223 | myprintln "+++ EII-URL uses {z} instead of {zoom}: "+url
|
---|
| 224 | url = url.replace("{z}","{zoom}")
|
---|
| 225 | }
|
---|
[9505] | 226 | if (eiiUrls.containsKey(url)) {
|
---|
| 227 | myprintln "+++ EII-URL is not unique: "+url
|
---|
| 228 | } else {
|
---|
| 229 | eiiUrls.put(url, e)
|
---|
| 230 | }
|
---|
[7726] | 231 | }
|
---|
[9505] | 232 | myprintln "*** Loaded ${eiiEntries.size()} entries (EII). ***"
|
---|
[7726] | 233 | }
|
---|
| 234 |
|
---|
| 235 | void loadJosmEntries() {
|
---|
| 236 | def reader = new ImageryReader(josmInputFile)
|
---|
| 237 | josmEntries = reader.parse()
|
---|
[9667] | 238 |
|
---|
[7726] | 239 | for (def e : josmEntries) {
|
---|
| 240 | def url = getUrl(e)
|
---|
[9658] | 241 | if (url.contains("{z}")) {
|
---|
| 242 | myprintln "+++ JOSM-URL uses {z} instead of {zoom}: "+url
|
---|
| 243 | url = url.replace("{z}","{zoom}")
|
---|
| 244 | }
|
---|
[9505] | 245 | if (josmUrls.containsKey(url)) {
|
---|
| 246 | myprintln "+++ JOSM-URL is not unique: "+url
|
---|
| 247 | } else {
|
---|
| 248 | josmUrls.put(url, e)
|
---|
[7726] | 249 | }
|
---|
[9658] | 250 | for (def m : e.getMirrors()) {
|
---|
| 251 | url = getUrl(m)
|
---|
| 252 | if (josmUrls.containsKey(url)) {
|
---|
| 253 | myprintln "+++ JOSM-Mirror-URL is not unique: "+url
|
---|
| 254 | } else {
|
---|
| 255 | josmUrls.put(url, m)
|
---|
| 256 | }
|
---|
| 257 | }
|
---|
[7726] | 258 | }
|
---|
[9505] | 259 | myprintln "*** Loaded ${josmEntries.size()} entries (JOSM). ***"
|
---|
[7726] | 260 | }
|
---|
| 261 |
|
---|
| 262 | List inOneButNotTheOther(Map m1, Map m2) {
|
---|
| 263 | def l = []
|
---|
| 264 | for (def url : m1.keySet()) {
|
---|
| 265 | if (!m2.containsKey(url)) {
|
---|
| 266 | def name = getName(m1.get(url))
|
---|
| 267 | l += " "+getDescription(m1.get(url))
|
---|
| 268 | }
|
---|
| 269 | }
|
---|
| 270 | l.sort()
|
---|
| 271 | }
|
---|
[9667] | 272 |
|
---|
[7726] | 273 | void checkInOneButNotTheOther() {
|
---|
| 274 | def l1 = inOneButNotTheOther(eiiUrls, josmUrls)
|
---|
[9505] | 275 | myprintln "*** URLs found in EII but not in JOSM (${l1.size()}): ***"
|
---|
[9658] | 276 | if (!l1.isEmpty()) {
|
---|
[9516] | 277 | for (def l : l1)
|
---|
[9658] | 278 | myprintln "-"+l
|
---|
[7726] | 279 | }
|
---|
| 280 |
|
---|
[9505] | 281 | if (options.nomissingeii)
|
---|
| 282 | return
|
---|
[7726] | 283 | def l2 = inOneButNotTheOther(josmUrls, eiiUrls)
|
---|
[9505] | 284 | myprintln "*** URLs found in JOSM but not in EII (${l2.size()}): ***"
|
---|
[9658] | 285 | if (!l2.isEmpty()) {
|
---|
[9516] | 286 | for (def l : l2)
|
---|
[9658] | 287 | myprintln "+" + l
|
---|
[7726] | 288 | }
|
---|
| 289 | }
|
---|
[9667] | 290 |
|
---|
[7726] | 291 | void checkCommonEntries() {
|
---|
[9505] | 292 | myprintln "*** Same URL, but different name: ***"
|
---|
[7726] | 293 | for (def url : eiiUrls.keySet()) {
|
---|
| 294 | def e = eiiUrls.get(url)
|
---|
| 295 | if (!josmUrls.containsKey(url)) continue
|
---|
| 296 | def j = josmUrls.get(url)
|
---|
| 297 | if (!getName(e).equals(getName(j))) {
|
---|
[9505] | 298 | myprintln " name differs: $url"
|
---|
| 299 | myprintln " (IEE): ${getName(e)}"
|
---|
| 300 | myprintln " (JOSM): ${getName(j)}"
|
---|
[7726] | 301 | }
|
---|
| 302 | }
|
---|
[9667] | 303 |
|
---|
[9505] | 304 | myprintln "*** Same URL, but different type: ***"
|
---|
[7726] | 305 | for (def url : eiiUrls.keySet()) {
|
---|
| 306 | def e = eiiUrls.get(url)
|
---|
| 307 | if (!josmUrls.containsKey(url)) continue
|
---|
| 308 | def j = josmUrls.get(url)
|
---|
| 309 | if (!getType(e).equals(getType(j))) {
|
---|
[9505] | 310 | myprintln " type differs: ${getName(j)} - $url"
|
---|
| 311 | myprintln " (IEE): ${getType(e)}"
|
---|
| 312 | myprintln " (JOSM): ${getType(j)}"
|
---|
[7726] | 313 | }
|
---|
| 314 | }
|
---|
[9667] | 315 |
|
---|
[9505] | 316 | myprintln "*** Same URL, but different zoom bounds: ***"
|
---|
[7726] | 317 | for (def url : eiiUrls.keySet()) {
|
---|
| 318 | def e = eiiUrls.get(url)
|
---|
| 319 | if (!josmUrls.containsKey(url)) continue
|
---|
| 320 | def j = josmUrls.get(url)
|
---|
| 321 |
|
---|
| 322 | Integer eMinZoom = getMinZoom(e)
|
---|
| 323 | Integer jMinZoom = getMinZoom(j)
|
---|
[9518] | 324 | if (eMinZoom != jMinZoom && !(eMinZoom == 0 && jMinZoom == null)) {
|
---|
[9505] | 325 | myprintln " minzoom differs: ${getDescription(j)}"
|
---|
| 326 | myprintln " (IEE): ${eMinZoom}"
|
---|
| 327 | myprintln " (JOSM): ${jMinZoom}"
|
---|
[7726] | 328 | }
|
---|
| 329 | Integer eMaxZoom = getMaxZoom(e)
|
---|
| 330 | Integer jMaxZoom = getMaxZoom(j)
|
---|
| 331 | if (eMaxZoom != jMaxZoom) {
|
---|
[9505] | 332 | myprintln " maxzoom differs: ${getDescription(j)}"
|
---|
| 333 | myprintln " (IEE): ${eMaxZoom}"
|
---|
| 334 | myprintln " (JOSM): ${jMaxZoom}"
|
---|
[7726] | 335 | }
|
---|
| 336 | }
|
---|
[9667] | 337 |
|
---|
[9505] | 338 | myprintln "*** Same URL, but different country code: ***"
|
---|
[7726] | 339 | for (def url : eiiUrls.keySet()) {
|
---|
| 340 | def e = eiiUrls.get(url)
|
---|
| 341 | if (!josmUrls.containsKey(url)) continue
|
---|
| 342 | def j = josmUrls.get(url)
|
---|
| 343 | if (!getCountryCode(e).equals(getCountryCode(j))) {
|
---|
[9505] | 344 | myprintln " country code differs: ${getDescription(j)}"
|
---|
| 345 | myprintln " (IEE): ${getCountryCode(e)}"
|
---|
| 346 | myprintln " (JOSM): ${getCountryCode(j)}"
|
---|
[7726] | 347 | }
|
---|
| 348 | }
|
---|
[10077] | 349 | /*myprintln "*** Same URL, but different quality: ***"
|
---|
[9505] | 350 | for (def url : eiiUrls.keySet()) {
|
---|
| 351 | def e = eiiUrls.get(url)
|
---|
[9515] | 352 | if (!josmUrls.containsKey(url)) {
|
---|
| 353 | def q = getQuality(e)
|
---|
| 354 | if("best".equals(q)) {
|
---|
| 355 | myprintln " quality best entry not in JOSM for ${getDescription(e)}"
|
---|
| 356 | }
|
---|
| 357 | continue
|
---|
| 358 | }
|
---|
[9505] | 359 | def j = josmUrls.get(url)
|
---|
| 360 | if (!getQuality(e).equals(getQuality(j))) {
|
---|
| 361 | myprintln " quality differs: ${getDescription(j)}"
|
---|
| 362 | myprintln " (IEE): ${getQuality(e)}"
|
---|
| 363 | myprintln " (JOSM): ${getQuality(j)}"
|
---|
| 364 | }
|
---|
[10077] | 365 | }*/
|
---|
[7726] | 366 | }
|
---|
[9667] | 367 |
|
---|
[7726] | 368 | /**
|
---|
| 369 | * Utility functions that allow uniform access for both ImageryInfo and JsonObject.
|
---|
| 370 | */
|
---|
| 371 | static String getUrl(Object e) {
|
---|
| 372 | if (e instanceof ImageryInfo) return e.url
|
---|
| 373 | return e.getString("url")
|
---|
| 374 | }
|
---|
| 375 | static String getName(Object e) {
|
---|
[10517] | 376 | if (e instanceof ImageryInfo) return e.getOriginalName()
|
---|
[7726] | 377 | return e.getString("name")
|
---|
| 378 | }
|
---|
| 379 | static String getType(Object e) {
|
---|
| 380 | if (e instanceof ImageryInfo) return e.getImageryType().getTypeString()
|
---|
| 381 | return e.getString("type")
|
---|
| 382 | }
|
---|
| 383 | static Integer getMinZoom(Object e) {
|
---|
| 384 | if (e instanceof ImageryInfo) {
|
---|
| 385 | int mz = e.getMinZoom()
|
---|
| 386 | return mz == 0 ? null : mz
|
---|
| 387 | } else {
|
---|
| 388 | def ext = e.getJsonObject("extent")
|
---|
| 389 | if (ext == null) return null
|
---|
| 390 | def num = ext.getJsonNumber("min_zoom")
|
---|
| 391 | if (num == null) return null
|
---|
| 392 | return num.intValue()
|
---|
| 393 | }
|
---|
| 394 | }
|
---|
| 395 | static Integer getMaxZoom(Object e) {
|
---|
| 396 | if (e instanceof ImageryInfo) {
|
---|
| 397 | int mz = e.getMaxZoom()
|
---|
| 398 | return mz == 0 ? null : mz
|
---|
| 399 | } else {
|
---|
| 400 | def ext = e.getJsonObject("extent")
|
---|
| 401 | if (ext == null) return null
|
---|
| 402 | def num = ext.getJsonNumber("max_zoom")
|
---|
| 403 | if (num == null) return null
|
---|
| 404 | return num.intValue()
|
---|
| 405 | }
|
---|
| 406 | }
|
---|
| 407 | static String getCountryCode(Object e) {
|
---|
| 408 | if (e instanceof ImageryInfo) return "".equals(e.getCountryCode()) ? null : e.getCountryCode()
|
---|
| 409 | return e.getString("country_code", null)
|
---|
| 410 | }
|
---|
[9505] | 411 | static String getQuality(Object e) {
|
---|
| 412 | //if (e instanceof ImageryInfo) return "".equals(e.getQuality()) ? null : e.getQuality()
|
---|
| 413 | if (e instanceof ImageryInfo) return null
|
---|
| 414 | return e.get("best") ? "best" : null
|
---|
| 415 | }
|
---|
[7726] | 416 | String getDescription(Object o) {
|
---|
| 417 | def url = getUrl(o)
|
---|
| 418 | def cc = getCountryCode(o)
|
---|
| 419 | if (cc == null) {
|
---|
| 420 | def j = josmUrls.get(url)
|
---|
| 421 | if (j != null) cc = getCountryCode(j)
|
---|
| 422 | if (cc == null) {
|
---|
| 423 | def e = eiiUrls.get(url)
|
---|
| 424 | if (e != null) cc = getCountryCode(e)
|
---|
| 425 | }
|
---|
| 426 | }
|
---|
| 427 | if (cc == null) {
|
---|
| 428 | cc = ''
|
---|
| 429 | } else {
|
---|
| 430 | cc = "[$cc] "
|
---|
| 431 | }
|
---|
| 432 | def d = cc + getName(o) + " - " + getUrl(o)
|
---|
| 433 | if (options.shorten) {
|
---|
| 434 | def MAXLEN = 140
|
---|
| 435 | if (d.length() > MAXLEN) d = d.substring(0, MAXLEN-1) + "..."
|
---|
| 436 | }
|
---|
| 437 | return d
|
---|
| 438 | }
|
---|
| 439 | }
|
---|