-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
1 parent
c963cd9
commit 369e79b
Showing
11 changed files
with
303 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/src/main/java/fr/free/nrw/commons/nearby/model/NearbyQueryParams.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package fr.free.nrw.commons.nearby.model | ||
|
||
import fr.free.nrw.commons.location.LatLng | ||
|
||
sealed class NearbyQueryParams { | ||
class Rectangular(val screenTopRight: LatLng, val screenBottomLeft: LatLng) : | ||
NearbyQueryParams() | ||
|
||
class Radial(val center: LatLng, val radiusInKm: Float) : NearbyQueryParams() | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/resources/queries/radius_query_for_item_count.rq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
25 changes: 25 additions & 0 deletions
25
app/src/main/resources/queries/radius_query_for_nearby_monuments.rq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
8 changes: 8 additions & 0 deletions
8
app/src/main/resources/queries/rectangle_query_for_item_count.rq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.