/** * Return the registry name and the code in a string array. * * @param authorityAndSrid a string following the pattern "name:code" * @return an array of two strings (ex. {"EPSG", "4326"}) * @throws RegistryException */ public String[] splitRegistryNameAndCode(String authorityAndSrid) throws RegistryException { String[] registryAndCode = authorityAndSrid.split(":"); if (registryAndCode.length == 2) { return registryAndCode; } else { throw new RegistryException("The registry pattern '" + authorityAndSrid + "' is not supported"); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(ESRI_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the ESRI registry", ex); } } }
@Override public Set<String> getSupportedCodes() throws RegistryException { Statement st; try { st = connection.createStatement(); ResultSet rs = st.executeQuery("SELECT srid from SPATIAL_REF_SYS;"); Set<String> codes = new HashSet<String>(); while (rs.next()) { codes.add(rs.getString(1)); } st.close(); return codes; } catch (SQLException ex) { throw new RegistryException("Cannot load the EPSG registry", ex); } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, NAD83_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the NAD83 registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(IGNF_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the IGNF registry", ex); } } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, NAD27_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the NAD27 registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(NAD27_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the NAD27 registry", ex); } } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(NAD83_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the NAD83 registry", ex); } } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, IGNF_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the IGNF registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(WORLD_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the world registry", ex); } } }
@Override public Set<String> getSupportedCodes() throws RegistryException { try { return projParser.getSupportedCodes(EPSG_REGEX); } catch (IOException ex) { throw new RegistryException("Cannot load the EPSG registry", ex); } } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, ESRI_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the ESRI registry", ex); } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, WORLD_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the world registry", ex); } }
@Override public Map<String, String> getParameters(String code) throws RegistryException { try { Map<String, String> crsParameters = projParser.readParameters(code, EPSG_REGEX); return crsParameters; } catch (IOException ex) { throw new RegistryException("Cannot load the EPSG registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { Statement st; try { st = connection.createStatement(); ResultSet rs = st.executeQuery("SELECT srid from SPATIAL_REF_SYS;"); Set<String> codes = new HashSet<String>(); while (rs.next()) { codes.add(rs.getString(1)); } st.close(); return codes; } catch (SQLException ex) { throw new RegistryException("Cannot load the EPSG registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { Statement st; try { st = connection.createStatement(); ResultSet rs = st.executeQuery("SELECT srid from SPATIAL_REF_SYS;"); Set<String> codes = new HashSet<String>(); while (rs.next()) { codes.add(rs.getString(1)); } st.close(); return codes; } catch (SQLException ex) { throw new RegistryException("Cannot load the EPSG registry", ex); } }
@Override public Set<String> getSupportedCodes() throws RegistryException { Statement st; try { st = connection.createStatement(); ResultSet rs = st.executeQuery("SELECT srid from SPATIAL_REF_SYS;"); Set<String> codes = new HashSet<String>(); while (rs.next()) { codes.add(rs.getString(1)); } st.close(); return codes; } catch (SQLException ex) { throw new RegistryException("Cannot load the EPSG registry", ex); } }
/** * Check if the registry name (ie EPSG, IGNF...) is supported. * * @param registryName (ex : ESPG, IGNF, ESRI) */ public boolean isRegistrySupported(String registryName) throws RegistryException { if (getRegistryManager().contains(registryName.toLowerCase())) { return true; } else { throw new RegistryException("Registry '" + registryName + "' is not supported"); } }
throw new RegistryException("Cannot obtain the CRS parameters", ex);
public CoordinateReferenceSystem getCoordinateReferenceSystem(Identifier identifier) throws RegistryException, CRSException { Map<String,String> params = getParameters(identifier.getAuthorityKey()); if (!identifier.getAuthorityName().equalsIgnoreCase(getRegistryName())) { throw new RegistryException("CRS code '" + identifier.getCode() + "' does not match this registry name : " + getRegistryName()); } if (params == null) { throw new CRSException("Registry '" + getRegistryName() + "' contains no parameter for " + identifier); } // try to set a name from params to the identifier if identifier name is empty if (identifier.getName() == null || identifier.getName().isEmpty()) { String title = params.get(ProjKeyParameters.title); if (title != null && !title.isEmpty()) { identifier = new Identifier(identifier.getAuthorityName(), identifier.getAuthorityKey(), title); } } return CRSHelper.createCoordinateReferenceSystem(identifier, params); }