Page MenuHomePhabricator

[feature] provide mapview on across 180 longitude line, selection with wikibase:box
Open, MediumPublic

Description

The following bounding box stretches across 180 long. The wikibase:box correctly interprets the coordinates, but the map can't zoom on the area.

#defaultView:Map
SELECT * WHERE {

wd:Q47863 wdt:P625 ?SCloc . #Midway Atoll as NorthEast Point(-177.35 28.2)
wd:Q43296 wdt:P625 ?SJloc . #Wake Island as SouthWest Point(166.633333333 19.3)
SERVICE wikibase:box {
    ?place wdt:P625 ?location .
    bd:serviceParam wikibase:cornerNorthEast ?SCloc .
    bd:serviceParam wikibase:cornerSouthWest ?SJloc .
  }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . ?place rdfs:label ?placeLabel }

}

https://query.wikidata.org/?#%23defaultView%3AMap%0ASELECT%20%2a%20WHERE%20%7B%0A%20%20wd%3AQ47863%20wdt%3AP625%20%3FSCloc%20.%20%23Midway%20Atoll%20as%20NorthEast%20Point%28-177.35%2028.2%29%0A%20%20wd%3AQ43296%20wdt%3AP625%20%3FSJloc%20.%20%23Wake%20Island%20as%20SouthWest%20Point%28166.633333333%2019.3%29%0A%20%20SERVICE%20wikibase%3Abox%20%7B%0A%20%20%20%20%20%20%3Fplace%20wdt%3AP625%20%3Flocation%20.%0A%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3AcornerNorthEast%20%3FSCloc%20.%0A%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3AcornerSouthWest%20%3FSJloc%20.%0A%20%20%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%20%3Fplace%20rdfs%3Alabel%20%3FplaceLabel%20%7D%0A%7D

Event Timeline

MaxSem subscribed.

Please don't add unrelated projects.

Smalyshev triaged this task as Medium priority.
Smalyshev moved this task from Current work to GUI on the Wikidata-Query-Service board.

Sorry I don't understand the actual problem. Could you please provide steps to reproduce and a screenshot if possible?

I think the issue is that if the box crosses the 180/-180 longitude line, the points show on the different sides of the map - i.e. left and right borders - and if you move/zoom the map around so that the line would be in the center of the screen, only one half of points is displayed, and the other half goes off screen.

yes. Ideally the map would just focus on the area covered by the bounding box.

I am not sure if we can solve this maybe @aude has an idea.

How does the zoom calculation currently work?

Maybe a manual option to center the map on 180° could do?

Starting from there points would be split between the left and right and focus determined as currently.

It might be interesting for APAC users in general.

What could work is the following:

If the zoom is for more than 270°, it could attempt to re-calculate it on a center with 180°.

If this leads to less than 270°, use the map centered on 180°.

Not sure if 270° is the ideal limit: it could be 330°, but it neededn't be 360°.

Jonas added a project: patch-welcome.
Jonas subscribed.

So it seems we cannot fix the issue, but you could report it to upstream: leafletjs.com

What prevents us from fixing this ?

Esc3300 renamed this task from [bug] mapview on Wikidata Query Service misaligned across 180 longitude line, selection with wikibase:box to [feature] provide mapview on across 180 longitude line, selection with wikibase:box.Jul 27 2017, 2:21 PM

We use a library for maps: leafletjs.com

It is possible to manually adjust the coordinates to get the desired display using the same method I used for my locations in Fiji example, e.g. this query. Unfortunately I had to split it into two parts to stop it timing out so it's more complicated than it should be.

Why not provide an additional map view centred on 180° so that users can choose a Pacific-friendly style when it's a better fit for their query? That would be simple to implement because (as you can see above) if you provide Leaflet with coordinates ranging from 0° to 360°, it will map them from 0° to 360°.