aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-19 18:45:02 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-19 18:45:02 -0700
commit35070c85e26fe75e73315506b8cae3360f79d12e (patch)
tree44851b4111deff65a4df9a20ad1ae9820a4284cf /src/main/java/org/traccar
parentd75bda2f95081e49272d9f6cadd89b1ba398f888 (diff)
downloadtrackermap-server-35070c85e26fe75e73315506b8cae3360f79d12e.tar.gz
trackermap-server-35070c85e26fe75e73315506b8cae3360f79d12e.tar.bz2
trackermap-server-35070c85e26fe75e73315506b8cae3360f79d12e.zip
Add coordinates validation
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/model/Position.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/model/Position.java b/src/main/java/org/traccar/model/Position.java
index d6c985458..2b743433a 100644
--- a/src/main/java/org/traccar/model/Position.java
+++ b/src/main/java/org/traccar/model/Position.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -227,7 +227,9 @@ public class Position extends Message {
}
public void setLatitude(double latitude) {
- this.latitude = latitude;
+ if (latitude >= -90 && latitude <= 90) {
+ this.latitude = latitude;
+ }
}
private double longitude;
@@ -237,7 +239,9 @@ public class Position extends Message {
}
public void setLongitude(double longitude) {
- this.longitude = longitude;
+ if (longitude >= -180 && longitude <= 180) {
+ this.longitude = longitude;
+ }
}
private double altitude; // value in meters