Ignore:
Timestamp:
2012-03-10T17:03:47+01:00 (12 years ago)
Author:
donvip
Message:

opendata: CSV robustness, add British national grid projection

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

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/resources/org/geotools/referencing/crs/epsg.properties

    r28000 r28033  
    101101#27593=PROJCS["NTF (Paris) / Sud France (deprecated)",GEOGCS["NTF (Paris)",DATUM["Nouvelle_Triangulation_Francaise_Paris",SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936269,AUTHORITY["EPSG","7011"]],TOWGS84[-168,-60,320,0,0,0,0],AUTHORITY["EPSG","6807"]],PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903"]],UNIT["grad",0.01570796326794897,AUTHORITY["EPSG","9105"]],AUTHORITY["EPSG","4807"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Lambert_Conformal_Conic_1SP"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",0],PARAMETER["scale_factor",0.999877499],PARAMETER["false_easting",600000],PARAMETER["false_northing",200000],AUTHORITY["EPSG","27593"],AXIS["X",EAST],AXIS["Y",NORTH]]
    102102#27594=PROJCS["NTF (Paris) / Corse (deprecated)",GEOGCS["NTF (Paris)",DATUM["Nouvelle_Triangulation_Francaise_Paris",SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936269,AUTHORITY["EPSG","7011"]],TOWGS84[-168,-60,320,0,0,0,0],AUTHORITY["EPSG","6807"]],PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903"]],UNIT["grad",0.01570796326794897,AUTHORITY["EPSG","9105"]],AUTHORITY["EPSG","4807"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Lambert_Conformal_Conic_1SP"],PARAMETER["latitude_of_origin",46.85],PARAMETER["central_meridian",0],PARAMETER["scale_factor",0.99994471],PARAMETER["false_easting",234.358],PARAMETER["false_northing",185861.369],AUTHORITY["EPSG","27594"],AXIS["X",EAST],AXIS["Y",NORTH]]
     103
     10427700=PROJCS["OSGB 1936 / British National Grid", GEOGCS["OSGB 1936", DATUM["OSGB 1936", SPHEROID["Airy 1830", 6377563.396, 299.3249646, AUTHORITY["EPSG","7001"]], TOWGS84[446.448, -125.157, 542.06, 0.15, 0.247, 0.842, -20.489], AUTHORITY["EPSG","6277"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4277"]], PROJECTION["Transverse_Mercator", AUTHORITY["EPSG","9807"]], PARAMETER["central_meridian", -2.0], PARAMETER["latitude_of_origin", 49.0], PARAMETER["scale_factor", 0.9996012717], PARAMETER["false_easting", 400000.0], PARAMETER["false_northing", -100000.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","27700"]]
    103105
    10410631300=PROJCS["Belge 1972 / Belge Lambert 72", GEOGCS["Belge 1972", DATUM["Reseau National Belge 1972", SPHEROID["International 1924", 6378388.0, 297.0, AUTHORITY["EPSG","7022"]], TOWGS84[-106.8686, 52.2978, -103.7239, 0.3366, 0.457, -1.8422, -1.2747], AUTHORITY["EPSG","6313"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4313"]], PROJECTION["Lambert_Conformal_Conic_2SP_Belgium", AUTHORITY["EPSG","9803"]], PARAMETER["central_meridian", 4.356939722222222], PARAMETER["latitude_of_origin", 90.0], PARAMETER["standard_parallel_1", 49.833333333333336], PARAMETER["false_easting", 150000.01256], PARAMETER["false_northing", 5400088.4378], PARAMETER["standard_parallel_2", 51.16666666666667], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","31300"]]
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/OdConstants.java

    r28022 r28033  
    123123     * Coordinates fields
    124124     */
    125     public static final String X_STRING = "X|LON|LONGI|LONGITUDE";
    126     public static final String Y_STRING = "Y|LAT|LATI|LATITUDE";
     125    public static final String X_STRING = "X|LON|LONGI|LONGITUDE|EASTING";
     126    public static final String Y_STRING = "Y|LAT|LATI|LATITUDE|NORTHING";
    127127   
    128128    // The list of all ProjectionPatterns (filled at each constrcutor call)
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReader.java

    r28000 r28033  
    3434        private BufferedReader reader;
    3535        private String line;
    36        
     36
    3737        public CsvReader(AbstractDataSetHandler handler) {
     38                this(handler, ";");
     39        }
     40
     41        public CsvReader(AbstractDataSetHandler handler, String defaultSep) {
    3842                super(handler);
    3943                this.charset = handler != null && handler.getCsvCharset() != null ? handler.getCsvCharset() : Charset.forName(UTF8);
    40                 this.sep = handler != null && handler.getCsvSeparator() != null ? handler.getCsvSeparator() : ";";
     44                this.sep = handler != null && handler.getCsvSeparator() != null ? handler.getCsvSeparator() : defaultSep;
    4145        }
    4246       
    4347        public static DataSet parseDataSet(InputStream in, AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException {
    44                 return new CsvReader(handler).parse(in, instance);
     48                CsvReader csvReader = new CsvReader(handler);
     49                try {
     50                        return csvReader.parse(in, instance);
     51                } catch (IllegalArgumentException e) {
     52                        if (handler == null) {
     53                                // If default sep has been used, try comma
     54                                System.out.println(e.getMessage());
     55                                CsvReader newReader = new CsvReader(handler, ",");
     56                                newReader.initResources(in, instance);
     57                                newReader.line = csvReader.line;
     58                                return newReader.doParse(newReader.splitLine(), instance);
     59                        } else {
     60                                throw e;
     61                        }
     62                }
    4563        }
    4664
     
    5573        protected String[] readLine(ProgressMonitor progressMonitor) throws IOException {
    5674                line = reader.readLine();
     75                return splitLine();
     76        }
     77       
     78        private final String[] splitLine() {
    5779                if (line != null) {
    5880                        return OdUtils.stripQuotes(line.split(sep), sep);
Note: See TracChangeset for help on using the changeset viewer.