[gnome-maps/wip/mlundblad/photon-geocode: 4/14] 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: 4/14] utils: Add function to get country of coordinates
- Date: Wed, 5 Jun 2019 20:40:19 +0000 (UTC)
commit 6f65e0b80b909e2fee53cdc5b15b657877ec219c
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]