congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
GeoUtils.checkLongitude
Code IndexAdd Tabnine to your IDE (free)

How to use
checkLongitude
method
in
org.apache.lucene.geo.GeoUtils

Best Java code snippets using org.apache.lucene.geo.GeoUtils.checkLongitude (Showing top 20 results out of 315)

origin: org.apache.lucene/lucene-core

/**
 * Quantizes double (64 bit) longitude into 32 bits (rounding down: in the direction of -180)
 * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
 * @return encoded value as a 32-bit {@code int}
 * @throws IllegalArgumentException if longitude is out of bounds
 */
public static int encodeLongitude(double longitude) {
 checkLongitude(longitude);
 // the maximum possible value cannot be encoded without overflow
 if (longitude == 180.0D) {
  longitude = Math.nextDown(longitude);
 }
 return (int) Math.floor(longitude / LON_DECODE);
}
origin: org.apache.lucene/lucene-core

/**
 * Quantizes double (64 bit) longitude into 32 bits (rounding up: in the direction of +180)
 * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
 * @return encoded value as a 32-bit {@code int}
 * @throws IllegalArgumentException if longitude is out of bounds
 */
public static int encodeLongitudeCeil(double longitude) {
 GeoUtils.checkLongitude(longitude);
 // the maximum possible value cannot be encoded without overflow
 if (longitude == 180.0D) {
  longitude = Math.nextDown(longitude);
 }
 return (int) Math.ceil(longitude / LON_DECODE);
}
origin: org.apache.lucene/lucene-core

/**
 * Constructs a bounding box by first validating the provided latitude and longitude coordinates
 */
public Rectangle(double minLat, double maxLat, double minLon, double maxLon) {
 GeoUtils.checkLatitude(minLat);
 GeoUtils.checkLatitude(maxLat);
 GeoUtils.checkLongitude(minLon);
 GeoUtils.checkLongitude(maxLon);
 this.minLon = minLon;
 this.maxLon = maxLon;
 this.minLat = minLat;
 this.maxLat = maxLat;
 assert maxLat >= minLat;
 // NOTE: cannot assert maxLon >= minLon since this rect could cross the dateline
}
origin: org.apache.lucene/lucene-core

public LatLonPointDistanceQuery(String field, double latitude, double longitude, double radiusMeters) {
 if (field == null) {
  throw new IllegalArgumentException("field must not be null");
 }
 if (Double.isFinite(radiusMeters) == false || radiusMeters < 0) {
  throw new IllegalArgumentException("radiusMeters: '" + radiusMeters + "' is invalid");
 }
 GeoUtils.checkLatitude(latitude);
 GeoUtils.checkLongitude(longitude);
 this.field = field;
 this.latitude = latitude;
 this.longitude = longitude;
 this.radiusMeters = radiusMeters;
}
origin: org.apache.lucene/lucene-core

LatLonDocValuesDistanceQuery(String field, double latitude, double longitude, double radiusMeters) {
 if (Double.isFinite(radiusMeters) == false || radiusMeters < 0) {
  throw new IllegalArgumentException("radiusMeters: '" + radiusMeters + "' is invalid");
 }
 GeoUtils.checkLatitude(latitude);
 GeoUtils.checkLongitude(longitude);
 if (field == null) {
  throw new IllegalArgumentException("field must not be null");
 }
 this.field = field;
 this.latitude = latitude;
 this.longitude = longitude;
 this.radiusMeters = radiusMeters;
}
origin: org.apache.lucene/lucene-core

LatLonPointSortField(String field, double latitude, double longitude) {
 super(field, SortField.Type.CUSTOM);
 if (field == null) {
  throw new IllegalArgumentException("field must not be null");
 }
 GeoUtils.checkLatitude(latitude);
 GeoUtils.checkLongitude(longitude);
 this.latitude = latitude;
 this.longitude = longitude;
 setMissingValue(Double.POSITIVE_INFINITY);
}

origin: org.apache.lucene/lucene-core

LatLonDocValuesBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
 GeoUtils.checkLatitude(minLatitude);
 GeoUtils.checkLatitude(maxLatitude);
 GeoUtils.checkLongitude(minLongitude);
 GeoUtils.checkLongitude(maxLongitude);
 if (field == null) {
  throw new IllegalArgumentException("field must not be null");
 }
 this.field = field;
 this.crossesDateline = minLongitude > maxLongitude; // make sure to compute this before rounding
 this.minLatitude = GeoEncodingUtils.encodeLatitudeCeil(minLatitude);
 this.maxLatitude = GeoEncodingUtils.encodeLatitude(maxLatitude);
 this.minLongitude = GeoEncodingUtils.encodeLongitudeCeil(minLongitude);
 this.maxLongitude = GeoEncodingUtils.encodeLongitude(maxLongitude);
}
origin: org.apache.lucene/lucene-core

