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 740957 - Add osm-type property
Add osm-type property
Status: RESOLVED FIXED
Product: geocode-glib
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: geocode-glib maintainer(s)
geocode-glib maintainer(s)
Depends on:
Blocks: 740937
 
 
Reported: 2014-12-01 09:44 UTC by Jonas Danielsson
Modified: 2014-12-03 11:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
place: Add osm-type property (6.75 KB, patch)
2014-12-01 09:44 UTC, Jonas Danielsson
none Details | Review
place: Add osm-type property (6.73 KB, patch)
2014-12-01 10:25 UTC, Jonas Danielsson
none Details | Review
place: Add osm-type property (8.72 KB, patch)
2014-12-03 06:57 UTC, Jonas Danielsson
needs-work Details | Review
place: Add osm-type property (8.27 KB, patch)
2014-12-03 11:26 UTC, Jonas Danielsson
committed Details | Review

Description Jonas Danielsson 2014-12-01 09:44:04 UTC
The osm id is only unique within an object type. It would be nice to add the osm-type property so that we can identify the result from a search to an osm object.
Comment 1 Jonas Danielsson 2014-12-01 09:44:24 UTC
Created attachment 291869 [details] [review]
place: Add osm-type property

The osm type specifies if the place is a node a place or a relation.
The osm id is only unique within the object type so this is needed
in order for the osm-id to have a meaning.
Comment 2 Jonas Danielsson 2014-12-01 10:25:18 UTC
Created attachment 291872 [details] [review]
place: Add osm-type property

The osm type specifies if the place is a node a place or a relation.
The osm id is only unique within the object type so this is needed
in order for the osm-id to have a meaning.
Comment 3 Jonas Danielsson 2014-12-03 06:57:07 UTC
Created attachment 292046 [details] [review]
place: Add osm-type property

The osm type specifies if the place is a node a place or a relation.
The osm id is only unique within the object type so this is needed
in order for the osm-id to have a meaning.
Comment 4 Bastien Nocera 2014-12-03 11:07:56 UTC
Review of attachment 292046 [details] [review]:

Looks fine otherwise.

::: geocode-glib/geocode-forward.c
@@ +641,3 @@
+
+        if (g_str_equal (key, "osm_type")) {
+                if (g_str_equal (value, "node")) {

As you've registered an enum, you should be able to do something like:
GEnumClass *class = G_ENUM_CLASS(...);
GEnumValue *evalue = g_enum_get_value_by_nick (class, value);
if (evalue)
  g_object_set (G_OBJECT (place), "osm-type", evalue->value, NULL);
else
  g_warning ("Unsupported osm-type %s", value);

::: geocode-glib/geocode-place.h
@@ +147,3 @@
+ * @GEOCODE_PLACE_OSM_TYPE_NODE: Defines a point in space.
+ * @GEOCODE_PLACE_OSM_TYPE_RELATION: Used to explain how other elements work together.
+ * @GEOCODE_PLACE_OSM_TYPE_WAY: Defines a linear feature and area boundries.

boundaries
Comment 5 Jonas Danielsson 2014-12-03 11:25:38 UTC
Review of attachment 292046 [details] [review]:

Thanks for review!
Comment 6 Jonas Danielsson 2014-12-03 11:26:08 UTC
Created attachment 292062 [details] [review]
place: Add osm-type property

The osm type specifies if the place is a node a place or a relation.
The osm id is only unique within the object type so this is needed
in order for the osm-id to have a meaning.
Comment 7 Bastien Nocera 2014-12-03 11:29:32 UTC
Review of attachment 292062 [details] [review]:

Looks good to commit after the ref leak fix.

::: geocode-glib/geocode-forward.c
@@ +641,3 @@
+
+        if (g_str_equal (key, "osm_type")) {
+                gpointer ref = g_type_class_ref (geocode_place_osm_type_get_type ());

Don't forget g_type_class_unref()