Page MenuHomePhabricator

[feature request] allow selection by East and West corners on Wikidata Query Service wikibase:box
Closed, ResolvedPublic

Description

Per https://www.mediawiki.org/wiki/Wikidata_query_service/User_Manual#Search_within_box and https://phabricator.wikimedia.org/T139823
the following should be supported

wikibase:cornerSouthWest The south-west corner of the box.
wikibase:cornerNorthEast The north-east corner of the box.
wikibase:cornerSouthEast The south-east corner of the box.
wikibase:cornerNorthWest The north-west corner of the box.

This feature request suggests to add the following:
wikibase:cornerWest A west corner of the box.
wikibase:cornerEast An east corner of the box.

Depending on the https://en.wikipedia.org/wiki/Latitude value, the server would determine if it was S or N.
If latitude of W > latitude of E = W is NW, E is SE,
otherwise it's SW and NE.

Sample query, based on the current sample one, should give comparable results:

Schools between San Jose, CA and Sacramento, CA

#defaultView:Map
SELECT * WHERE {
wd:Q986857 wdt:P625 ?SJloc .
wd:Q17152020 wdt:P625 ?SCloc .
SERVICE wikibase:box {
    ?place wdt:P625 ?location .
    bd:serviceParam wikibase:cornerWest ?SJloc .
    bd:serviceParam wikibase:cornerEast ?SCloc .
  }
?place wdt:P31/wdt:P279* wd:Q3914 .
}

Link: https://query.wikidata.org/#%23Schools%20between%20San%20Jose%2C%20CA%20and%20Sacramento%2C%20CA%0A%23defaultView%3AMap%0ASELECT%20%2a%20WHERE%20%7B%0A%0Awd%3AQ986857%20wdt%3AP625%20%3FSJloc%20.%0Awd%3AQ17152020%20wdt%3AP625%20%3FSCloc%20.%0ASERVICE%20wikibase%3Abox%20%7B%0A%20%20%20%20%3Fplace%20wdt%3AP625%20%3Flocation%20.%0A%20%20%20%20bd%3AserviceParam%20wikibase%3AcornerWest%20%3FSJloc%20.%0A%20%20%20%20bd%3AserviceParam%20wikibase%3AcornerEast%20%3FSCloc%20.%0A%20%20%7D%0A%3Fplace%20wdt%3AP31%2Fwdt%3AP279%2a%20wd%3AQ3914%20.%0A%0A%7D

Event Timeline

Esc3300 created this task.Jul 9 2016, 5:03 AM
Restricted Application added a project: Discovery. · View Herald TranscriptJul 9 2016, 5:03 AM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald Transcript

Change 300456 had a related patch set uploaded (by Smalyshev):
Add funxtionality to allow search box with any pair of coordinates.

https://gerrit.wikimedia.org/r/300456

Change 300456 merged by jenkins-bot:
Add functionality to allow search box with any pair of coordinates.

https://gerrit.wikimedia.org/r/300456

Smalyshev updated the task description. (Show Details)
Smalyshev triaged this task as Normal priority.Jul 27 2016, 5:47 PM

I think adding just wikibase:cornerWest/wikibase:cornerEast should be enough, since with that you can specify any diagonal corners.

Ok for me. I prefer this feature over T139823

Using this approach also avoids having to check if someone isn't using NE & SE, etc.

Smalyshev closed this task as Resolved.Aug 1 2016, 9:21 PM
Esc3300 updated the task description. (Show Details)Aug 2 2016, 7:18 AM