GeoUtils.checkLongitude(polyLons[i]);
origin: org.apache.lucene/lucene-core

checkLongitude(centerLon);
final double radLat = toRadians(centerLat);
final double radLon = toRadians(centerLon);
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Quantizes double (64 bit) longitude into 32 bits (rounding up: in the direction of +180)
 * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
 * @return encoded value as a 32-bit {@code int}
 * @throws IllegalArgumentException if longitude is out of bounds
 */
public static int encodeLongitudeCeil(double longitude) {
 GeoUtils.checkLongitude(longitude);
 // the maximum possible value cannot be encoded without overflow
 if (longitude == 180.0D) {
  longitude = Math.nextDown(longitude);
 }
 return (int) Math.ceil(longitude / LON_DECODE);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Quantizes double (64 bit) longitude into 32 bits (rounding down: in the direction of -180)
 * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
 * @return encoded value as a 32-bit {@code int}
 * @throws IllegalArgumentException if longitude is out of bounds
 */
public static int encodeLongitude(double longitude) {
 checkLongitude(longitude);
 // the maximum possible value cannot be encoded without overflow
 if (longitude == 180.0D) {
  longitude = Math.nextDown(longitude);
 }
 return (int) Math.floor(longitude / LON_DECODE);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Constructs a bounding box by first validating the provided latitude and longitude coordinates
 */
public Rectangle(double minLat, double maxLat, double minLon, double maxLon) {
 GeoUtils.checkLatitude(minLat);
 GeoUtils.checkLatitude(maxLat);
 GeoUtils.checkLongitude(minLon);
 GeoUtils.checkLongitude(maxLon);
 this.minLon = minLon;
 this.maxLon = maxLon;
 this.minLat = minLat;
 this.maxLat = maxLat;
 assert maxLat >= minLat;
 // NOTE: cannot assert maxLon >= minLon since this rect could cross the dateline
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

public LatLonPointDistanceQuery(String field, double latitude, double longitude, double radiusMeters) {
 if (field == null) {
  throw new IllegalArgumentException("field must not be null");
 }
 if (Double.isFinite(radiusMeters) == false || radiusMeters < 0) {
  throw new IllegalArgumentException("radiusMeters: '" + radiusMeters + "' is invalid");
 }
 GeoUtils.checkLatitude(latitude);
 GeoUtils.checkLongitude(longitude);
 this.field = field;
 this.latitude = latitude;
 this.longitude = longitude;
 this.radiusMeters = radiusMeters;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

LatLonDocValuesDistanceQuery(String field, double latitude, double longitude, double radiusMeters) {
 if (Double.isFinite(radiusMeters) == false || radiusMeters < 0) {
  throw new IllegalArgumentException("radiusMeters: '" + radiusMeters + "' is invalid");
 }
 GeoUtils.checkLatitude(latitude);
 GeoUtils.checkLongitude(longitude);
 if (field == null) {
  throw new IllegalArgumentException("field must not be null");
 }
 this.field = field;
 this.latitude = latitude;
 this.longitude = longitude;
 this.radiusMeters = radiusMeters;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

LatLonPointSortField(String field, double latitude, double longitude) {
 super(field, SortField.Type.CUSTOM);
 if (field == null) {
  throw new IllegalArgumentException("field must not be null");
 }
 GeoUtils.checkLatitude(latitude);
 GeoUtils.checkLongitude(longitude);
 this.latitude = latitude;
 this.longitude = longitude;
 setMissingValue(Double.POSITIVE_INFINITY);
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

LatLonDocValuesBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
 GeoUtils.checkLatitude(minLatitude);
 GeoUtils.checkLatitude(maxLatitude);
 GeoUtils.checkLongitude(minLongitude);
 GeoUtils.checkLongitude(maxLongitude);
 if (field == null) {
  throw new IllegalArgumentException("field must not be null");
 }
 this.field = field;
 this.crossesDateline = minLongitude > maxLongitude; // make sure to compute this before rounding
 this.minLatitude = GeoEncodingUtils.encodeLatitudeCeil(minLatitude);
 this.maxLatitude = GeoEncodingUtils.encodeLatitude(maxLatitude);
 this.minLongitude = GeoEncodingUtils.encodeLongitudeCeil(minLongitude);
 this.maxLongitude = GeoEncodingUtils.encodeLongitude(maxLongitude);
}
origin: org.apache.lucene/lucene-spatial3d

/**
 * Convert input parameters to a box.
 * @param minLatitude latitude lower bound: must be within standard +/-90 coordinate bounds.
 * @param maxLatitude latitude upper bound: must be within standard +/-90 coordinate bounds.
 * @param minLongitude longitude lower bound: must be within standard +/-180 coordinate bounds.
 * @param maxLongitude longitude upper bound: must be within standard +/-180 coordinate bounds.
 * @return the box.
 */
static GeoBBox fromBox(final double minLatitude, final double maxLatitude, final double minLongitude, final double maxLongitude) {
 GeoUtils.checkLatitude(minLatitude);
 GeoUtils.checkLongitude(minLongitude);
 GeoUtils.checkLatitude(maxLatitude);
 GeoUtils.checkLongitude(maxLongitude);
 return GeoBBoxFactory.makeGeoBBox(PlanetModel.WGS84, 
  Geo3DUtil.fromDegrees(maxLatitude), Geo3DUtil.fromDegrees(minLatitude), Geo3DUtil.fromDegrees(minLongitude), Geo3DUtil.fromDegrees(maxLongitude));
}
origin: org.apache.lucene/lucene-spatial

/**
 * Main encoding method to quantize lat/lon points and bit interleave them into a binary morton code
 * in the range of 0x00000000... : 0xFFFFFFFF...
 *
 * @param latitude latitude value: must be within standard +/-90 coordinate bounds.
 * @param longitude longitude value: must be within standard +/-180 coordinate bounds.
 * @return bit interleaved encoded values as a 64-bit {@code long}
 * @throws IllegalArgumentException if latitude or longitude is out of bounds
 */
public static final long encode(double latitude, double longitude) {
 checkLatitude(latitude);
 checkLongitude(longitude);
 // encode lat/lon flipping the sign bit so negative ints sort before positive ints
 final int latEnc = encodeLatitude(latitude) ^ 0x80000000;
 final int lonEnc = encodeLongitude(longitude) ^ 0x80000000;
 return BitUtil.interleave(lonEnc, latEnc);
}
origin: org.apache.lucene/lucene-spatial3d

/**
 * Convert input parameters to a circle.
 * @param latitude latitude at the center: must be within standard +/-90 coordinate bounds.
 * @param longitude longitude at the center: must be within standard +/-180 coordinate bounds.
 * @param radiusMeters maximum distance from the center in meters: must be non-negative and finite.
 * @return the circle.
 */
static GeoCircle fromDistance(final double latitude, final double longitude, final double radiusMeters) {
 GeoUtils.checkLatitude(latitude);
 GeoUtils.checkLongitude(longitude);
 return GeoCircleFactory.makeGeoCircle(PlanetModel.WGS84, fromDegrees(latitude), fromDegrees(longitude), fromMeters(radiusMeters));
}

origin: org.apache.lucene/lucene-spatial3d

/** 
 * Creates a new Geo3DPoint field with the specified latitude, longitude (in degrees).
 *
 * @throws IllegalArgumentException if the field name is null or latitude or longitude are out of bounds
 */
public Geo3DPoint(String name, double latitude, double longitude) {
 super(name, TYPE);
 GeoUtils.checkLatitude(latitude);
 GeoUtils.checkLongitude(longitude);
 // Translate latitude/longitude to x,y,z:
 final GeoPoint point = new GeoPoint(PlanetModel.WGS84, Geo3DUtil.fromDegrees(latitude), Geo3DUtil.fromDegrees(longitude));
 fillFieldsData(point.x, point.y, point.z);
}
org.apache.lucene.geoGeoUtilscheckLongitude

Javadoc

validates longitude value is within standard +/-180 coordinate bounds

Popular methods of GeoUtils

  • checkLatitude
    validates latitude value is within standard +/-90 coordinate bounds
  • orient
    Returns a positive value if points a, b, and c are arranged in counter-clockwise order, negative val
  • distanceQuerySortKey
    binary search to find the exact sortKey needed to match the specified radius any sort key lte this i
  • lineCrossesLine
    uses orient method to compute whether two line segments cross
  • relate
    Compute the relation between the provided box and distance query. This only works for boxes that do
  • sloppySin
    Returns the trigonometric sine of an angle converted as a cos operation. Note that this is not quite
  • within90LonDegrees
    Return whether all points of [minLon,maxLon] are within 90 degrees of lon.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • Kernel (java.awt.image)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Option (scala)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now