Cleanup geospatial code a tiny bit
This commit is contained in:
parent
a3d1812b83
commit
95944d023d
@ -140,11 +140,7 @@ public final class IpIntel {
|
|||||||
this.hashedIp = Hashing.sha256().hashString(id + APIv3.getConfig().getProperty("ipHashing.salt"), Charsets.UTF_8).toString();
|
this.hashedIp = Hashing.sha256().hashString(id + APIv3.getConfig().getProperty("ipHashing.salt"), Charsets.UTF_8).toString();
|
||||||
this.lastUpdatedAt = Instant.now();
|
this.lastUpdatedAt = Instant.now();
|
||||||
this.result = result;
|
this.result = result;
|
||||||
|
this.location = new GeoJsonPoint(result.getLocation());
|
||||||
if (result.getLocation() != null) {
|
|
||||||
MaxMindLocation location = result.getLocation();
|
|
||||||
this.location = new GeoJsonPoint(location.getLongitude(), location.getLatitude());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package net.frozenorb.apiv3.util;
|
package net.frozenorb.apiv3.util;
|
||||||
|
|
||||||
|
import net.frozenorb.apiv3.maxmind.MaxMindLocation;
|
||||||
|
|
||||||
public final class GeoJsonPoint {
|
public final class GeoJsonPoint {
|
||||||
|
|
||||||
private String type = "Point";
|
private String type = "Point";
|
||||||
@ -7,6 +9,10 @@ public final class GeoJsonPoint {
|
|||||||
|
|
||||||
private GeoJsonPoint() {} // For Jackson
|
private GeoJsonPoint() {} // For Jackson
|
||||||
|
|
||||||
|
public GeoJsonPoint(MaxMindLocation maxMindLocation) {
|
||||||
|
this(maxMindLocation.getLongitude(), maxMindLocation.getLatitude());
|
||||||
|
}
|
||||||
|
|
||||||
public GeoJsonPoint(double longitude, double latitude) {
|
public GeoJsonPoint(double longitude, double latitude) {
|
||||||
this.coordinates = new double[] { longitude, latitude};
|
this.coordinates = new double[] { longitude, latitude};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user