private static double[] computeTileEnlargement(double lat, int enlargementInMeter) { if (enlargementInMeter == 0) { return EPSILON_ZERO; } double[] epsilons = new double[2]; epsilons[0] = LatLongUtils.latitudeDistance(enlargementInMeter); epsilons[1] = LatLongUtils.longitudeDistance(enlargementInMeter, lat); return epsilons; }
/** * Creates a BoundingBox that is a fixed meter amount larger on all sides (but does not cross date line/poles). * * @param meters extension (must be >= 0) * @return an extended BoundingBox or this (if meters == 0) */ public BoundingBox extendMeters(int meters) { if (meters == 0) { return this; } else if (meters < 0) { throw new IllegalArgumentException("BoundingBox extend operation does not accept negative values"); } double verticalExpansion = LatLongUtils.latitudeDistance(meters); double horizontalExpansion = LatLongUtils.longitudeDistance(meters, Math.max(Math.abs(minLatitude), Math.abs(maxLatitude))); double minLat = Math.max(MercatorProjection.LATITUDE_MIN, this.minLatitude - verticalExpansion); double minLon = Math.max(-180, this.minLongitude - horizontalExpansion); double maxLat = Math.min(MercatorProjection.LATITUDE_MAX, this.maxLatitude + verticalExpansion); double maxLon = Math.min(180, this.maxLongitude + horizontalExpansion); return new BoundingBox(minLat, minLon, maxLat, maxLon); }
/** * {@inheritDoc} */ @Override public Collection<PointOfInterest> findNearPosition(LatLong point, int distance, PoiCategoryFilter filter, List<Tag> patterns, int limit) { double minLat = point.latitude - LatLongUtils.latitudeDistance(distance); double minLon = point.longitude - LatLongUtils.longitudeDistance(distance, point.latitude); double maxLat = point.latitude + LatLongUtils.latitudeDistance(distance); double maxLon = point.longitude + LatLongUtils.longitudeDistance(distance, point.latitude); return findInRect(new BoundingBox(minLat, minLon, maxLat, maxLon), filter, patterns, limit); }
private static double[] bufferInDegrees(long tileY, byte zoom, int enlargementInMeter) { if (enlargementInMeter == 0) { return EPSILON_ZERO; } double[] epsilons = new double[2]; double lat = MercatorProjection.tileYToLatitude(tileY, zoom); epsilons[0] = LatLongUtils.latitudeDistance(enlargementInMeter); epsilons[1] = LatLongUtils.longitudeDistance(enlargementInMeter, lat); return epsilons; }
/** * Creates a BoundingBox that is a fixed meter amount larger on all sides (but does not cross date line/poles). * * @param meters extension (must be >= 0) * @return an extended BoundingBox or this (if meters == 0) */ public BoundingBox extendMeters(int meters) { if (meters == 0) { return this; } else if (meters < 0) { throw new IllegalArgumentException("BoundingBox extend operation does not accept negative values"); } double verticalExpansion = LatLongUtils.latitudeDistance(meters); double horizontalExpansion = LatLongUtils.longitudeDistance(meters, Math.max(Math.abs(minLatitude), Math.abs(maxLatitude))); double minLat = Math.max(MercatorProjection.LATITUDE_MIN, this.minLatitude - verticalExpansion); double minLon = Math.max(-180, this.minLongitude - horizontalExpansion); double maxLat = Math.min(MercatorProjection.LATITUDE_MAX, this.maxLatitude + verticalExpansion); double maxLon = Math.min(180, this.maxLongitude + horizontalExpansion); return new BoundingBox(minLat, minLon, maxLat, maxLon); }
/** * {@inheritDoc} */ @Override public Collection<PointOfInterest> findNearPosition(LatLong point, int distance, PoiCategoryFilter filter, List<Tag> patterns, int limit) { double minLat = point.latitude - LatLongUtils.latitudeDistance(distance); double minLon = point.longitude - LatLongUtils.longitudeDistance(distance, point.latitude); double maxLat = point.latitude + LatLongUtils.latitudeDistance(distance); double maxLon = point.longitude + LatLongUtils.longitudeDistance(distance, point.latitude); return findInRect(new BoundingBox(minLat, minLon, maxLat, maxLon), filter, patterns, limit); }