private int readCRS ( JsonParser jp ) throws IOException , SQLException { int srid = 0 ; jp . nextToken ( ) ; //START_OBJECT { jp . nextToken ( ) ; // crs type jp . nextToken ( ) ; // crs name String firstField = jp . getText ( ) ; if ( firstField . equalsIgnoreCase ( GeoJsonField . NAME ) ) { jp . nextToken ( ) ; // crs properties jp . nextToken ( ) ; //START_OBJECT { jp . nextToken ( ) ; // crs name jp . nextToken ( ) ; // crs value String crsURI = jp . getText ( ) ; String [ ] split = crsURI . toLowerCase ( ) . split ( GeoJsonField . CRS_URN_EPSG ) ; if ( split != null ) { srid = Integer . valueOf ( split [ 1 ] ) ; } else { log . warn ( "The CRS URN " + crsURI + " is not supported." ) ; } jp . nextToken ( ) ; //END_OBJECT } jp . nextToken ( ) ; //END_OBJECT } jp . nextToken ( ) ; //Go to features } else if ( firstField . equalsIgnoreCase ( GeoJsonField . LINK ) ) { log . warn ( "Linked CRS is not supported." ) ; jp . nextToken ( ) ; jp . nextToken ( ) ; jp . nextToken ( ) ; //END_OBJECT } jp . nextToken ( ) ; //END_OBJECT } jp . nextToken ( ) ; //Go to features } else { throw new SQLException ( "Malformed GeoJSON CRS element." ) ; } return srid ; }
Reads the CRS element and return the database SRID .