Implemented xyCoords

This commit is contained in:
misaochan 2016-01-05 18:55:28 +13:00
parent 3432ffeae2
commit f12428814f
2 changed files with 15 additions and 12 deletions

View file

@ -42,15 +42,15 @@ public class GPSExtractor {
longitude = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE);
longitude_ref = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF);
Log.d("Image", "Latitude: " + latitude + " " + latitude_ref);
Log.d("Image", "Longitude: " + longitude + " " + longitude_ref);
decimalCoords = getDecimalCoords(latitude, latitude_ref, longitude, longitude_ref);
xyCoords = getXyCoords(latitude, latitude_ref, longitude, longitude_ref);
if (xyCoordsReq = true) {
if (xyCoordsReq == true) {
Log.d("Image", "Latitude: " + latitude + " " + latitude_ref);
Log.d("Image", "Longitude: " + longitude + " " + longitude_ref);
xyCoords = getXyCoords(latitude, latitude_ref, longitude, longitude_ref);
return xyCoords;
} else {
Log.d("Image", "Latitude: " + latitude + " " + latitude_ref);
Log.d("Image", "Longitude: " + longitude + " " + longitude_ref);
decimalCoords = getDecimalCoords(latitude, latitude_ref, longitude, longitude_ref);
return decimalCoords;
}
}

View file

@ -183,19 +183,22 @@ public class ShareActivity
//extract the coordinates of image in decimal degrees
Log.d("Image", "Calling GPSExtractor");
GPSExtractor imageObj = new GPSExtractor(filePath);
String coords = imageObj.getCoords(false);
//decimalCoords for MediaWiki API, xyCoords for Quadtree
String decimalCoords = imageObj.getCoords(false);
String xyCoords = imageObj.getCoords(true);
if (coords != null) {
Log.d("Image", "Coords of image in Long/Lat: " + coords);
if (decimalCoords != null) {
Log.d("Coords", "Decimal coords of image: " + decimalCoords);
Log.d("Coords", "XY coords of image: " + xyCoords);
//TODO: Insert cache query here, only send API request if no cached categories
CacheController cacheObj = new CacheController(this, coords);
CacheController cacheObj = new CacheController(this, xyCoords);
cacheObj.getCoords();
//asynchronous calls to MediaWiki Commons API to match image coords with nearby Commons categories
MwVolleyApi apiCall = new MwVolleyApi(this);
apiCall.request(coords);
apiCall.request(decimalCoords);
}
}