gps.gpsExtractor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of image-forensics Show documentation
Show all versions of image-forensics Show documentation
A library of image forensics algorithms for tampering localization.
The newest version!
package gps;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import java.lang.reflect.Field;
import java.util.Map;
/**
* Created by marzampoglou on 1/19/16.
*/
public class gpsExtractor {
public boolean exists=false;
public double latitude=Double.MAX_VALUE;
public double longitude=Double.MAX_VALUE;
public gpsExtractor(JsonObject metadata) {
GetGPSData(metadata);
}
private void GetGPSData(JsonObject metadata) {
System.out.println("GetGPSData called");
JsonArray jsonArray = metadata.getAsJsonArray("values");
for (int fieldInd=0; fieldInd < jsonArray.size(); fieldInd++){
JsonObject child = jsonArray.get(fieldInd).getAsJsonObject();
if (child.get("name").getAsString().equalsIgnoreCase("GPS")){
JsonArray gpsObject = child.getAsJsonArray("values");
System.out.println("Found GPS data");
String LatitudeRef=null;
String LongitudeRef=null;
String LatitudeString=null;
String LongitudeString=null;
for (int gpsFieldInd=0; gpsFieldInd