[gnome-maps/wip/mlundblad/additional-place-icons: 2/6] place: Add osmKey and osmValue parameters




commit a5724889085c20f73ccc01abcd81c984f289142f
Author: Marcus Lundblad <ml update uu se>
Date:   Tue Apr 6 21:51:33 2021 +0200

    place: Add osmKey and osmValue parameters
    
    Add parameters for most significant OSM
    type, corresponding to the osm_key/osm_value
    parameters from the Photon geocoder response.

 src/place.js | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
---
diff --git a/src/place.js b/src/place.js
index 299b6ef5..0ccb7c91 100644
--- a/src/place.js
+++ b/src/place.js
@@ -100,6 +100,12 @@ class Place extends Geocode.Place {
         this._nativeName = params.nativeName;
         delete params.nativeName;
 
+        this._osmKey = params.osmKey;
+        delete params.osmKey;
+
+        this._osmValue = params.osmValue;
+        delete params.osmValue;
+
         if (params.place) {
             params = { osm_id: params.place.osm_id,
                        osm_type: params.place.osm_type,
@@ -243,6 +249,22 @@ class Place extends Geocode.Place {
         this._nativeName = nativeName;
     }
 
+    /**
+     * Most important OSM tag for the place ('amenity', 'shop', and so on).
+     * This corresponds to the osm_key parameter in Photon geocoder
+     */
+    get osmKey() {
+        return this._osmKey;
+    }
+
+    /**
+     * Value for the most important OSM tag.
+     * This corresponds to the osm_value parameter in Photon geocoder.
+     */
+    get osmValue() {
+        return this._osmValue;
+    }
+
     toJSON() {
         let bounding_box = null;
 
@@ -260,6 +282,8 @@ class Place extends Geocode.Place {
 
         return { id: this.osm_id,
                  osm_type: this.osm_type,
+                 osmKey: this._osmKey,
+                 osmValue: this._osmValue,
                  place_type: this.place_type,
                  name: this.name,
                  nativeName: this.nativeName,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]