mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Nearby: No longer keeps loading until timeout when map is zoomed out (#6070)
* Nearby: Search for actual map center * Add query syntax and methods * Nearby: Added binary search for loading pins * Add NearbyQueryParams and refactor * Add unit tests and complete implementation * Nearby: Increase max radius from 100km to 300km * Nearby: Centermost pins now appear on top * getNearbyItemCount: Added javadoc --------- Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
parent
c963cd9ea4
commit
369e79be5e
11 changed files with 303 additions and 37 deletions
|
|
@ -0,0 +1,9 @@
|
|||
SELECT (COUNT(?item) AS ?itemCount)
|
||||
WHERE {
|
||||
# Around given location.
|
||||
SERVICE wikibase:around {
|
||||
?item wdt:P625 ?location.
|
||||
bd:serviceParam wikibase:center "Point(${LONG} ${LAT})"^^geo:wktLiteral.
|
||||
bd:serviceParam wikibase:radius "${RAD}" . # Radius in kilometers.
|
||||
}
|
||||
}
|
||||
12
app/src/main/resources/queries/radius_query_for_nearby.rq
Normal file
12
app/src/main/resources/queries/radius_query_for_nearby.rq
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
SELECT
|
||||
?item
|
||||
(SAMPLE(?location) as ?location)
|
||||
WHERE {
|
||||
# Around given location.
|
||||
SERVICE wikibase:around {
|
||||
?item wdt:P625 ?location.
|
||||
bd:serviceParam wikibase:center "Point(${LONG} ${LAT})"^^geo:wktLiteral.
|
||||
bd:serviceParam wikibase:radius "${RAD}" . # Radius in kilometers.
|
||||
}
|
||||
}
|
||||
GROUP BY ?item
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
SELECT
|
||||
?item
|
||||
(SAMPLE(?location) as ?location)
|
||||
(SAMPLE(?monument) AS ?monument)
|
||||
WHERE {
|
||||
# Around given location.
|
||||
SERVICE wikibase:around {
|
||||
?item wdt:P625 ?location.
|
||||
bd:serviceParam wikibase:center "Point(${LONG} ${LAT})"^^geo:wktLiteral.
|
||||
bd:serviceParam wikibase:radius "${RAD}" . # Radius in kilometers.
|
||||
}
|
||||
|
||||
# Wiki Loves Monuments
|
||||
OPTIONAL {?item p:P1435 ?monument}
|
||||
OPTIONAL {?item p:P2186 ?monument}
|
||||
OPTIONAL {?item p:P1459 ?monument}
|
||||
OPTIONAL {?item p:P1460 ?monument}
|
||||
OPTIONAL {?item p:P1216 ?monument}
|
||||
OPTIONAL {?item p:P709 ?monument}
|
||||
OPTIONAL {?item p:P718 ?monument}
|
||||
OPTIONAL {?item p:P5694 ?monument}
|
||||
OPTIONAL {?item p:P3426 ?monument}
|
||||
|
||||
}
|
||||
GROUP BY ?item
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
SELECT (COUNT(?item) AS ?itemCount)
|
||||
WHERE {
|
||||
SERVICE wikibase:box {
|
||||
?item wdt:P625 ?location.
|
||||
bd:serviceParam wikibase:cornerWest "Point(${LONG_WEST} ${LAT_WEST})"^^geo:wktLiteral.
|
||||
bd:serviceParam wikibase:cornerEast "Point(${LONG_EAST} ${LAT_EAST})"^^geo:wktLiteral.
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,5 @@ WHERE {
|
|||
bd:serviceParam wikibase:cornerWest "Point(${LONG_WEST} ${LAT_WEST})"^^geo:wktLiteral.
|
||||
bd:serviceParam wikibase:cornerEast "Point(${LONG_EAST} ${LAT_EAST})"^^geo:wktLiteral.
|
||||
}
|
||||
|
||||
}
|
||||
GROUP BY ?item
|
||||
Loading…
Add table
Add a link
Reference in a new issue