public static int getSRID ( File prjFile ) throws IOException { int srid = 0 ; if ( prjFile == null ) { log . debug ( "This prj file is null. \n A default srid equals to 0 will be added." ) ; } else { PrjParser parser = new PrjParser ( ) ; String prjString = readPRJFile ( prjFile ) ; if ( ! prjString . isEmpty ( ) ) { Map < String , String > p = parser . getParameters ( prjString ) ; String authorityWithCode = p . get ( PrjKeyParameters . REFNAME ) ; if ( authorityWithCode != null ) { String [ ] authorityNameWithKey = authorityWithCode . split ( ":" ) ; srid = Integer . valueOf ( authorityNameWithKey [ 1 ] ) ; } } else { log . debug ( "The prj is empty. \n A default srid equals to 0 will be added." ) ; } } return srid ; }
Return the SRID value stored in a prj file