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.lastUpdatedAt = Instant.now();
|
||||
this.result = result;
|
||||
|
||||
if (result.getLocation() != null) {
|
||||
MaxMindLocation location = result.getLocation();
|
||||
this.location = new GeoJsonPoint(location.getLongitude(), location.getLatitude());
|
||||
}
|
||||
this.location = new GeoJsonPoint(result.getLocation());
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package net.frozenorb.apiv3.util;
|
||||
|
||||
import net.frozenorb.apiv3.maxmind.MaxMindLocation;
|
||||
|
||||
public final class GeoJsonPoint {
|
||||
|
||||
private String type = "Point";
|
||||
@ -7,6 +9,10 @@ public final class GeoJsonPoint {
|
||||
|
||||
private GeoJsonPoint() {} // For Jackson
|
||||
|
||||
public GeoJsonPoint(MaxMindLocation maxMindLocation) {
|
||||
this(maxMindLocation.getLongitude(), maxMindLocation.getLatitude());
|
||||
}
|
||||
|
||||
public GeoJsonPoint(double longitude, double latitude) {
|
||||
this.coordinates = new double[] { longitude, latitude};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user