crs = resource.getNativeCRS(); } else { crs = resource.getCRS();
} else if (!nativeBoundingBox.equals(other.getNativeBoundingBox())) return false; if (nativeCRS == null) { if (other.getNativeCRS() != null) return false; } else if (!CRS.equalsIgnoreMetadata(nativeCRS, other.getNativeCRS())) return false; if (nativeName == null) { if (other.getNativeName() != null) return false;
expect(r.getSRS()).andReturn(srs).anyTimes(); try { expect(r.getNativeCRS()).andReturn(CRS.decode(srs)); } catch (Exception e) { throw new RuntimeException(e);
/** * Retrieves the native {@link CoordinateReferenceSystem} for the provided {@link ResourceInfo}. * * @param resourceInfo * @return the native {@link CoordinateReferenceSystem} for the provided {@link ResourceInfo}. * @throws IOException in case something bad happems! */ static CoordinateReferenceSystem getNativeCRS(ResourceInfo resourceInfo) throws IOException { // prepare native CRS ProjectionPolicy pp = resourceInfo.getProjectionPolicy(); if (pp == null || pp == ProjectionPolicy.FORCE_DECLARED) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "PropjectionPolicy null or FORCE_DECLARED"); } return resourceInfo.getCRS(); } else { return resourceInfo.getNativeCRS(); } }
final CoordinateReferenceSystem sourceCrs; CoordinateReferenceSystem nativeCrs = resource.getNativeCRS(); if (nativeCrs == null) {
@Override protected void onClick(AjaxRequestTarget target) { popupWindow.setInitialHeight(375); popupWindow.setInitialWidth(525); LayerSummary summary = (LayerSummary) getDefaultModel().getObject(); CoordinateReferenceSystem crs = summary.getLayer().getResource().getNativeCRS(); popupWindow.setContent(new CRSPanel.WKTPanel(popupWindow.getContentId(), crs)); if (crs != null) { popupWindow.setTitle(crs.getName().toString()); } popupWindow.show(target); } };
@Override public void apply(ImportTask task, ImportData data) throws Exception { // let the transform run super.apply(task, data); // see if we need to update the layer definition, we just changed the CRS after all LayerInfo layer = task.getLayer(); ResourceInfo resource = layer.getResource(); String originalSRS = resource.getSRS(); // do so only if it's a direct import if (layer.getId() != null || resource == null || resource.getCatalog() == null) { return; } DataFormat format = DataFormat.lookup(((FileData) data).getFile()); List<ImportTask> tasks = format.list(data, resource.getCatalog(), new ProgressMonitor()); if (tasks == null || tasks.isEmpty()) { return; } LayerInfo updatedLayer = tasks.get(0).getLayer(); ResourceInfo updatedResource = updatedLayer.getResource(); String updatedSRS = updatedResource.getSRS(); // check if the layer srs is incompatible with the one we just reprojected to, update if // necessary if (originalSRS == null || (!originalSRS.equals(updatedSRS) && updatedSRS != null)) { resource.setSRS(updatedSRS); resource.setNativeCRS(updatedResource.getNativeCRS()); resource.setNativeBoundingBox(updatedResource.getNativeBoundingBox()); resource.setLatLonBoundingBox(updatedResource.getLatLonBoundingBox()); } }
(layer.getResource().getNativeCRS() != null) && (defaultSRS != null)) !geometryless) if (layer.getResource().getNativeCRS() == null)
&& (covLayer.getResource().getNativeCRS() != null) && (defaultSRS != null)) { covLayer.getResource().setSRS(defaultSRS); status = DUPLICATE; } else if ((covLayer.getResource().getSRS() == null) && (defaultSRS == null)) { if (covLayer.getResource().getNativeCRS() == null) { status = MISSING_NATIVE_CRS; } else {
assertTrue( CRS.equalsIgnoreMetadata( CRS.decode("EPSG:26713"), l1.getResource().getNativeCRS())); assertEquals("EPSG:26713", l1.getResource().getSRS()); CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), l2.getResource().getNativeCRS())); assertEquals("EPSG:4326", l2.getResource().getSRS()); assertTrue( CRS.equalsIgnoreMetadata( l2.getResource().getNativeCRS(), l2.getResource().getNativeBoundingBox().getCoordinateReferenceSystem())); CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), l2.getResource().getNativeCRS())); assertEquals("EPSG:4326", l2.getResource().getSRS());