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 719585 - Add support for OSM viewbox and bound parameters
Add support for OSM viewbox and bound parameters
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: 719586 719834
 
 
Reported: 2013-11-29 22:22 UTC by Jonas Danielsson
Modified: 2013-12-05 15:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
forward: make answer_count a property (4.34 KB, patch)
2013-11-29 22:24 UTC, Jonas Danielsson
accepted-commit_now Details | Review
forward: add search area property (13.84 KB, patch)
2013-11-29 22:24 UTC, Jonas Danielsson
needs-work Details | Review
forward: add bounded property (6.31 KB, patch)
2013-11-29 22:24 UTC, Jonas Danielsson
accepted-commit_now Details | Review
forward: make answer_count a property (4.34 KB, patch)
2013-12-03 19:05 UTC, Jonas Danielsson
needs-work Details | Review
Add new object GeocodeBoundingBox (16.39 KB, patch)
2013-12-03 19:05 UTC, Jonas Danielsson
needs-work Details | Review
forward: add search area property (7.55 KB, patch)
2013-12-03 19:05 UTC, Jonas Danielsson
none Details | Review
forward: add bounded property (6.13 KB, patch)
2013-12-03 19:05 UTC, Jonas Danielsson
none Details | Review
forward: add bounded property (6.15 KB, patch)
2013-12-03 21:00 UTC, Jonas Danielsson
committed Details | Review
forward: add search area property (7.55 KB, patch)
2013-12-03 21:27 UTC, Jonas Danielsson
committed Details | Review
forward: make answer_count a property (4.34 KB, patch)
2013-12-04 21:34 UTC, Jonas Danielsson
committed Details | Review
Add new object GeocodeBoundingBox (16.45 KB, patch)
2013-12-04 21:34 UTC, Jonas Danielsson
none Details | Review
Add new object GeocodeBoundingBox (16.64 KB, patch)
2013-12-04 21:39 UTC, Jonas Danielsson
committed Details | Review

Description Jonas Danielsson 2013-11-29 22:22:51 UTC
I want to add support for the viewbox and bound paramters from OSM to geocode forward search.

The viewbox parameter is a bounding box that specifies a geographic area to search. If the bounded paramater is 1 then the search is restricted to only items in the area. If the bounded parameter is 0 then the area is treated as "preferred".

I will attach three patches.

The first will make the private variable answer_count to a property.

The second will add the search-area property and a new type GeocodeBoundingBox and will have the bounded parameter to osm as always 1 if a search-area is set.

The third will add a bounded property to control the bounded parameter of osm.

Thanks
Jonas
Comment 1 Jonas Danielsson 2013-11-29 22:24:06 UTC
Created attachment 263173 [details] [review]
forward: make answer_count a property
Comment 2 Jonas Danielsson 2013-11-29 22:24:22 UTC
Created attachment 263174 [details] [review]
forward: add search area property

Nominatim allows searches to be limited to a viewbox. In order
to take advantage of this we need a new property.

The search area is specified as a bounding box of latitude and
longitude.
Comment 3 Jonas Danielsson 2013-11-29 22:24:33 UTC
Created attachment 263175 [details] [review]
forward: add bounded property

The bounded boolean property decides if the search-area property
sets an hard limit or not. If false the search-area is simply the
prefered area for search. If true it restricts results to only items
within the search-area.
Comment 4 Zeeshan Ali 2013-12-02 15:55:12 UTC
Review of attachment 263173 [details] [review]:

ACK w/ the corrected.

::: geocode-glib/geocode-forward.c
@@ +994,3 @@
+geocode_forward_get_answer_count (GeocodeForward *forward)
+{
+	g_return_if_fail (GEOCODE_IS_FORWARD (forward));

you need to use g_return_val_if_fail here since function has a return value.
Comment 5 Zeeshan Ali 2013-12-02 16:03:18 UTC
Review of attachment 263174 [details] [review]:

FWIW, I would have divided this into two patches, one to add the new BoundingBox type and the other that makes use of it.

::: geocode-glib/geocode-bounding-box.c
@@ +25,3 @@
+G_DEFINE_BOXED_TYPE (GeocodeBoundingBox, geocode_bounding_box,
+                     geocode_bounding_box_copy,
+                     geocode_bounding_box_free)

Lets have a proper GObject here, makes it much easier for higher-level-languages/GIR to handle it. Besides location is a simpler type and its a GObject. IMHO Boxed types are only good for laziness now a days mostly unless you intend to create thousands or millions of instances at the same time.

::: geocode-glib/geocode-forward.c
@@ +1035,3 @@
+				box->left, box->top, box->right, box->bottom);
+
+	geocode_forward_add (forward, "viewbox", area);

this call creates its own copy for key and value so you need to g_free (area)
Comment 6 Zeeshan Ali 2013-12-02 16:08:39 UTC
Review of attachment 263175 [details] [review]:

Looks good otherwise.

::: geocode-glib/geocode-forward.c
@@ +182,3 @@
+	* GeocodeForward:bounded:
+	*
+	* If set to #TRUE then only results in the search-area bounding box are

search-area -> #GeocodeForward:search-area to make it a link.

