Changeset 11573 in josm


Ignore:
Timestamp:
2017-02-18T00:11:52+01:00 (19 months ago)
Author:
stoecker
Message:

fix imagery compare date check, add (disabled) date compare

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/SyncEditorImageryIndex.groovy

    r11572 r11573  
    324324            def j = josmUrls.get(url)
    325325            if (!getQuality(e).equals(getQuality(j))) {
    326                 myprintln "  quality differs: ${getDescription(j)}"
    327                 myprintln "     (EII):     ${getQuality(e)}"
    328                 myprintln "     (JOSM):    ${getQuality(j)}"
     326                myprintln "Quality differs (${getQuality(j)} != ${getQuality(e)}): ${getDescription(j)}"
     327            }
     328        }*/
     329        /*myprintln "*** Same URL, but different dates: ***"
     330        for (def url : eiiUrls.keySet()) {
     331            def e = eiiUrls.get(url)
     332            if (!josmUrls.containsKey(url)) continue
     333            def j = josmUrls.get(url)
     334            if (!getDate(e).equals(getDate(j))) {
     335                myprintln "Date differs ('${getDate(j)}' != '${getDate(e)}'): ${getDescription(j)}"
    329336            }
    330337        }*/
     
    423430            }
    424431            def d = getDate(j)
    425             if(d != null) {
     432            if(!d.isEmpty()) {
    426433                def reg = (d =~ /^(\d\d\d\d)(-(\d\d)(-(\d\d))?)?(;(\d\d\d\d)(-(\d\d)(-(\d\d))?)?)?/)
    427434                if(reg == null || reg.count != 1) {
     
    472479    }
    473480    static String getDate(Object e) {
    474         if (e instanceof ImageryInfo) return e.date
    475         def start = e.get("properties").getString("start_date")
    476         def end = e.get("properties").getString("end_date")
    477         if(start != null && end != null)
     481        if (e instanceof ImageryInfo) return e.date ? e.date : ""
     482        def p = e.get("properties")
     483        def start = p.containsKey("start_date") ? p.getString("start_date") : ""
     484        def end = p.containsKey("end_date") ? p.getString("end_date") : ""
     485        if(!start.isEmpty() && !end.isEmpty())
    478486            return start+";"+end
    479         else if(start != null)
     487        else if(!start.isEmpty())
    480488            return start
    481489        else
Note: See TracChangeset for help on using the changeset viewer.