Hi Peppe,

You're right, I found 171 srid in srid2prj which are not in pe_list_projcs_geogcs.zip.

Can you remember where the srid2prj file comes from ? And can you telle me which projection you use which are not in pe_list_projcs_geogcs.zip (just curious).

Using several reference file is far from ideal, but until we find a better option, your proposition seems reasonable to me.

Michaël 


envoyé : 18 août 2022 à 09:55
de : Giuseppe Aruta <giuseppe.ar...@gmail.com>
à : OpenJump develop and use <jump-pilot-devel@lists.sourceforge.net>
objet : [JPP-Devel] OpenJUMP throws a null point exception if coord_ref_sys is found


Hi all,
with the new OJ 2.1 adopted an external file (coord_ref_sys) to read OGC code on saving to.prj file (shapefile).  Reading code is related to the method EsriProj.findProj(...)
If the external coord_ref_sys file is not found, when I try to save to shapefile, OJ throws an exception and the file cannot be saved (no problem with GML).

Until OpenJUMP 1.16, the process to generate OGC code was related to the method SridLookupTable.getOGCWKTFromWkidCode(...) which reads a text file integrated into OpenJUMP (srid2prj.txt) with all the prj codes (even if related to some years ago).

To avoid the previous error, my proposal is, in the file ShapeFileWriter
substitute method:

 private String getPrjString(String code) throws Exception {
        try {
           int srid = Integer.parseInt(code);
           return EsriProj.findProj(srid);
        } catch(IOException e) {
            Logger.warn(e);
            return null;
        }
    }


with method:

    private String getPrjString(String code) throws Exception {
        try {
        int srid = Integer.parseInt(code);
        return EsriProj.findProj(srid);
        } catch(IOException e) {
            return SridLookupTable.getOGCWKTFromWkidCode(code);
        } catch (Exception e) {
        Logger.warn(e);
            return null;
        }
    }
  

Note that   SridLookupTable.getOGCWKTFromWkidCode(...) and srid2prj.txt)  are used also on saving sextante raster to export a .prj or .aux file with all the projection info

Best ragards

Peppe
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to