@@ +1121,3 @@
+geocode_forward_get_bounded (GeocodeForward *forward)
+{
+	g_return_if_fail (GEOCODE_IS_FORWARD (forward));

You need to use g_return_val_if_fail .
Comment 7 Jonas Danielsson 2013-12-03 19:05:05 UTC
Created attachment 263425 [details] [review]
forward: make answer_count a property
Comment 8 Jonas Danielsson 2013-12-03 19:05:18 UTC
Created attachment 263426 [details] [review]
Add new object GeocodeBoundingBox

Add an object representing a geographical area.
Comment 9 Jonas Danielsson 2013-12-03 19:05:31 UTC
Created attachment 263427 [details] [review]
forward: add search area property

Nominatim allows searches to be limited to a viewbox. In
order to take advantage of this we need a new property.

The search area is specified as a GeocodeBoundingBox.
Comment 10 Jonas Danielsson 2013-12-03 19:05:39 UTC
Created attachment 263428 [details] [review]
forward: add bounded property

The bounded boolean property decides if the search-area property
sets an hard limit or not. If false the search-area is simply the
prefered area for search. If true it restricts results to only items
within the search-area.
Comment 11 Jonas Danielsson 2013-12-03 21:00:44 UTC
Created attachment 263439 [details] [review]
forward: add bounded property

The bounded boolean property decides if the search-area property
sets an hard limit or not. If false the search-area is simply the
prefered area for search. If true it restricts results to only items
within the search-area.
Comment 12 Jonas Danielsson 2013-12-03 21:27:00 UTC
Created attachment 263447 [details] [review]
forward: add search area property

Nominatim allows searches to be limited to a viewbox. In
order to take advantage of this we need a new property.

The search area is specified as a GeocodeBoundingBox.
Comment 13 Zeeshan Ali 2013-12-04 16:12:28 UTC
Review of attachment 263425 [details] [review]:

Sorry still needs a bit more work :(

::: geocode-glib/geocode-forward.c
@@ +136,3 @@
+				   G_MAXINT,
+				   DEFAULT_ANSWER_COUNT,
+				   G_PARAM_WRITABLE |

So property is only writable (not readable) and you are only providing a getter (no setter). I think you want the prop to be readable as well (G_PARAM_READWRITE) and provide a setter too.
Comment 14 Zeeshan Ali 2013-12-04 16:19:33 UTC
Review of attachment 263426 [details] [review]:

Looks good otherwise.

::: geocode-glib/geocode-bounding-box.c
@@ +187,3 @@
+                                     90,
+                                     0.0,
+                                     G_PARAM_READWRITE |

Since setters are not public, I guess you don't want these props to be writable after creation so you also want G_PARAM_CONSTRUCT_ONLY here.
Comment 15 Zeeshan Ali 2013-12-04 16:25:03 UTC
Review of attachment 263447 [details] [review]:

Looks good.
Comment 16 Jonas Danielsson 2013-12-04 21:32:49 UTC
(In reply to comment #13)
> Review of attachment 263425 [details] [review]:
> 
> Sorry still needs a bit more work :(
> 

It's me that should be sorry :)
I've worked on these patches on stolen moments when the kid sleeps or I otherwise find time, I am super grateful for review.

> ::: geocode-glib/geocode-forward.c
> @@ +136,3 @@
> +                   G_MAXINT,
> +                   DEFAULT_ANSWER_COUNT,
> +                   G_PARAM_WRITABLE |
> 
> So property is only writable (not readable) and you are only providing a getter
> (no setter). I think you want the prop to be readable as well
> (G_PARAM_READWRITE) and provide a setter too.

Yes, it should be READWRITE. The setter is there tho, only I did not provide it, it was there from before.
Comment 17 Jonas Danielsson 2013-12-04 21:33:14 UTC
(In reply to comment #14)
> Review of attachment 263426 [details] [review]:
> 
> Looks good otherwise.
> 
> ::: geocode-glib/geocode-bounding-box.c
> @@ +187,3 @@
> +                                     90,
> +                                     0.0,
> +                                     G_PARAM_READWRITE |
> 
> Since setters are not public, I guess you don't want these props to be writable
> after creation so you also want G_PARAM_CONSTRUCT_ONLY here.

Agreed, thanks.
Comment 18 Jonas Danielsson 2013-12-04 21:34:05 UTC
Created attachment 263538 [details] [review]
forward: make answer_count a property
Comment 19 Jonas Danielsson 2013-12-04 21:34:33 UTC
Created attachment 263539 [details] [review]
Add new object GeocodeBoundingBox

Add an object representing a geographical area.
Comment 20 Jonas Danielsson 2013-12-04 21:39:12 UTC
Created attachment 263540 [details] [review]
Add new object GeocodeBoundingBox

Add an object representing a geographical area.
Comment 21 Zeeshan Ali 2013-12-04 23:06:00 UTC
Review of attachment 263439 [details] [review]:

Looks good. Please push w/ this corrected.

::: geocode-glib/geocode-forward.c
@@ +1091,3 @@
+ * #GeocodeForward:search-area bounding box.
+ *
+ * Set the bounded property.

If you are not going to document inline, at least to link the to the property. :)

@@ +1134,3 @@
+ * @forward: a #GeocodeForward representing a query
+ *
+ * Gets the bounded property.

same here.
Comment 22 Zeeshan Ali 2013-12-04 23:08:57 UTC
Review of attachment 263538 [details] [review]:

ACK
Comment 23 Zeeshan Ali 2013-12-04 23:13:16 UTC
Review of attachment 263540 [details] [review]:

ack
Comment 24 Jonas Danielsson 2013-12-05 15:07:51 UTC
Attachment 263439 [details] pushed as eca1275 - forward: add bounded property
Attachment 263447 [details] pushed as f153ec7 - forward: add search area property
Attachment 263538 [details] pushed as 7d5da03 - forward: make answer_count a property
Attachment 263540 [details] pushed as aed6c80 - Add new object GeocodeBoundingBox