Changeset 13602 in josm for trunk/scripts


Ignore:
Timestamp:
2018-04-07T20:42:34+02:00 (19 months ago)
Author:
Don-vip
Message:

see #16129 - projections rework for new ESRI file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/BuildProjectionDefinitions.java

    r13599 r13602  
    1313import java.util.Map;
    1414import java.util.TreeMap;
     15import java.util.regex.Matcher;
     16import java.util.regex.Pattern;
    1517
    1618import org.openstreetmap.josm.data.projection.CustomProjection;
     
    8183        if (list.isEmpty())
    8284            throw new AssertionError("EPSG file seems corrupted");
     85        Pattern badDmsPattern = Pattern.compile("(\\d+(?:\\.\\d+)?d\\d+(?:\\.\\d+)?')(N|S|E|W)");
    8386        for (ProjectionDefinition pd : list) {
    84             map.put(pd.code, pd);
     87            // DMS notation without second causes problems with cs2cs, add 0"
     88            Matcher matcher = badDmsPattern.matcher(pd.definition);
     89            StringBuffer sb = new StringBuffer();
     90            while (matcher.find()) {
     91                matcher.appendReplacement(sb, matcher.group(1) + "0\"" + matcher.group(2));
     92            }
     93            matcher.appendTail(sb);
     94            map.put(pd.code, new ProjectionDefinition(pd.code, pd.name, sb.toString()));
    8595        }
    8696    }
     
    113123                }
    114124            }
    115             out.write("## ESRI-specific projections (source: proj.4):\n");
     125            out.write("## ESRI-specific projections (source: ESRI):\n");
    116126            for (ProjectionDefinition pd : esriProj4.values()) {
    117127                pd = new ProjectionDefinition(pd.code, "ESRI: " + pd.name, pd.definition);
     
    194204            result = false;
    195205            noDeprecated++;
     206        }
     207
     208        // exclude projections failing
     209        if (Arrays.asList("EPSG:53025", "EPSG:54025", "EPSG:65062",
     210                "EPSG:102061", "EPSG:102062", "EPSG:102121", "EPSG:102212", "EPSG:102366", "EPSG:102445",
     211                "EPSG:102491", "EPSG:102591", "EPSG:102631", "EPSG:103232", "EPSG:103235", "EPSG:103238",
     212                "EPSG:103241", "EPSG:103371", "EPSG:103471", "EPSG:103474", "EPSG:103475"
     213                ).contains(pd.code)) {
     214            // 53025/54025: Unsuitable parameters 'lat_1' and 'lat_2' for two point method
     215            // Others: cs2cs errors to investigate
     216            result = false;
    196217        }
    197218
Note: See TracChangeset for help on using the changeset viewer.