void doSetupBounds(ResourceInfo rinfo, Object data) throws IOException { // setup the native bbox if needed if (rinfo.getNativeBoundingBox() == null) { ReferencedEnvelope bounds = getNativeBounds(rinfo, data); rinfo.setNativeBoundingBox(bounds); } // setup the geographic bbox if missing and we have enough info rinfo.setLatLonBoundingBox(getLatLonBounds(rinfo.getNativeBoundingBox(), rinfo.getCRS())); }
private ReferencedEnvelope aggregateEnvelopes(LayerInfo... layers) { ReferencedEnvelope eoExpected = new ReferencedEnvelope( layers[0].getResource().getNativeBoundingBox(), layers[0].getResource().getCRS()); for (int i = 1; i < layers.length; i++) { eoExpected.expandToInclude(layers[i].getResource().getNativeBoundingBox()); } return eoExpected; } }
} else if (!namespace.equals(other.getNamespace())) return false; if (nativeBoundingBox == null) { if (other.getNativeBoundingBox() != null) return false; } else if (!nativeBoundingBox.equals(other.getNativeBoundingBox())) return false; if (nativeCRS == null) { if (other.getNativeCRS() != null) return false;
expect(r.getLatLonBoundingBox()).andReturn(latLonEnvelope).anyTimes(); expect(r.getNativeBoundingBox()).andReturn(envelope).anyTimes();
boolean computeLatLonBoundingBox(ImportTask task, boolean force) throws Exception { ResourceInfo r = task.getLayer().getResource(); if (force || r.getLatLonBoundingBox() == null && r.getNativeBoundingBox() != null) { CoordinateReferenceSystem nativeCRS = CRS.decode(r.getSRS()); ReferencedEnvelope nativeBbox = new ReferencedEnvelope(r.getNativeBoundingBox(), nativeCRS); r.setLatLonBoundingBox(nativeBbox.transform(CRS.decode("EPSG:4326"), true)); return true; } return false; }
boolean computeLatLonBoundingBox(ImportTask task, boolean force) throws Exception { ResourceInfo r = task.getLayer().getResource(); if (force || r.getLatLonBoundingBox() == null && r.getNativeBoundingBox() != null) { CoordinateReferenceSystem nativeCRS = CRS.decode(r.getSRS()); ReferencedEnvelope nativeBbox = new ReferencedEnvelope(r.getNativeBoundingBox(), nativeCRS); r.setLatLonBoundingBox(nativeBbox.transform(CRS.decode("EPSG:4326"), true)); return true; } return false; }
public SimpleFeatureType apply(ImportTask task, DataStore dataStore, SimpleFeatureType featureType) throws Exception { //update the layer metadata ResourceInfo r = task.getLayer().getResource(); r.setNativeCRS(target); r.setSRS(CRS.lookupIdentifier(target, true)); if (r.getNativeBoundingBox() != null) { r.setNativeBoundingBox(r.getNativeBoundingBox().transform(target, true)); } //retype the schema return SimpleFeatureTypeBuilder.retype(featureType, target); }
public SimpleFeatureType apply( ImportTask task, DataStore dataStore, SimpleFeatureType featureType) throws Exception { // update the layer metadata ResourceInfo r = task.getLayer().getResource(); r.setNativeCRS(target); r.setSRS(CRS.lookupIdentifier(target, true)); if (r.getNativeBoundingBox() != null) { r.setNativeBoundingBox(r.getNativeBoundingBox().transform(target, true)); } // retype the schema return SimpleFeatureTypeBuilder.retype(featureType, target); }
.equals(resource.getProjectionPolicy()); boolean changedNativeBounds = message.getNativeBoundingBox() == null || !message.getNativeBoundingBox() .equals(resource.getNativeBoundingBox()); boolean changedLatLonBounds = message.getLatLonBoundingBox() == null message.setLatLonBoundingBox( builder.getLatLonBounds( message.getNativeBoundingBox(), resolveCRS(message.getSRS()))); } catch (IOException e) { String errorMessage =
boolean changedProjection = message.getSRS() != null; boolean changedProjectionPolicy = message.getProjectionPolicy() != null; boolean changedNativeBounds = message.getNativeBoundingBox() != null; boolean changedLatLonBounds = message.getLatLonBoundingBox() != null; boolean changedNativeInterpretation = changedProjectionPolicy || changedProjection; try { resource.setLatLonBoundingBox(builder.getLatLonBounds( resource.getNativeBoundingBox(), resolveCRS(resource.getSRS()))); } catch (IOException e) {
nativeBounds = getLayerInfo().getResource().getNativeBoundingBox(); } else { nativeBounds = getLayerGroupInfo().getBounds();
if (resourceInfo.getNativeBoundingBox() == null || resourceInfo.getNativeBoundingBox().isEmpty() || Boolean.TRUE.equals(resourceInfo.getMetadata().get("recalculate-bounds")) || "true".equals(resourceInfo.getMetadata().get("recalculate-bounds"))) {
@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()); } }
useNativeBounds = reqSRS.equalsIgnoreCase(layerSRS) && layers.get(i).getResource().getNativeBoundingBox() != null; } else { useNativeBounds = false;
ReferencedEnvelope emptyBounds = new ReferencedEnvelope(); emptyBounds.setToNull(); assertTrue("Unexpected bounding box", emptyBounds.equals(resource.getNativeBoundingBox())); "Bounding box not updated", emptyBounds.equals(resource.getNativeBoundingBox())); FeatureTypeInfo fti = (FeatureTypeInfo) resource; assertEquals("Invalid type name", "sample", fti.getName());
if (r.getNativeBoundingBox() == null) { task.setState(ImportTask.State.NO_BOUNDS); return false;
if (r.getNativeBoundingBox() == null) { task.setState(ImportTask.State.NO_BOUNDS); return false;
ft.setStyles(layer.getDefaultStyle().prefixedName()); ft.setSrs(layer.getResource().getSRS()); ft.setBbox(bboxToString(layer.getResource().getNativeBoundingBox())); ft.setLatLonBbox(bboxToString(layer.getResource().getLatLonBoundingBox()));
.getNativeBoundingBox() .equals(l2.getResource().getNativeBoundingBox())); assertTrue( CRS.equalsIgnoreMetadata( l2.getResource().getNativeCRS(), l2.getResource().getNativeBoundingBox().getCoordinateReferenceSystem()));
: "" : ""); if (res.getNativeBoundingBox() != null) { source.setBounds(new Bounds(res.getNativeBoundingBox())); source.setNativeName(obj.getNativeName()); source.setStore(obj.getStore() != null ? obj.getStore().getName() : ""); if (obj.getNativeBoundingBox() != null) { source.setGeographicBunds(new Bounds(obj.getNativeBoundingBox()));