After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740937 - Wrong information for non-node objects
Wrong information for non-node objects
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on: 740957
Blocks:
 
 
Reported: 2014-11-30 22:03 UTC by Marcus Lundblad
Modified: 2014-12-03 18:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
User osm-type+osm-id as index for places. (6.72 KB, patch)
2014-12-01 10:29 UTC, Jonas Danielsson
none Details | Review
overpass: Use the osm-type to look up data (2.09 KB, patch)
2014-12-01 10:29 UTC, Jonas Danielsson
none Details | Review
User osm-type+osm-id as index for places. (6.83 KB, patch)
2014-12-01 10:44 UTC, Jonas Danielsson
none Details | Review
overpass: Use the osm-type to look up data (2.09 KB, patch)
2014-12-01 10:44 UTC, Jonas Danielsson
none Details | Review
User osm-type+osm-id as index for places. (6.82 KB, patch)
2014-12-01 14:31 UTC, Jonas Danielsson
needs-work Details | Review
overpass: Use the osm-type to look up data (2.09 KB, patch)
2014-12-01 14:31 UTC, Jonas Danielsson
accepted-commit_now Details | Review
mapBubble: Always convert to GeocodePlace to Place (1.40 KB, patch)
2014-12-02 06:10 UTC, Jonas Danielsson
committed Details | Review
Use osm-type+osm-id as index for places. (7.03 KB, patch)
2014-12-02 06:10 UTC, Jonas Danielsson
none Details | Review
Use osm-type+osm-id as index for places. (6.60 KB, patch)
2014-12-02 06:12 UTC, Jonas Danielsson
accepted-commit_now Details | Review
Use osm-type+osm-id as index for places. (6.56 KB, patch)
2014-12-03 07:07 UTC, Jonas Danielsson
committed Details | Review
overpass: Use the osm-type to look up data (2.47 KB, patch)
2014-12-03 07:07 UTC, Jonas Danielsson
committed Details | Review

Description Marcus Lundblad 2014-11-30 22:03:17 UTC
When searching for an object that is not a single node in OSM (i.e. a "way", such as a building), the query passed on to overpass retrieves the wrong information.
The query is always using "node(osm_id)" (where osm_id is the ID in OSM). But the OSM IDs are only unique per object type (node, way, relation).

For example, searching for "Uppsala slott" will generate the following overpass query:
http://overpass-api.de/api/interpreter?data=[timeout:180][out:json][maxsize:536870912];node(24433739);out%20body%20qt%201000000;

Adjusting this manually (and pasting into a browser location field):
http://overpass-api.de/api/interpreter?data=[timeout:180][out:json][maxsize:536870912];way(24433739);out%20body%20qt%201000000;

will generate the correct query response (with f.ex. the wikipedia reference).

I suspect this would also affect the place store (as far as I can see, it uses the same OSM ID to store json objects, so there is the risk of getting duplicates).
Comment 1 Jonas Danielsson 2014-12-01 07:53:17 UTC
Dang!

This is indeed an issue :( We have assumed that osm_id are unique across all objects. So we indeed use them to index in place store.

This is a big issue since I don't think we have a clear way to know if a place we get from geocodeglib is a way, node or relation. We would need to patch geocodeglib to expose the osm_type tag.

Thanks for exposing our incompetence Marcus! So we can fix this mess up.
Comment 2 Jonas Danielsson 2014-12-01 10:29:08 UTC
Created attachment 291873 [details] [review]
User osm-type+osm-id as index for places.

The osm id is only unique within a type of place such as
node, way or relation. We need the osm-type to make the index
unique.
Comment 3 Jonas Danielsson 2014-12-01 10:29:12 UTC
Created attachment 291874 [details] [review]
overpass: Use the osm-type to look up data
Comment 4 Jonas Danielsson 2014-12-01 10:30:17 UTC
So could you try with these two patches applied?
And also the one against geocode-glib in the "depends on" field?

You might have to clear the placestore. (~/.local/share/maps-places.json is the location of mine).
Comment 5 Jonas Danielsson 2014-12-01 10:44:04 UTC
Created attachment 291875 [details] [review]
User osm-type+osm-id as index for places.

The osm id is only unique within a type of place such as
node, way or relation. We need the osm-type to make the index
unique.
Comment 6 Jonas Danielsson 2014-12-01 10:44:07 UTC
Created attachment 291876 [details] [review]
overpass: Use the osm-type to look up data
Comment 7 Jonas Danielsson 2014-12-01 14:31:04 UTC
Created attachment 291888 [details] [review]
User osm-type+osm-id as index for places.

The osm id is only unique within a type of place such as
node, way or relation. We need the osm-type to make the index
unique.
Comment 8 Jonas Danielsson 2014-12-01 14:31:09 UTC
Created attachment 291889 [details] [review]
overpass: Use the osm-type to look up data
Comment 9 Marcus Lundblad 2014-12-01 20:51:23 UTC
Tested the patch (including the one against geocode-glib) and it works great!
Comment 10 Mattias Bengtsson 2014-12-02 02:02:23 UTC
Review of attachment 291888 [details] [review]:

::: src/placeStore.js
@@ +94,3 @@
+
+        return type + '-' + place.osm_id;
+    },

