[gnome-maps/wip/mlundblad/photon-geocode: 3/13] utils: Add function to get country of coordinates
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/photon-geocode: 3/13] utils: Add function to get country of coordinates
- Date: Sun, 9 Jun 2019 20:02:45 +0000 (UTC)
commit 85ebff6713c48d904a0bf3312e9af09dce3ca4e8
Author: Marcus Lundblad <ml update uu se>
Date: Sun Jun 2 17:26:55 2019 +0200
utils: Add function to get country of coordinates
Gets country/territory code corrisponding to
given coordinates.
src/utils.js | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/src/utils.js b/src/utils.js
index f4e6dfb..2407e3c 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -26,6 +26,7 @@ const GdkPixbuf = imports.gi.GdkPixbuf;
const Geocode = imports.gi.GeocodeGlib;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
+const GWeather = imports.gi.GWeather;
const Soup = imports.gi.Soup;
const ByteArray = imports.byteArray;
@@ -368,3 +369,10 @@ function getBufferText(buffer) {
return buffer.toString();
}
}
+
+function getCountryCodeForCoordinates(lat, lon) {
+ let location = GWeather.Location.new_detached('', null, lat, lon);
+
+ return location.get_country();
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]