Page MenuHomePhabricator

[Story] Show map for coordinate diffs
Closed, ResolvedPublic

Description

When someone changes coordinates, the diff (e.g. https://www.wikidata.org/w/index.php?title=Q23311&diff=108698259&oldid=103394905) shows what the coordinates changed from and to, but it's hard (near impossible) to check whether the change was good or bad without manually looking up both the old and new coordinates on a map, which is time consuming to do. I usually can't be bothered to and I imagine most other people are the same, so I think it would be useful if the diffs included a little map.

This seems like something that https://maps.wikimedia.org/ (https://www.mediawiki.org/wiki/Maps) would be useful for. Right now it doesn't allow access from wikidata.org though.

I think this could be turned into a gadget fairly easily. I was able to insert maps using OSM's tiles (which shouldn't be used) with a bit of code I quickly put together (below), which seems to work, although it definitely needs some improvements, including:

  • a different source of tiles - can we get access to maps.wikimedia.org, or is there some other source that can be used?
  • proper attribution - should be easy to add, but depends on the tile source
  • Leaflet should ideally not be loaded from an external source - is there a copy of Leaflet hosted somewhere on Wikimedia servers that can be used? or perhaps another slippy map? (I do like Leaflet though...)
  • it doesn't check that the globe is Q2 - checking should be easy, but what about when it's not Q2? I seem to recall that GeoHack can display Mars maps, but I haven't looked into it
  • it currently always uses the same zoom level - it seems like it should be possible to come up with an appropriate zoom level using the precision of the coordinates, but I haven't looked into that either. A quick search did find http://wiki.openstreetmap.org/wiki/Zoom_levels though

Event Timeline

Nikki raised the priority of this task from to Needs Triage.
Nikki updated the task description. (Show Details)
Nikki added a project: Wikidata-Gadgets.
Nikki subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Oh and here's a screenshot of that code, except using Mapbox tiles:

Bildschirmfoto - 20.10.2015 - 02:11:41.png (768×1 px, 418 KB)

I have been experimenting coord diffs too, but with L.circle() instead of L.marker().

Agreed. Let's try this out as a gadget for a bit and then move it into Wikibase proper?

It would be great if someone can check the code and add it as a gadget.

@Nikki, is it possible to make the map responsive in width? It's overflowing on my screen now.

I created https://www.wikidata.org/wiki/User:Nikki/CoordinateDiffMap.js if anyone wants to test it.

I've tried to address all the bullet points in the description (e.g. it now uses maps.wikimedia.org and loads Leaflet from there too). Setting the zoom level from the precision doesn't work as well as I'd hoped, but at least it means that the map doesn't end up being zoomed really far in for coordinates which are only specified to the nearest degree or so.

@Sjoerddebruin: I think I've managed to fix that.

Couple of example diffs if you don't have any handy:
https://www.wikidata.org/w/index.php?diff=108698259
https://www.wikidata.org/w/index.php?diff=330618596 (the globe changed, so you should only see a map for the old value)

Maps has been enabled on Wikidata. Enjoy. T138030

Please do not load Leaflet. Use Kartographer extension (already enabled on Wikidata) to show the map as needed. @JGirault has been working on building a proper internal interface for it, which is already customized with the proper attribution, settings, etc. We should work in sync on this.

Jonas renamed this task from Show map for coordinate diffs to [Story] Show map for coordinate diffs.Jul 17 2016, 5:11 PM

@Nikki we can load the mapbox module from Kartographer, which includes Leaflet:

https://www.wikidata.org/w/index.php?title=User%3AAude%2FCoordinateDiffMap.js&type=revision&diff=358297631&oldid=358285263

Also, we can check if it's a wikibase diff (vs. diff of other content types) by checking if the body has the 'wb-diffpage' css class.

Other than that, I think the script looks okay and will be happy to use it myself :)

I'll add the script as a gadget later this week if no objections are raised.

Sjoerddebruin claimed this task.

Added as a gadget, thanks to everyone who contributed.