mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Implemented xyCoords
This commit is contained in:
parent
3432ffeae2
commit
f12428814f
2 changed files with 15 additions and 12 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue