io.quarkus.redis.datasource.geo.GeoPosition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-redis-client Show documentation
Show all versions of quarkus-redis-client Show documentation
Connect to Redis in either imperative or reactive style
package io.quarkus.redis.datasource.geo;
/**
* Represents a geospatial position.
*
* The exact limits, as specified by EPSG:900913 / EPSG:3785 / OSGEO:41001 are the following:
*
* - Valid longitudes are from -180 to 180 degrees.
* - Valid latitudes are from -85.05112878 to 85.05112878 degrees.
*
*/
public class GeoPosition {
public final double longitude;
public final double latitude;
public static GeoPosition of(double longitude, double latitude) {
return new GeoPosition(longitude, latitude);
}
private GeoPosition(double longitude, double latitude) {
if (longitude < -180 || longitude > 180) {
throw new IllegalArgumentException("The longitude must be in [-180, 180]");
}
if (latitude < -85.05112878 || latitude > 85.05112878) {
throw new IllegalArgumentException("The latitude must be in [85.05112878, 85.05112878]");
}
this.longitude = longitude;
this.latitude = latitude;
}
public double longitude() {
return longitude;
}
public double latitude() {
return latitude;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy