org.locationtech.jts.geom.Envelope Java Examples
The following examples show how to use
org.locationtech.jts.geom.Envelope.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: datawave Author: NationalSecurityAgency File: GeoWaveFunctionsDescriptor.java License: Apache License 2.0 | 6 votes |
@Override public JexlNode getIndexQuery(ShardQueryConfiguration config, MetadataHelper helper, DateIndexHelper dateIndexHelper, Set<String> datatypeFilter) { int maxEnvelopes = Math.max(1, config.getGeoWaveMaxEnvelopes()); if (isSpatialRelationship(name)) { Geometry geom = AbstractGeometryNormalizer.parseGeometry(args.get(1).image); List<Envelope> envelopes = getSeparateEnvelopes(geom, maxEnvelopes); if (!envelopes.isEmpty()) { JexlNode indexNode; if (envelopes.size() == 1) { indexNode = getIndexNode(args.get(0), envelopes.get(0), config, helper); } else { indexNode = getIndexNode(args.get(0), envelopes, config, helper); } return indexNode; } } // return the true node if unable to parse arguments return TRUE_NODE; }
Example #2
Source Project: hortonmachine Author: TheHortonMachine File: DatabaseLasDataManager.java License: GNU General Public License v3.0 | 6 votes |
@Override public synchronized List<Geometry> getEnvelopesInGeometry( Geometry checkGeom, boolean doOnlyEnvelope, double[] minMaxZ ) throws Exception { checkOpen(); List<LasCell> lasCells = LasCellsTable.getLasCells(spatialDb, checkGeom, true, false, false, false, false); double minZ = Double.POSITIVE_INFINITY; double maxZ = Double.NEGATIVE_INFINITY; Envelope env = new Envelope(); for( LasCell lasCell : lasCells ) { minZ = Math.min(minZ, lasCell.minElev); maxZ = Math.max(maxZ, lasCell.maxElev); env.expandToInclude(lasCell.polygon.getEnvelopeInternal()); } ReferencedEnvelope3D dataEnvelope = new ReferencedEnvelope3D(env.getMinX(), env.getMaxX(), env.getMinY(), env.getMaxY(), minZ, maxZ, crs); Polygon envelopePolygon = LasIndexer.envelopeToPolygon(dataEnvelope); ArrayList<Geometry> envelopeList = new ArrayList<Geometry>(); envelopeList.add(envelopePolygon); return envelopeList; }
Example #3
Source Project: datawave Author: NationalSecurityAgency File: GeoWaveFunctionsDescriptor.java License: Apache License 2.0 | 6 votes |
protected static JexlNode getIndexNode(String fieldName, List<Envelope> envs, ShardQueryConfiguration config, MetadataHelper helper) { Index index; int maxExpansion; if (isOnlyPointType(fieldName, helper)) { index = PointNormalizer.index; maxExpansion = config.getPointMaxExpansion(); } else { index = GeometryNormalizer.index; maxExpansion = config.getGeometryMaxExpansion(); } Collection<ByteArrayRange> allRanges = new ArrayList<>(); int maxRanges = maxExpansion / envs.size(); for (Envelope env : envs) { for (MultiDimensionalNumericData range : GeometryUtils.basicConstraintsFromEnvelope(env).getIndexConstraints(index)) { allRanges.addAll(index.getIndexStrategy().getQueryRanges(range, maxRanges).getCompositeQueryRanges()); } } allRanges = ByteArrayRange.mergeIntersections(allRanges, ByteArrayRange.MergeOperation.UNION); Iterable<JexlNode> rangeNodes = Iterables.transform(allRanges, new ByteArrayRangeToJexlNode(fieldName)); // now link em up return JexlNodeFactory.createOrNode(rangeNodes); }
Example #4
Source Project: hortonmachine Author: TheHortonMachine File: TestUtils.java License: GNU General Public License v3.0 | 6 votes |
@Test public void testTiles() throws Exception { int tx = 0; int ty = 0; int tz = 0; Envelope env4326 = MercatorUtils.tileBounds4326(tx, ty, tz); Envelope env3857 = MercatorUtils.tileBounds3857(tx, ty, tz); Coordinate ll3857 = new Coordinate(env3857.getMinX(), env3857.getMinY()); Coordinate ur3857 = new Coordinate(env3857.getMaxX(), env3857.getMaxY()); Coordinate ll4326transf = MercatorUtils.convert3857To4326(ll3857); Coordinate ur4326transf = MercatorUtils.convert3857To4326(ur3857); Coordinate ll4326 = new Coordinate(env4326.getMinX(), env4326.getMinY()); Coordinate ur4326 = new Coordinate(env4326.getMaxX(), env4326.getMaxY()); double tolerance = 0.0000001; assertTrue(ll4326transf.equals2D(ll4326, tolerance)); assertTrue(ur4326transf.equals2D(ur4326, tolerance)); }
Example #5
Source Project: hortonmachine Author: TheHortonMachine File: RL2NwwLayer.java License: GNU General Public License v3.0 | 6 votes |
public RL2NwwLayer( Rasterlite2Coverage rasterCoverage, Integer tileSize ) throws Exception { super(makeLevels(rasterCoverage, tileSize)); this.layerName = rasterCoverage.getName(); Envelope bounds = rasterCoverage.getBounds(); double w = bounds.getMinX(); double s = bounds.getMinY(); double e = bounds.getMaxX(); double n = bounds.getMaxY(); double centerX = w + (e - w) / 2.0; double centerY = s + (n - s) / 2.0; Coordinate centerCoordinate = new Coordinate(centerX, centerY); CoordinateReferenceSystem targetCRS = DefaultGeographicCRS.WGS84; CoordinateReferenceSystem sourceCRS = CrsUtilities.getCrsFromSrid(rasterCoverage.getSrid()); MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS); centerCoordinateLL = JTS.transform(centerCoordinate, null, transform); this.setUseTransparentTextures(true); }
Example #6
Source Project: geowave Author: locationtech File: ExtractGeometryFilterVisitorTest.java License: Apache License 2.0 | 6 votes |
@Test public void testWithMultipleAttributes() throws CQLException, TransformException, ParseException { // In this test query, we have constrains over multiple geometric // attributes. // The ExtractGeometryFilterVisitor class should only extracts // geometric constrains associated with the specified attribute name and // ignore others. final Filter filter = CQL.toFilter( String.format( "INTERSECTS(%s, POLYGON((0 0, 0 25, 10 25, 10 0, 0 0))) AND INTERSECTS(geomOtherAttr, POLYGON((0 0, 0 5, 5 5, 5 0, 0 0)))", geomAttributeName)); final Query query = new Query("type", filter); final ExtractGeometryFilterVisitorResult result = (ExtractGeometryFilterVisitorResult) query.getFilter().accept(visitorWithDescriptor, null); final Envelope bounds = new Envelope(0, 10, 0, 25); final Geometry bbox = new GeometryFactory().toGeometry(bounds); assertTrue(bbox.equalsTopo(result.getGeometry())); assertTrue(result.getCompareOp() == null); }
Example #7
Source Project: geowave Author: locationtech File: ExtractGeometryFilterVisitorTest.java License: Apache License 2.0 | 6 votes |
@Test public void testContains() throws CQLException, TransformException, ParseException { final Filter filter = CQL.toFilter( String.format( "CONTAINS(geom, POLYGON((0 0, 0 25, 10 25, 10 0, 0 0)))", geomAttributeName)); final Query query = new Query("type", filter); final ExtractGeometryFilterVisitorResult result = (ExtractGeometryFilterVisitorResult) query.getFilter().accept(visitorWithDescriptor, null); final Envelope bounds = new Envelope(0, 10, 0, 25); final Geometry bbox = new GeometryFactory().toGeometry(bounds); assertTrue(bbox.equalsTopo(result.getGeometry())); assertTrue(result.getCompareOp() == CompareOperation.WITHIN); }
Example #8
Source Project: geowave Author: locationtech File: GeometryUtils.java License: Apache License 2.0 | 6 votes |
/** * Recursively decompose geometry into a set of envelopes to create a single set. * * @param geometry * @param destinationListOfSets * @param checkTopoEquality */ private static boolean constructListOfConstraintSetsFromGeometry( final Geometry geometry, final List<ConstraintSet> destinationListOfSets, final boolean checkTopoEquality) { // Get the envelope of the geometry being held final int n = geometry.getNumGeometries(); boolean retVal = true; if (n > 1) { retVal = false; for (int gi = 0; gi < n; gi++) { constructListOfConstraintSetsFromGeometry( geometry.getGeometryN(gi), destinationListOfSets, checkTopoEquality); } } else { final Envelope env = geometry.getEnvelopeInternal(); destinationListOfSets.add(basicConstraintSetFromEnvelope(env)); if (checkTopoEquality) { retVal = new GeometryFactory().toGeometry(env).equalsTopo(geometry); } } return retVal; }
Example #9
Source Project: sis Author: apache File: JTS.java License: Apache License 2.0 | 6 votes |
/** * Finds an operation between the given CRS valid in the given area of interest. * This method does not verify the CRS of the given geometry. * * @param sourceCRS the CRS of source coordinates. * @param targetCRS the CRS of target coordinates. * @param areaOfInterest the area of interest. * @return the mathematical operation from {@code sourceCRS} to {@code targetCRS}. * @throws FactoryException if the operation can not be created. */ private static CoordinateOperation findOperation(final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS, final Geometry areaOfInterest) throws FactoryException { DefaultGeographicBoundingBox bbox = new DefaultGeographicBoundingBox(); try { final Envelope e = areaOfInterest.getEnvelopeInternal(); bbox.setBounds(new Envelope2D(sourceCRS, e.getMinX(), e.getMinY(), e.getWidth(), e.getHeight())); } catch (TransformException ex) { bbox = null; Logging.ignorableException(Logging.getLogger(Loggers.GEOMETRY), JTS.class, "transform", ex); } return CRS.findOperation(sourceCRS, targetCRS, bbox); }
Example #10
Source Project: hortonmachine Author: TheHortonMachine File: GeopackageCommonDb.java License: GNU General Public License v3.0 | 6 votes |
private void initEntry( IHMResultSet rs, Entry e ) throws Exception { e.setIdentifier(rs.getString("identifier")); e.setDescription(rs.getString("description")); e.setTableName(rs.getString("table_name")); try { final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_STRING); DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); e.setLastChange(DATE_FORMAT.parse(rs.getString("last_change"))); } catch (ParseException ex) { throw new IOException(ex); } int srid = rs.getInt("srs_id"); e.setSrid(srid); e.setBounds(new Envelope(rs.getDouble("min_x"), rs.getDouble("max_x"), rs.getDouble("min_y"), rs.getDouble("max_y"))); }
Example #11
Source Project: hortonmachine Author: TheHortonMachine File: TestUtils.java License: GNU General Public License v3.0 | 6 votes |
@Test public void testTiles2() throws Exception { int zoomLevel = 8; double tolerance = 0.0000001; Coordinate c1 = new Coordinate(1289079.2130195359, 5900910.886700573); Coordinate c2 = new Coordinate(1298888.6991376826, 5909656.474824957); Envelope env3857 = new Envelope(c1, c2); Envelope env4326 = MercatorUtils.convert3857To4326(env3857); Coordinate centre = env4326.centre(); assertTrue(centre.equals2D(new Coordinate(11.62405565150858, 46.77412159831822), tolerance)); int[] tileNumberFrom3857 = MercatorUtils.getTileNumberFrom3857(env3857.centre(), zoomLevel); assertEquals(136, tileNumberFrom3857[1]); assertEquals(90, tileNumberFrom3857[2]); assertEquals(8, tileNumberFrom3857[0]); }
Example #12
Source Project: geowave Author: locationtech File: ExtractGeometryFilterVisitorTest.java License: Apache License 2.0 | 6 votes |
@Test public void testIntersects() throws CQLException, TransformException, ParseException { final Filter filter = CQL.toFilter( String.format( "INTERSECTS(%s, POLYGON((0 0, 0 25, 10 25, 10 0, 0 0)))", geomAttributeName)); final Query query = new Query("type", filter); final ExtractGeometryFilterVisitorResult result = (ExtractGeometryFilterVisitorResult) query.getFilter().accept(visitorWithDescriptor, null); final Envelope bounds = new Envelope(0, 10, 0, 25); final Geometry bbox = new GeometryFactory().toGeometry(bounds); assertTrue(bbox.equalsTopo(result.getGeometry())); assertTrue(result.getCompareOp() == CompareOperation.INTERSECTS); }
Example #13
Source Project: hortonmachine Author: TheHortonMachine File: TestTransformationUtils.java License: GNU General Public License v3.0 | 6 votes |
public void testTransformationUtils() throws Exception { Envelope env = new Envelope(100, 200, 1000, 5000); Rectangle rect = new Rectangle(0, 0, 100, 4000); AffineTransform worldToPixel = TransformationUtils.getWorldToPixel(env, rect); Point2D srcPt = new Point2D.Double(150.0, 3000.0); Point2D transformed = worldToPixel.transform(srcPt, null); assertEquals(50, (int) transformed.getX()); assertEquals(2000, (int) transformed.getY()); srcPt = new Point2D.Double(100.0, 1000.0); transformed = worldToPixel.transform(srcPt, null); assertEquals(0, (int) transformed.getX()); assertEquals(4000, (int) transformed.getY()); }
Example #14
Source Project: geowave Author: locationtech File: GeometryUtils.java License: Apache License 2.0 | 6 votes |
private static double distanceToDegrees( final CoordinateReferenceSystem crs, final Envelope env, final GeometryFactory factory, final double meters) throws TransformException { return Collections.max( Arrays.asList( distanceToDegrees( crs, factory.createPoint(new Coordinate(env.getMaxX(), env.getMaxY())), meters), distanceToDegrees( crs, factory.createPoint(new Coordinate(env.getMaxX(), env.getMinY())), meters), distanceToDegrees( crs, factory.createPoint(new Coordinate(env.getMinX(), env.getMinY())), meters), distanceToDegrees( crs, factory.createPoint(new Coordinate(env.getMinX(), env.getMaxY())), meters))); }
Example #15
Source Project: hortonmachine Author: TheHortonMachine File: TestRasterlite2.java License: GNU General Public License v3.0 | 6 votes |
public void testReading() throws Exception { URL dataUrl = TestRasterlite2.class.getClassLoader().getResource("1873.berlin_stadt_postgrenzen_rasterlite2.rl2"); File file = new File(dataUrl.toURI()); try (ASpatialDb db = EDb.SPATIALITE.getSpatialDb()) { db.open(file.getAbsolutePath()); Rasterlite2Db rdb = new Rasterlite2Db(db); List<Rasterlite2Coverage> rasterCoverages = rdb.getRasterCoverages(true); Rasterlite2Coverage raster = rasterCoverages.get(2); assertEquals("berlin_stadtteilgrenzen.1880", raster.getName()); Envelope bounds = raster.getBounds(); } }
Example #16
Source Project: hortonmachine Author: TheHortonMachine File: FeatureUtilities.java License: GNU General Public License v3.0 | 6 votes |
/** * Create a {@link Polygon} from an {@link Envelope}. * * @param envelope the envelope to convert. * @return the created polygon. */ public static Polygon envelopeToPolygon( Envelope envelope ) { double w = envelope.getMinX(); double e = envelope.getMaxX(); double s = envelope.getMinY(); double n = envelope.getMaxY(); Coordinate[] coords = new Coordinate[5]; coords[0] = new Coordinate(w, n); coords[1] = new Coordinate(e, n); coords[2] = new Coordinate(e, s); coords[3] = new Coordinate(w, s); coords[4] = new Coordinate(w, n); GeometryFactory gf = GeometryUtilities.gf(); LinearRing linearRing = gf.createLinearRing(coords); Polygon polygon = gf.createPolygon(linearRing, null); return polygon; }
Example #17
Source Project: geowave Author: locationtech File: AbstractGeoWaveBasicVectorIT.java License: Apache License 2.0 | 6 votes |
private static void validateBBox(final Envelope bboxStat, final StatisticsCache cachedValue) { Assert.assertNotNull(bboxStat); Assert.assertEquals( "The min X of the bounding box stat does not match the expected value", cachedValue.minX, bboxStat.getMinX(), MathUtils.EPSILON); Assert.assertEquals( "The min Y of the bounding box stat does not match the expected value", cachedValue.minY, bboxStat.getMinY(), MathUtils.EPSILON); Assert.assertEquals( "The max X of the bounding box stat does not match the expected value", cachedValue.maxX, bboxStat.getMaxX(), MathUtils.EPSILON); Assert.assertEquals( "The max Y of the bounding box stat does not match the expected value", cachedValue.maxY, bboxStat.getMaxY(), MathUtils.EPSILON); }
Example #18
Source Project: presto Author: prestosql File: PagesRTreeIndex.java License: Apache License 2.0 | 5 votes |
private static Envelope getEnvelope(OGCGeometry ogcGeometry) { com.esri.core.geometry.Envelope env = new com.esri.core.geometry.Envelope(); ogcGeometry.getEsriGeometry().queryEnvelope(env); return new Envelope(env.getXMin(), env.getXMax(), env.getYMin(), env.getYMax()); }
Example #19
Source Project: hortonmachine Author: TheHortonMachine File: H2GisDb.java License: GNU General Public License v3.0 | 5 votes |
@Override public String getSpatialindexGeometryWherePiece( String tableName, String alias, Geometry geometry ) throws Exception { GeometryColumn gCol = getGeometryColumnsForTable(tableName); if (alias == null) { alias = ""; } else { alias = alias + "."; } Envelope envelopeInternal = geometry.getEnvelopeInternal(); Polygon bounds = DbsUtilities.createPolygonFromEnvelope(envelopeInternal); String sql = alias + gCol.geometryColumnName + " && ST_GeomFromText('" + bounds.toText() + "') AND ST_Intersects(" + alias + gCol.geometryColumnName + ",ST_GeomFromText('" + geometry.toText() + "'))"; return sql; }
Example #20
Source Project: hortonmachine Author: TheHortonMachine File: PrintUtilities.java License: GNU General Public License v3.0 | 5 votes |
public static String getRegionPrint( GridCoverage2D coverage ) { org.opengis.geometry.Envelope envelope = coverage.getEnvelope(); DirectPosition lowerCorner = envelope.getLowerCorner(); double[] westSouth = lowerCorner.getCoordinate(); DirectPosition upperCorner = envelope.getUpperCorner(); double[] eastNorth = upperCorner.getCoordinate(); GridGeometry2D gridGeometry = coverage.getGridGeometry(); GridEnvelope2D gridRange = gridGeometry.getGridRange2D(); String numberSpace = " "; String numberRest = " "; StringBuilder sb = new StringBuilder(); sb.append(" +---------------------- ").append(String.format("%17.8f", eastNorth[1])) .append(" ----------------------+").append("\n"); sb.append(" + ").append(String.format("%17.8f", gridRange.getMinY())) .append(" +").append("\n"); sb.append(" + ").append(numberSpace).append(" +").append("\n"); sb.append(" + ").append(numberSpace).append(" +").append("\n"); sb.append(String.format("%17.8f", westSouth[0])).append(numberRest).append(numberSpace).append(numberRest) .append(String.format("%17.8f", eastNorth[0])).append("\n"); sb.append(String.format("%17.8f", gridRange.getMinX())).append(numberRest).append(numberSpace).append(numberRest) .append(String.format("%17.8f", gridRange.getMaxX())).append("\n"); sb.append(" + ").append(numberSpace).append(" +").append("\n"); sb.append(" + ").append(numberSpace).append(" +").append("\n"); sb.append(" + ").append(String.format("%17.8f", gridRange.getMaxY())) .append(" +").append("\n"); sb.append(" +---------------------- ").append(String.format("%17.8f", westSouth[1])) .append(" ----------------------+").append("\n"); return sb.toString(); }
Example #21
Source Project: presto Author: prestosql File: JtsGeometrySerde.java License: Apache License 2.0 | 5 votes |
private static void writeEnvelope(Geometry geometry, SliceOutput output) { if (geometry.isEmpty()) { for (int i = 0; i < 4; i++) { output.writeDouble(NaN); } return; } Envelope envelope = geometry.getEnvelopeInternal(); output.writeDouble(envelope.getMinX()); output.writeDouble(envelope.getMinY()); output.writeDouble(envelope.getMaxX()); output.writeDouble(envelope.getMaxY()); }
Example #22
Source Project: hortonmachine Author: TheHortonMachine File: MercatorUtils.java License: GNU General Public License v3.0 | 5 votes |
public static Envelope convert3857To4326( Envelope envelope3857 ) { Coordinate ll3857 = new Coordinate(envelope3857.getMinX(), envelope3857.getMinY()); Coordinate ur3857 = new Coordinate(envelope3857.getMaxX(), envelope3857.getMaxY()); Coordinate ll4326 = convert3857To4326(ll3857); Coordinate ur4326 = convert3857To4326(ur3857); Envelope env4326 = new Envelope(ll4326, ur4326); return env4326; }
Example #23
Source Project: datawave Author: NationalSecurityAgency File: GeoWaveFunctionsDescriptorTest.java License: Apache License 2.0 | 5 votes |
@Test public void testMultipolygonIntersection() throws Exception { // @formatter:off String wkt = "MULTIPOLYGON(" + "((160 60, 180 60, 180 70, 160 70, 160 60)), " + // GROUP 1 "((-180 70, -180 60, -175 60, -175 70, -180 70)), " + // GROUP 2 "((155 20, 165 20, 165 65, 155 65, 155 20)), " + // GROUP 1 "((-105 68, -80 68, -80 88, -105 88, -105 68)), " + // GROUP 2 "((100 20, 165 20, 165 40, 100 40, 100 20)), " + // GROUP 1 "((-180 68, -100 68, -100 70, -180 70, -180 68)), " + // GROUP 2 "((-5 -5, 5 -5, 5 5, -5 5, -5 -5)))"; // GROUP 3 // @formatter:on List<Envelope> envelopes = (List<Envelope>) Whitebox.invokeMethod(GeoWaveFunctionsDescriptor.class, "getSeparateEnvelopes", AbstractGeometryNormalizer.parseGeometry(wkt), 4); Assert.assertEquals(3, envelopes.size()); List<Envelope> expectedEnvelopes = new ArrayList<>(); expectedEnvelopes.add(new Envelope(100, 180, 20, 70)); expectedEnvelopes.add(new Envelope(-180, -80, 60, 88)); expectedEnvelopes.add(new Envelope(-5, 5, -5, 5)); Iterator<Envelope> expectedIter = expectedEnvelopes.iterator(); while (expectedIter.hasNext()) { boolean foundMatch = false; for (Envelope envelope : envelopes) { if (envelope.equals(expectedIter.next())) { foundMatch = true; expectedIter.remove(); } } Assert.assertTrue(foundMatch); } }
Example #24
Source Project: geowave Author: locationtech File: BoundingBoxDataStatistics.java License: Apache License 2.0 | 5 votes |
/** Convert Fixed Bin Numeric statistics to a JSON object */ @Override public Envelope getResult() { if (isSet()) { return new Envelope(minX, maxX, minY, maxY); } else { return new Envelope(); } }
Example #25
Source Project: geowave Author: locationtech File: BoundingBoxAggregation.java License: Apache License 2.0 | 5 votes |
@Override public Envelope merge(final Envelope result1, final Envelope result2) { if (result1.isNull()) { return result2; } else if (result2.isNull()) { return result1; } final double minX = Math.min(result1.getMinX(), result2.getMinX()); final double minY = Math.min(result1.getMinY(), result2.getMinY()); final double maxX = Math.max(result1.getMaxX(), result2.getMaxX()); final double maxY = Math.max(result1.getMaxY(), result2.getMaxY()); return new Envelope(minX, maxX, minY, maxY); }
Example #26
Source Project: geowave Author: locationtech File: RDDUtils.java License: Apache License 2.0 | 5 votes |
public static InsertionIds trimIndexIds( final InsertionIds rawIds, final Geometry geom, final NumericIndexStrategy index) { for (final SinglePartitionInsertionIds insertionId : rawIds.getPartitionKeys()) { final byte[] partitionKey = insertionId.getPartitionKey(); final int size = insertionId.getSortKeys().size(); if (size > 3) { final Iterator<byte[]> it = insertionId.getSortKeys().iterator(); while (it.hasNext()) { final byte[] sortKey = it.next(); final MultiDimensionalNumericData keyTile = index.getRangeForId(partitionKey, sortKey); final Envelope other = new Envelope(); other.init( keyTile.getMinValuesPerDimension()[0], keyTile.getMaxValuesPerDimension()[0], keyTile.getMinValuesPerDimension()[1], keyTile.getMaxValuesPerDimension()[1]); final Polygon rect = JTS.toGeometry(other); if (!RectangleIntersects.intersects(rect, geom)) { it.remove(); } } } } return rawIds; }
Example #27
Source Project: arctic-sea Author: 52North File: ReferencedEnvelopeTest.java License: Apache License 2.0 | 5 votes |
@Test public void testExpandToIncludeEmptyEnvelope() throws Exception { originEnvelope.expandToInclude(emptyEnvelope); assertThat(originEnvelope.getSrid(), is(4326)); final Envelope envelope = originEnvelope.getEnvelope(); assertThat(envelope.getMinX(), is(0.0)); assertThat(envelope.getMaxX(), is(1.0)); assertThat(envelope.getMinY(), is(0.0)); assertThat(envelope.getMaxY(), is(1.0)); assertThat(envelope.getArea(), is(1.0)); }
Example #28
Source Project: arctic-sea Author: 52North File: ReferencedEnvelopeTest.java License: Apache License 2.0 | 5 votes |
@Test public void testExpandToIncludeEmptyReferencedEnvelope() throws Exception { originEnvelope.expandToInclude(emptyReferencedEnvelope); assertThat(originEnvelope.getSrid(), is(4326)); final Envelope envelope = originEnvelope.getEnvelope(); assertThat(envelope.getMinX(), is(0.0)); assertThat(envelope.getMaxX(), is(1.0)); assertThat(envelope.getMinY(), is(0.0)); assertThat(envelope.getMaxY(), is(1.0)); assertThat(envelope.getArea(), is(1.0)); }
Example #29
Source Project: geowave Author: locationtech File: GeometryUtils.java License: Apache License 2.0 | 5 votes |
/** * This mehtod returns an envelope between negative infinite and positive inifinity in both x and * y * * @return the infinite bounding box */ public static Geometry infinity() { // unless we make this synchronized, we will want to instantiate a new // geometry factory because geometry factories are not thread safe return new GeometryFactory().toGeometry( new Envelope( Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)); }
Example #30
Source Project: arctic-sea Author: 52North File: ReferencedEnvelopeTest.java License: Apache License 2.0 | 5 votes |
@Test public void testHashCode() { final ReferencedEnvelope anEnvelope = new ReferencedEnvelope(new Envelope(1.0, 2.0, 3.0, 4.0), 52); final ReferencedEnvelope anotherEnvelope = new ReferencedEnvelope(null, 52); assertThat(anEnvelope.hashCode(), is(anEnvelope.hashCode())); assertThat(anEnvelope.hashCode(), is(not(anotherEnvelope.hashCode()))); }