Changeset 33049 in osm


Ignore:
Timestamp:
2016-11-03T21:49:11+01:00 (8 years ago)
Author:
donvip
Message:

fix #josm13821 - fail to open spreadsheet with several possible projection columns

Location:
applications/editors/josm/plugins/opendata
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java

    r32898 r33049  
    3535
    3636    private static final String COOR = "(\\-?\\d+(?:[\\.,]\\d+)?)";
    37     private static final Pattern LATLON_PATTERN = Pattern.compile("^"+COOR+"[,;]?\\s*"+COOR+"$");
     37    // Lat/lon pattern with optional altitude and precision
     38    private static final Pattern LATLON_PATTERN = Pattern.compile(
     39            "^"+COOR+"[,;\\s]\\s*"+COOR+"(?:[,;\\s]\\s*"+COOR+"(?:[,;\\s]\\s*"+COOR+")?)?$");
    3840
    3941    protected final SpreadSheetHandler handler;
     
    220222                    if (!coordinate) {
    221223                        if (!fields[i].isEmpty()) {
    222                             nodes.values().iterator().next().put(header[i], fields[i]);
     224                            for (Node n : nodes.values()) {
     225                                n.put(header[i], fields[i]);
     226                            }
    223227                        }
    224228                    }
     
    232236                EastNorth en = ens.get(c);
    233237                if (en.isValid()) {
    234                     n.setCoor(c.proj != null && !handlerOK ? c.proj.eastNorth2latlon(en) : handler.getCoor(en, fields));
     238                    n.setCoor(c.proj != null && !handlerOK ? c.proj.eastNorth2latlon(en) : handler != null ? handler.getCoor(en, fields) : null);
    235239                } else {
    236240                    Main.warn("Skipping line "+lineNumber+" because no valid coordinates have been found at columns "+c);
Note: See TracChangeset for help on using the changeset viewer.