Changeset 28982 in osm


Ignore:
Timestamp:
2012-11-25T01:07:01+01:00 (12 years ago)
Author:
donvip
Message:

[josm_opendata] Robustness to invalid EPSG database entries

File:
1 edited

Legend:

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

    r28191 r28982  
    254254                                // Find matching CRS with Bursa Wolf parameters in EPSG database
    255255                                for (String code : CRS.getAuthorityFactory(false).getAuthorityCodes(ProjectedCRS.class)) {
    256                                         CoordinateReferenceSystem candidate = CRS.decode(code);
    257                                         if (candidate instanceof AbstractCRS && crs instanceof AbstractIdentifiedObject) {
    258                                                
    259                                                 Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE,
    260                                                                 Main.pref.getDouble(PREF_CRS_COMPARISON_TOLERANCE, DEFAULT_CRS_COMPARISON_TOLERANCE));
    261                                                 if (((AbstractCRS)candidate).equals((AbstractIdentifiedObject)crs, false)) {
    262                                                         System.out.println("Found a potential CRS: "+candidate.getName());
    263                                                         candidates.add(candidate);
    264                                                 } else if (Main.pref.getBoolean(PREF_CRS_COMPARISON_DEBUG, false)) {
    265                                                         compareDebug(crs, candidate);
    266                                                 }
    267                                                 Hints.removeSystemDefault(Hints.COMPARISON_TOLERANCE);
    268                                         }
     256                                    try {
     257                                        CoordinateReferenceSystem candidate = CRS.decode(code);
     258                                        if (candidate instanceof AbstractCRS && crs instanceof AbstractIdentifiedObject) {
     259                                               
     260                                                Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE,
     261                                                                Main.pref.getDouble(PREF_CRS_COMPARISON_TOLERANCE, DEFAULT_CRS_COMPARISON_TOLERANCE));
     262                                                if (((AbstractCRS)candidate).equals((AbstractIdentifiedObject)crs, false)) {
     263                                                        System.out.println("Found a potential CRS: "+candidate.getName());
     264                                                        candidates.add(candidate);
     265                                                } else if (Main.pref.getBoolean(PREF_CRS_COMPARISON_DEBUG, false)) {
     266                                                        compareDebug(crs, candidate);
     267                                                }
     268                                                Hints.removeSystemDefault(Hints.COMPARISON_TOLERANCE);
     269                                        }
     270                                    } catch (FactoryException ex) {
     271                                        // Silently ignore exceptions
     272                                        //System.err.println("Warning: cannot decode "+code+". "+ex.getMessage());
     273                                    }
    269274                                }
    270275                               
Note: See TracChangeset for help on using the changeset viewer.