private static double area(Boundable b) { return ((Envelope) b.getBounds()).getArea(); }
private static void writeExtent(XContentBuilder builder, Envelope bbox) throws IOException { if (bbox == null) return; if (bbox.getArea() == 0.) return; // http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-geo-shape-type.html#_envelope builder.startObject("extent"); builder.field("type", "envelope"); builder.startArray("coordinates"); builder.startArray().value(bbox.getMinX()).value(bbox.getMaxY()).endArray(); builder.startArray().value(bbox.getMaxX()).value(bbox.getMinY()).endArray(); builder.endArray(); builder.endObject(); }
private static double area(Boundable b) { return ((Envelope) b.getBounds()).getArea(); }
private static double area(Boundable b) { return ((Envelope) b.getBounds()).getArea(); }
public double getAreaSqKm () throws IOException, TransformException, FactoryException { CoordinateReferenceSystem webMercatorCRS = CRS.decode("EPSG:3857"); MathTransform webMercatorTransform = CRS.findMathTransform(crs, webMercatorCRS, true); Envelope mercatorEnvelope = JTS.transform(getBounds(), webMercatorTransform); return mercatorEnvelope.getArea() / 1000 / 1000; }
public double getAreaSqKm () throws IOException, TransformException, FactoryException { CoordinateReferenceSystem webMercatorCRS = CRS.decode("EPSG:3857"); MathTransform webMercatorTransform = CRS.findMathTransform(crs, webMercatorCRS, true); Envelope mercatorEnvelope = JTS.transform(getBounds(), webMercatorTransform); return mercatorEnvelope.getArea() / 1000 / 1000; }
private Geometry nearestNeighbour(final Envelope envelope, final Object object, final ItemDistance distance) { if (envelope.getArea() > MAX_AREA_FOR_NEAREST_NEIGHBOR) { return null; } if (this.gridIndex != null) { return (Geometry) this.gridIndex.nearestNeighbour(envelope, object, distance); } else { return (Geometry) this.rawIndex.nearestNeighbour(envelope, object, distance); } }
/** * Scores the prospective parent based on geography. A perfectly matched * parent will entirely contain the child entity. (we only use MBRs here) * * @param feature * @param parent * the prospective parent to evaluate * @return a score from 0=poor match, no intersection, 1=perfect match, * competely contained */ public double scoreGeography(ImportFeature feature, AdminEntity parent) { Envelope parentEnvelope = GeoUtils.toEnvelope(parent.getBounds()); Envelope childEnvelope = feature.getEnvelope(); if(childEnvelope.getArea() > 0) { double propContained = parentEnvelope.intersection(childEnvelope).getArea() / childEnvelope.getArea(); return propContained; } else { // we have only a point representation return parentEnvelope.contains(childEnvelope) ? 1 : 0; } } }
/** * Scores the prospective parent based on geography. A perfectly matched * parent will entirely contain the child entity. (we only use MBRs here) * * @param feature * @param parent * the prospective parent to evaluate * @return a score from 0=poor match, no intersection, 1=perfect match, * competely contained */ public static double scoreGeography(ImportFeature feature, AdminEntity parent) { Envelope parentEnvelope = GeoUtils.toEnvelope(parent.getBounds()); Envelope childEnvelope = feature.getEnvelope(); if(childEnvelope.getArea() > 0) { double propContained = parentEnvelope.intersection(childEnvelope).getArea() / childEnvelope.getArea(); return propContained; } else { // we have only a point representation return parentEnvelope.contains(childEnvelope) ? 1 : 0; } }
@Override public SpatialResultSet execute(ProgressMonitor pm, Envelope extent) throws SQLException { lock = readRowSet.getReadLock(); try { lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS); // Do intersection of envelope double intersectionPercentage = extent.intersection(tableEnvelope).getArea() / tableEnvelope.getArea(); // If there is quite no zoom is great use the "select * from table" cached query. if( intersectionPercentage > RATIONAL_USAGE_INDEX) { readRowSet.beforeFirst(); return readRowSet; } else { return resultSetProvider.execute(pm, extent); } } catch (InterruptedException ex) { throw new SQLException(I18N.tr("Lock timeout while fetching {0}, another job is using this resource.", tableReference)); } }
double area = bounds.getArea(); if (cellSize == null || cellSize <= 0 || cellSize.isNaN() || cellSize.isInfinite()) { cellSize = Math.sqrt((area * 2) / coordinates.size());
if(Double.compare(geomCollection.getEnvelopeInternal().getArea(), 0d) == 0) { return returnEmptyCollection(outputDimension);
if(Double.compare(geomCollection.getEnvelopeInternal().getArea(), 0d) == 0) { return returnEmptyCollection(outputDimension);