If possible I'd like this to be a method or property on Place instead.

@@ +109,3 @@
             this._removeIf((function(model, iter) {
                 let p = model.get_value(iter, Columns.PLACE);
+                return this._getKey(p) === this._getKey(place);

Then this would be p.getKey() === place.getKey() or p.key === place.key (depending on whether we make this a property or method).
Comment 11 Mattias Bengtsson 2014-12-02 02:04:53 UTC
Review of attachment 291889 [details] [review]:

ACK
Comment 12 Jonas Danielsson 2014-12-02 05:59:55 UTC
Review of attachment 291888 [details] [review]:

Thanks for review!

::: src/placeStore.js
@@ +94,3 @@
+
+        return type + '-' + place.osm_id;
+    },

Are you sure? The key is pretty specific to the placeStore, it does not feel like a property of the place. Maybe if we call it place.uniqueID?
Comment 13 Jonas Danielsson 2014-12-02 06:10:46 UTC
Created attachment 291959 [details] [review]
mapBubble: Always convert to GeocodePlace to Place
Comment 14 Jonas Danielsson 2014-12-02 06:10:55 UTC
Created attachment 291960 [details] [review]
Use osm-type+osm-id as index for places.

The osm id is only unique within a type of place such as
node, way or relation. We need the osm-type to make the index
unique.
Comment 15 Jonas Danielsson 2014-12-02 06:12:54 UTC
Created attachment 291961 [details] [review]
Use osm-type+osm-id as index for places.

The osm id is only unique within a type of place such as
node, way or relation. We need the osm-type to make the index
unique.
Comment 16 Mattias Bengtsson 2014-12-02 14:41:34 UTC
Review of attachment 291888 [details] [review]:

::: src/placeStore.js
@@ +94,3 @@
+
+        return type + '-' + place.osm_id;
+    },

Not entirely sure actually (after having thought about it), but leaning towards yes. place.uniqueId is probably better in that case as you say.
Comment 17 Mattias Bengtsson 2014-12-02 14:46:25 UTC
Review of attachment 291961 [details] [review]:

ACK
Comment 18 Mattias Bengtsson 2014-12-02 14:48:24 UTC
Review of attachment 291959 [details] [review]:

Nit: Always convert GeocodePlace to Place

(ACK after that)
Comment 19 Jonas Danielsson 2014-12-03 07:07:52 UTC
Created attachment 292047 [details] [review]
Use osm-type+osm-id as index for places.

The osm id is only unique within a type of place such as
node, way or relation. We need the osm-type to make the index
unique.
Comment 20 Jonas Danielsson 2014-12-03 07:07:56 UTC
Created attachment 292048 [details] [review]
overpass: Use the osm-type to look up data
Comment 21 Mattias Bengtsson 2014-12-03 16:52:57 UTC
Review of attachment 292047 [details] [review]:

ACK
Comment 22 Mattias Bengtsson 2014-12-03 16:54:03 UTC
Review of attachment 292048 [details] [review]:

ACK
Comment 23 Jonas Danielsson 2014-12-03 18:39:05 UTC
Attachment 291959 [details] pushed as ad416a2 - mapBubble: Always convert to GeocodePlace to Place
Attachment 292047 [details] pushed as fed9e06 - Use osm-type+osm-id as index for places.
Attachment 292048 [details] pushed as d86b27c - overpass: Use the osm-type to look up data