All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gps.gpsExtractor Maven / Gradle / Ivy

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy