Changeset 11582 in josm


Ignore:
Timestamp:
2017-02-18T14:14:19+01:00 (8 years ago)
Author:
stoecker
Message:

switch from EII to ELI

Location:
trunk
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r11569 r11582  
    692692        <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};tools/commons-cli-1.3.1.jar"/>
    693693        <echo message="Checking editor imagery difference"/>
    694         <groovy src="scripts/SyncEditorImageryIndex.groovy" classpath="${dist.dir}/josm-custom.jar">
    695                 <!--<arg value="-nomissingeii"/>-->
     694        <groovy src="scripts/SyncEditorLayerIndex.groovy" classpath="${dist.dir}/josm-custom.jar">
     695                <!--<arg value="-nomissingeli"/>-->
    696696        </groovy>
    697697    </target>
  • trunk/scripts/SyncEditorLayerIndex.groovy

    r11577 r11582  
    3030
    3131    List<ImageryInfo> josmEntries;
    32     JsonArray eiiEntries;
    33 
    34     def eiiUrls = new HashMap<String, JsonObject>()
     32    JsonArray eliEntries;
     33
     34    def eliUrls = new HashMap<String, JsonObject>()
    3535    def josmUrls = new HashMap<String, ImageryInfo>()
    3636    def josmMirrors = new HashMap<String, ImageryInfo>()
    3737
    38     static String eiiInputFile = 'imagery.geojson'
     38    static String eliInputFile = 'imagery.geojson'
    3939    static String josmInputFile = 'maps.xml'
    4040    static String ignoreInputFile = 'maps_ignores.txt'
    4141    static FileWriter outputFile = null
    4242    static BufferedWriter outputStream = null
    43     int skipCount = 0;
    44     String skipColor = "greenyellow" // should never be visible
    45     def skipEntries = [:]
    46     def skipColors = [:]
     43    def skip = [:]
    4744
    4845    static def options
     
    5754        script.start()
    5855        script.loadJosmEntries()
    59         script.loadEIIEntries()
     56        script.loadELIEntries()
    6057        script.checkInOneButNotTheOther()
    6158        script.checkCommonEntries()
     
    7572        def cli = new CliBuilder(width: 160)
    7673        cli.o(longOpt:'output', args:1, argName: "output", "Output file, - prints to stdout (default: -)")
    77         cli.e(longOpt:'eii_input', args:1, argName:"eii_input", "Input file for the editor imagery index (json). Default is $eiiInputFile (current directory).")
     74        cli.e(longOpt:'eli_input', args:1, argName:"eli_input", "Input file for the editor imagery index (json). Default is $eliInputFile (current directory).")
    7875        cli.j(longOpt:'josm_input', args:1, argName:"josm_input", "Input file for the JOSM imagery list (xml). Default is $josmInputFile (current directory).")
    7976        cli.i(longOpt:'ignore_input', args:1, argName:"ignore_input", "Input file for the ignore list. Default is $ignoreInputFile (current directory).")
     
    8279        cli.x(longOpt:'xhtmlbody', argName:"xhtmlbody", "create XHTML body for display in a web page")
    8380        cli.X(longOpt:'xhtml', argName:"xhtml", "create XHTML for display in a web page")
    84         cli.m(longOpt:'nomissingeii', argName:"nomissingeii", "don't show missing editor imagery index entries")
     81        cli.m(longOpt:'nomissingeli', argName:"nomissingeli", "don't show missing editor imagery index entries")
    8582        cli.h(longOpt:'help', "show this help")
    8683        options = cli.parse(args)
     
    9087            System.exit(0)
    9188        }
    92         if (options.eii_input) {
    93             eiiInputFile = options.eii_input
     89        if (options.eli_input) {
     90            eliInputFile = options.eli_input
    9491        }
    9592        if (options.josm_input) {
     
    110107
    111108        while((line = fr.readLine()) != null) {
    112             def res = (line =~ /^\|\| *(\d) *\|\| *(EII|Ignore) *\|\| *\{\{\{(.+)\}\}\} *\|\|/)
     109            def res = (line =~ /^\|\| *(ELI|Ignore) *\|\| *\{\{\{(.+)\}\}\} *\|\|/)
    113110            if(res.count)
    114111            {
    115                 skipEntries[res[0][3]] = res[0][1] as int
    116                 if(res[0][2].equals("Ignore")) {
    117                     skipColors[res[0][3]] = "green"
     112                if(res[0][1].equals("Ignore")) {
     113                    skip[res[0][2]] = "green"
    118114                } else {
    119                     skipColors[res[0][3]] = "darkgoldenrod"
     115                    skip[res[0][2]] = "darkgoldenrod"
    120116                }
    121117            }
     
    133129
    134130    void myprintln(String s) {
    135         if(skipEntries.containsKey(s)) {
    136             skipCount = skipEntries.get(s)
    137             skipEntries.remove(s)
    138             if(skipColors.containsKey(s)) {
    139                 skipColor = skipColors.get(s)
    140             } else {
    141                 skipColor = "greenyellow"
    142             }
    143         }
    144         if(skipCount) {
    145             skipCount -= 1;
     131        if(skip.containsKey(s)) {
     132            String color = skip.get(s)
     133            skip.remove(s)
    146134            if(options.xhtmlbody || options.xhtml) {
    147                 s = "<pre style=\"margin:3px;color:"+skipColor+"\">"+s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")+"</pre>"
     135                s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")+"</pre>"
    148136            }
    149137            if (!options.noskip) {
     
    151139            }
    152140        } else if(options.xhtmlbody || options.xhtml) {
    153             String color = s.startsWith("***") ? "black" : ((s.startsWith("+ ") || s.startsWith("+++ EII")) ? "blue" : "red")
     141            String color = s.startsWith("***") ? "black" : ((s.startsWith("+ ") || s.startsWith("+++ ELI")) ? "blue" : "red")
    154142            s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")+"</pre>"
    155143        }
     
    160148        if (options.xhtml) {
    161149            myprintlnfinal "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
    162             myprintlnfinal "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><title>JOSM - EII differences</title></head><body>\n"
     150            myprintlnfinal "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><title>JOSM - ELI differences</title></head><body>\n"
    163151        }
    164152    }
    165153
    166154    void end() {
    167         for (def s: skipEntries.keySet()) {
     155        for (def s: skip.keySet()) {
    168156            myprintln "+++ Obsolete skip entry: " + s
    169157        }
     
    173161    }
    174162
    175     void loadEIIEntries() {
    176         FileReader fr = new FileReader(eiiInputFile)
     163    void loadELIEntries() {
     164        FileReader fr = new FileReader(eliInputFile)
    177165        JsonReader jr = Json.createReader(fr)
    178         eiiEntries = jr.readObject().get("features")
     166        eliEntries = jr.readObject().get("features")
    179167        jr.close()
    180168
    181         for (def e : eiiEntries) {
     169        for (def e : eliEntries) {
    182170            def url = getUrl(e)
    183171            if (url.contains("{z}")) {
    184                 myprintln "+++ EII-URL uses {z} instead of {zoom}: "+url
     172                myprintln "+++ ELI-URL uses {z} instead of {zoom}: "+url
    185173                url = url.replace("{z}","{zoom}")
    186174            }
    187             if (eiiUrls.containsKey(url)) {
    188                 myprintln "+++ EII-URL is not unique: "+url
     175            if (eliUrls.containsKey(url)) {
     176                myprintln "+++ ELI-URL is not unique: "+url
    189177            } else {
    190                 eiiUrls.put(url, e)
    191             }
    192         }
    193         myprintln "*** Loaded ${eiiEntries.size()} entries (EII). ***"
     178                eliUrls.put(url, e)
     179            }
     180        }
     181        myprintln "*** Loaded ${eliEntries.size()} entries (ELI). ***"
    194182    }
    195183
     
    235223
    236224    void checkInOneButNotTheOther() {
    237         def l1 = inOneButNotTheOther(eiiUrls, josmUrls)
    238         myprintln "*** URLs found in EII but not in JOSM (${l1.size()}): ***"
     225        def l1 = inOneButNotTheOther(eliUrls, josmUrls)
     226        myprintln "*** URLs found in ELI but not in JOSM (${l1.size()}): ***"
    239227        if (!l1.isEmpty()) {
    240228            for (def l : l1) {
     
    243231        }
    244232
    245         if (options.nomissingeii)
     233        if (options.nomissingeli)
    246234            return
    247         def l2 = inOneButNotTheOther(josmUrls, eiiUrls)
    248         myprintln "*** URLs found in JOSM but not in EII (${l2.size()}): ***"
     235        def l2 = inOneButNotTheOther(josmUrls, eliUrls)
     236        myprintln "*** URLs found in JOSM but not in ELI (${l2.size()}): ***"
    249237        if (!l2.isEmpty()) {
    250238            for (def l : l2) {
     
    256244    void checkCommonEntries() {
    257245        myprintln "*** Same URL, but different name: ***"
    258         for (def url : eiiUrls.keySet()) {
    259             def e = eiiUrls.get(url)
     246        for (def url : eliUrls.keySet()) {
     247            def e = eliUrls.get(url)
    260248            if (!josmUrls.containsKey(url)) continue
    261249            def j = josmUrls.get(url)
    262250            if (!getName(e).equals(getName(j))) {
    263                 myprintln "  name differs: $url"
    264                 myprintln "     (EII):     ${getName(e)}"
    265                 myprintln "     (JOSM):    ${getName(j)}"
     251                myprintln "* Name differs ('${getName(e)}' != '${getName(j)}'): $url"
    266252            }
    267253        }
    268254
    269255        myprintln "*** Same URL, but different type: ***"
    270         for (def url : eiiUrls.keySet()) {
    271             def e = eiiUrls.get(url)
     256        for (def url : eliUrls.keySet()) {
     257            def e = eliUrls.get(url)
    272258            if (!josmUrls.containsKey(url)) continue
    273259            def j = josmUrls.get(url)
    274260            if (!getType(e).equals(getType(j))) {
    275                 myprintln "  type differs: ${getName(j)} - $url"
    276                 myprintln "     (EII):     ${getType(e)}"
    277                 myprintln "     (JOSM):    ${getType(j)}"
     261                myprintln "* Type differs (${getType(e)} != ${getType(j)}): ${getName(j)} - $url"
    278262            }
    279263        }
    280264
    281265        myprintln "*** Same URL, but different zoom bounds: ***"
    282         for (def url : eiiUrls.keySet()) {
    283             def e = eiiUrls.get(url)
     266        for (def url : eliUrls.keySet()) {
     267            def e = eliUrls.get(url)
    284268            if (!josmUrls.containsKey(url)) continue
    285269            def j = josmUrls.get(url)
     
    288272            Integer jMinZoom = getMinZoom(j)
    289273            if (eMinZoom != jMinZoom  && !(eMinZoom == 0 && jMinZoom == null)) {
    290                 myprintln "  minzoom differs: ${getDescription(j)}"
    291                 myprintln "     (EII):     ${eMinZoom}"
    292                 myprintln "     (JOSM):    ${jMinZoom}"
     274                myprintln "* Minzoom differs (${eMinZoom} != ${jMinZoom}): ${getDescription(j)}"
    293275            }
    294276            Integer eMaxZoom = getMaxZoom(e)
    295277            Integer jMaxZoom = getMaxZoom(j)
    296278            if (eMaxZoom != jMaxZoom) {
    297                 myprintln "  maxzoom differs: ${getDescription(j)}"
    298                 myprintln "     (EII):     ${eMaxZoom}"
    299                 myprintln "     (JOSM):    ${jMaxZoom}"
     279                myprintln "* Maxzoom differs (${eMaxZoom} != ${jMaxZoom}): ${getDescription(j)}"
    300280            }
    301281        }
    302282
    303283        myprintln "*** Same URL, but different country code: ***"
    304         for (def url : eiiUrls.keySet()) {
    305             def e = eiiUrls.get(url)
     284        for (def url : eliUrls.keySet()) {
     285            def e = eliUrls.get(url)
    306286            if (!josmUrls.containsKey(url)) continue
    307287            def j = josmUrls.get(url)
    308288            if (!getCountryCode(e).equals(getCountryCode(j))) {
    309                 myprintln "  country code differs: ${getDescription(j)}"
    310                 myprintln "     (EII):     ${getCountryCode(e)}"
    311                 myprintln "     (JOSM):    ${getCountryCode(j)}"
     289                myprintln "* Country code differs (${getCountryCode(e)} != ${getCountryCode(j)}): ${getDescription(j)}"
    312290            }
    313291        }
    314292        /*myprintln "*** Same URL, but different quality: ***"
    315         for (def url : eiiUrls.keySet()) {
    316             def e = eiiUrls.get(url)
     293        for (def url : eliUrls.keySet()) {
     294            def e = eliUrls.get(url)
    317295            if (!josmUrls.containsKey(url)) {
    318296              def q = getQuality(e)
    319               if("best".equals(q)) {
    320                 myprintln "  quality best entry not in JOSM for ${getDescription(e)}"
     297              if("eli-best".equals(q)) {
     298                myprintln "- Quality best entry not in JOSM for ${getDescription(e)}"
    321299              }
    322300              continue
     
    324302            def j = josmUrls.get(url)
    325303            if (!getQuality(e).equals(getQuality(j))) {
    326                 myprintln "Quality differs (${getQuality(j)} != ${getQuality(e)}): ${getDescription(j)}"
     304                myprintln "* Quality differs (${getQuality(e)} != ${getQuality(j)}): ${getDescription(j)}"
    327305            }
    328306        }*/
    329307        /*myprintln "*** Same URL, but different dates: ***"
    330         for (def url : eiiUrls.keySet()) {
    331             def e = eiiUrls.get(url)
     308        for (def url : eliUrls.keySet()) {
     309            def e = eliUrls.get(url)
    332310            if (!josmUrls.containsKey(url)) continue
    333311            def j = josmUrls.get(url)
    334312            if (!getDate(e).equals(getDate(j))) {
    335                 myprintln "Date differs ('${getDate(j)}' != '${getDate(e)}'): ${getDescription(j)}"
     313                myprintln "* Date differs ('${getDate(e)}' != '${getDate(j)}'): ${getDescription(j)}"
    336314            }
    337315        }*/
     
    348326            }
    349327        }
    350         for (def url : eiiUrls.keySet()) {
    351             def e = eiiUrls.get(url)
     328        for (def url : eliUrls.keySet()) {
     329            def e = eliUrls.get(url)
    352330            def num = 1
    353331            def s = getShapes(e)
    354332            for (def shape : s) {
    355333                def p = shape.getPoints()
    356                 if(!p[0].equals(p[p.size()-1]) && !options.nomissingeii) {
    357                     myprintln "+++ EII shape $num unclosed: ${getDescription(e)}"
     334                if(!p[0].equals(p[p.size()-1]) && !options.nomissingeli) {
     335                    myprintln "+++ ELI shape $num unclosed: ${getDescription(e)}"
    358336                }
    359337                ++num
     
    365343            def js = getShapes(j)
    366344            if(!s.size() && js.size()) {
    367                 if(!options.nomissingeii) {
    368                     myprintln "+ No EII shape: ${getDescription(j)}"
     345                if(!options.nomissingeli) {
     346                    myprintln "+ No ELI shape: ${getDescription(j)}"
    369347                }
    370348            } else if(!js.size() && s.size()) {
     
    396374        }
    397375        myprintln "*** Mismatching icons: ***"
    398         for (def url : eiiUrls.keySet()) {
    399             def e = eiiUrls.get(url)
     376        for (def url : eliUrls.keySet()) {
     377            def e = eliUrls.get(url)
    400378            if (!josmUrls.containsKey(url)) {
    401379                continue
     
    405383            def ie = getIcon(e)
    406384            if(ij != null && ie == null) {
    407                 if(!options.nomissingeii) {
    408                     myprintln "+ No EII icon: ${getDescription(j)}"
     385                if(!options.nomissingeli) {
     386                    myprintln "+ No ELI icon: ${getDescription(j)}"
    409387                }
    410388            } else if(ij == null && ie != null) {
     
    578556            if (j != null) cc = getCountryCode(j)
    579557            if (cc == null) {
    580                 def e = eiiUrls.get(url)
     558                def e = eliUrls.get(url)
    581559                if (e != null) cc = getCountryCode(e)
    582560            }
Note: See TracChangeset for help on using the changeset viewer.