Refine search
return new GeneralEnvelope(envelope); targetEnvelope = CRS.transform(envelope, targetCRS); } else { targetEnvelope = new GeneralEnvelope(envelope); targetEnvelope.setCoordinateReferenceSystem(targetCRS);
envelope = new GeneralEnvelope(coverageBounds); } else { envelope = new GeneralEnvelope(env); envelope.setCoordinateReferenceSystem(destCRS);
CRS.transform(gridToWorldCorner, new GeneralEnvelope(testRange.getBounds())); testEnvelope.setCoordinateReferenceSystem(reader.getCoordinateReferenceSystem());
/** * Constructs a new grid geometry identical to the specified one except for the CRS. Note that * this constructor just defines the CRS; it does <strong>not</strong> reproject the envelope. * For this reason, this constructor should not be public. It is for internal use by {@link * GridCoverageFactory} only. */ GeneralGridGeometry(final GeneralGridGeometry gm, final CoordinateReferenceSystem crs) { gridRange = gm.gridRange; // Do not clone; we assume it is safe to share. gridToCRS = gm.gridToCRS; cornerToCRS = gm.cornerToCRS; envelope = new GeneralEnvelope(gm.envelope); envelope.setCoordinateReferenceSystem(crs); }
minCP[0] + (envelope.getSpan(0) / 20.0), minCP[1] + (envelope.getSpan(1) / 20.0) }; final GeneralEnvelope subEnvelope = new GeneralEnvelope(minCP, maxCP); subEnvelope.setCoordinateReferenceSystem(reader.getCoordinateReferenceSystem());
private void setEnvelopeFromTransform(AffineTransform tempTransform) throws TransformException { final GeneralEnvelope envelope = CRS.transform( ProjectiveTransform.create(tempTransform), new GeneralEnvelope(nativeGridRange)); envelope.setCoordinateReferenceSystem(crs); setCoverageEnvelope(envelope); }
new GeneralEnvelope(new double[] {xMin, yMin}, new double[] {xMax, yMax}); originalEnvelope.setCoordinateReferenceSystem(crs);
/** * @param inputEnvelope * @return * @throws Exception */ static GeneralEnvelope reprojectEnvelope( GeneralEnvelope inputEnvelope, final CoordinateReferenceSystem outputCRS) throws Exception { GeneralEnvelope outputEnvelope = null; CoordinateReferenceSystem inputCRS = inputEnvelope.getCoordinateReferenceSystem(); if (!CRS.equalsIgnoreMetadata(inputCRS, outputCRS)) { outputEnvelope = CRS.transform(inputEnvelope, outputCRS); outputEnvelope.setCoordinateReferenceSystem(outputCRS); } // simple copy if (outputEnvelope == null) { outputEnvelope = new GeneralEnvelope(inputEnvelope); outputEnvelope.setCoordinateReferenceSystem(inputCRS); } return null; }
/** * * <!-- begin-user-doc --> * ATTENTION: I'm assuming a LatLon envelope here. * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { List positions = node.getChildren("pos"); if (!positions.isEmpty() && (positions.size() == 2)) { Node n1 = (Node) positions.get(0); Node n2 = (Node) positions.get(1); GeneralDirectPosition p1 = (GeneralDirectPosition) n1.getValue(); GeneralDirectPosition p2 = (GeneralDirectPosition) n2.getValue(); GeneralEnvelope envelope = new GeneralEnvelope(p1, p2); for (AttributeInstance att : instance.getAttributes()) { if (att.getName().equals("srsName")) envelope.setCoordinateReferenceSystem(CRS.decode(att.getText())); } return envelope; } if (!positions.isEmpty()) { throw new RuntimeException("Envelope can have only two coordinates"); } throw new RuntimeException("Could not find coordinates for envelope"); }
/** * * <!-- begin-user-doc --> * ATTENTION: I'm assuming a LatLon envelope here. * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { List positions = node.getChildren("pos"); if (!positions.isEmpty() && (positions.size() == 2)) { Node n1 = (Node) positions.get(0); Node n2 = (Node) positions.get(1); GeneralDirectPosition p1 = (GeneralDirectPosition) n1.getValue(); GeneralDirectPosition p2 = (GeneralDirectPosition) n2.getValue(); GeneralEnvelope envelope = new GeneralEnvelope(p1, p2); if (p1.getDimension() == 2 && p2.getDimension() == 2) { envelope.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84); return envelope; } else if (p1.getDimension() > 2 && p2.getDimension() > 2) { envelope.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84_3D); return envelope; } } if (!positions.isEmpty()) { throw new RuntimeException("Envelope can have only two coordinates"); } throw new RuntimeException("Could not find coordinates for envelope"); }
@Override public GeneralEnvelope getOriginalEnvelope(String coverageName) { coverageName = checkUnspecifiedCoverage(coverageName); try { CoverageSource source = getGridCoverageSource(coverageName); VariableAdapter.UnidataSpatialDomain spatialDomain = (UnidataSpatialDomain) source.getSpatialDomain(); GeneralEnvelope generalEnvelope = new GeneralEnvelope(spatialDomain.getReferencedEnvelope()); generalEnvelope.setCoordinateReferenceSystem( spatialDomain.getCoordinateReferenceSystem2D()); return generalEnvelope; } catch (IOException e) { throw new RuntimeException(e); } }
cornersV[i][1] = Double.parseDouble(pair[1]); this.originalEnvelope = new GeneralEnvelope(cornersV[0], cornersV[1]); this.originalEnvelope.setCoordinateReferenceSystem(crs);
static GeneralEnvelope toGeneralEnvelope(ReferencedEnvelope e) { GeneralEnvelope ge = new GeneralEnvelope( new double[] {e.getMinX(), e.getMinY()}, new double[] {e.getMaxX(), e.getMaxY()}); ge.setCoordinateReferenceSystem(e.getCoordinateReferenceSystem()); return ge; }
/** * Returns an envelope that contains fully all the specified points. If the envelope can't be * calculated, then this method returns {@code null}. * * @param target {@code false} for the envelope of source points, or {@code true} for the * envelope of target points. */ private GeneralEnvelope getEnvelope(final boolean target) { GeneralEnvelope envelope = null; CoordinateReferenceSystem crs = null; for (final Iterator<MappedPosition> it = getMappedPositions().iterator(); it.hasNext(); ) { final MappedPosition mp = (MappedPosition) it.next(); final DirectPosition point = target ? mp.getTarget() : mp.getSource(); if (point != null) { if (envelope == null) { final double[] coordinates = point.getCoordinate(); envelope = new GeneralEnvelope(coordinates, coordinates); } else { envelope.add(point); } crs = getCoordinateReferenceSystem(point, crs); } } if (envelope != null) { envelope.setCoordinateReferenceSystem(crs); } return envelope; }
try { Envelope fixed = CRS.transform(tempBBox, crs); env = new GeneralEnvelope(fixed); } catch (TransformException e) { env = new GeneralEnvelope( new double[] {tempBBox.getMinX(), tempBBox.getMinY()}, new double[] {tempBBox.getMaxX(), tempBBox.getMaxY()}); env.setCoordinateReferenceSystem(crs); LOGGER.warning("Forcing bbox as " + env);
private void setGridGeometry( final ReferencedEnvelope envelope, final GranuleCatalog catalog, String typeName) { Utilities.ensureNonNull("index", catalog); // // save the bbox and prepare other info // final BoundingBox bounds = catalog.getBounds(typeName); // we might have an imposed bbox this.crs = bounds.getCoordinateReferenceSystem(); if (envelope == null) this.originalEnvelope = new GeneralEnvelope(bounds); else { this.originalEnvelope = new GeneralEnvelope(envelope); this.originalEnvelope.setCoordinateReferenceSystem(crs); } // original gridrange (estimated). I am using the floor here in order to make sure // we always stays inside the real area that we have for the granule originalGridRange = new GridEnvelope2D( new Rectangle( (int) (originalEnvelope.getSpan(0) / highestRes[0]), (int) (originalEnvelope.getSpan(1) / highestRes[1]))); raster2Model = new AffineTransform2D( highestRes[0], 0, 0, -highestRes[1], originalEnvelope.getLowerCorner().getOrdinate(0) + 0.5 * highestRes[0], originalEnvelope.getUpperCorner().getOrdinate(1) - 0.5 * highestRes[1]); }
originalEnvelope = new GeneralEnvelope(bounds); } else { originalEnvelope = new GeneralEnvelope(imposedEnvelope); originalEnvelope.setCoordinateReferenceSystem(crs);
requestedWGS84 = env; ((GeneralEnvelope) requestedWGS84) .setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84); else return new GeneralEnvelope(envelope);
private GeneralEnvelope getResultEnvelope( final List<RasterQueryInfo> queryInfos, final GridEnvelope mosaicGeometry) { // use the same queryInfo used by setMosaicLocations final RasterQueryInfo baseQueryInfo = RasterUtils.findLowestResolution(queryInfos); GeneralEnvelope finalEnvelope = null; int rasterIndex = baseQueryInfo.getRasterIndex(); int pyramidLevel = baseQueryInfo.getPyramidLevel(); MathTransform rasterToModel = rasterInfo.getRasterToModel(rasterIndex, pyramidLevel); CoordinateReferenceSystem coverageCrs = rasterInfo.getCoverageCrs(); GeneralEnvelope mosaicGeometryEnv = new GeneralEnvelope(coverageCrs); mosaicGeometryEnv.setEnvelope( mosaicGeometry.getLow(0), mosaicGeometry.getLow(1), 1 + mosaicGeometry.getHigh(0), 1 + mosaicGeometry.getHigh(1)); try { finalEnvelope = CRS.transform(rasterToModel, mosaicGeometryEnv); finalEnvelope.setCoordinateReferenceSystem(coverageCrs); } catch (TransformException e) { throw new RuntimeException(e); } return finalEnvelope; }
rasterToModel, (Rectangle2D) resultGridRange, new Rectangle2D.Double()); resultEnvelope = new GeneralEnvelope(finalEnvelope); CoordinateReferenceSystem crs = rasterInfo.getCoverageCrs(); resultEnvelope.setCoordinateReferenceSystem(crs); } catch (TransformException e) { throw new RuntimeException(e);