Wikivoyage talk:Maptool

From Wikivoyage
Latest comment: 4 months ago by Andree.sk in topic mapframe/marker/listing problems
Jump to navigation Jump to search

Wikipedia/wikidata query tool (for editors)

[edit]

Eyyyy, I hacked together a tool, based on some de:WV code + custom WD query code. It basically allows you to show an article map (+- what {{mapframe}} normally shows), overlayed with all wikipedia articles of the selected language, within the selected radius. In theory, it should simplify searching for POIs (and their WD IDs) around the place significantly - and thus speedup article creation. If you want to try it out, you'll need to copy User:Andree.sk/common.js to your private common.js (or use redirect). Feedback (and fixes/improvements) is very welcome!-- andree 21:35, 26 December 2023 (UTC)Reply

Hey that's cool! I can get the listing to show up, but how do you get that fancy map in your images (unchecking "Listing Table" seems to do nothing)? I guess my feedback would be 1) the selection box could be made more user-friendly... I'm not really sure what I'm doing with the options there, and I don't know how I would properly type a filter into a box that small; 2) an explanation of the columns in the listing; 3) I notice a few uncaught type errors in the console when I mess around with things – not sure how much you care about those at the moment though. Brycehughes (talk) 17:55, 29 December 2023 (UTC)Reply
Thanks for trying it out! :) In the meantime I extended the tool to make it able to sort the items by number of views of the respective wikipedia article - to more easily filter out the important POIs. For me personally, it seems to work surprisingly well - but only in the countries, where there's lots of wikipedia articles about the local stuff, of course :) So far for Europe, it seems to go well, not so much in e.g. Africa...
Regarding map not showing up, do you see some errors in the javascript console (in chromium)? Perhaps you can try it on Dolný Kubín, where it works for me with the default settings (with+without the Sort checked), to have some base... Ad 1) yeah, that would be the plan, if we would make the tool available more widely (somehow allow personalizing/storing the filters, cleaning up the UI etc.). The example filter takes the 'instance of' statement of WD (e.g. for Q2659969 it's "lake" / Q23397), and evaluates the expression... Ad 2) I added tooltips about the features, hopefully it will be more clear now. Ad 3) Yeah, it's probably not indestructible... prototype quality so far :). But I'll surely try to fix the bug reports, if I can... -- andree 21:28, 29 December 2023 (UTC)Reply
You're going to laugh, but I was actually testing it on Bielefeld (this might explain the uncaught type errors actually, because, well, you know... ;-)
Ok, so I updated the JS in my common.js, went to Dolný Kubín, did a hard reload & empty cache via the dev console (Chrome 120.0.6099.129 MacOS [arm64]), unchecked item table, and the map still does did not appear. HOWEVER, its element does exist (id="voy-topMap"), and I see what the problem is: the height is 0 (the width is fine). When I manually edited the element and stuck a height in there (say 1000px), the map showed up. However, while the markers appeared across the full container, the tiles only covered about the first 100px or so of height. I haven't played around with Leaflet in years, but once the height issue is solved there might need to be a resize() or repaint() or some method you need to call to get the tiles to repaint over the full container after it's been sized correctly.
Re the listing table, what does "Views" mean? (en.wp page views?) It's almost always 'undefined'. Is it useful?
Also, just a suggestion, but maybe pulling the "Instance of" statement from Wikidata would be really useful – I believe that's almost always defined.
Anyway hope this helps and all just suggestions. Keep up the good work! Brycehughes (talk) 03:46, 30 December 2023 (UTC)Reply
Could you try if map on Bielefeld works for you (using the globe icon at the top)? For me also the tool worked on Bielefeld too, normally, but I use chrome+linux...
I used +- the same code as the german WV, so if it works there, I may have just forgotten some piece. I had the same issue in the past while playing with the maps stuff, that the maps layer didn't draw, the kartographer/leaflet code is pretty touchy. Can you try to extend the makeContainer() function like this?
The 'views' field comes from normal wiki page views, indeed. E.g. here... I wanted to avoid DOSing the WP server by so many requests, so you need to check "Sort by viewcount" to retrieve that. But in the end, maybe it should just be always enabled, until wikipedia bans it :-D -- andree 08:15, 30 December 2023 (UTC)Reply
-- andree 09:48, 30 December 2023 (UTC)Reply
andree That line fixed it! The map shows up now. Well done.
To avoid the mixed protocol warning that shows up in the console for each image thumb, I made this change. It might be a bit hacky and there's probably a better way to do it, but it does get rid of the warning.
My only other suggestion would be to either 1) automatically close the toggle popup as soon as you hit "show/hide" or 2) to have it close on any clickaway from the popup (clickaway listeners can be a pain though). It just sort of annoys me that it always gets in the way of the data, and then I have to reach up to click the icon to close it manually (oh the pain! :). This is pretty minor though.
Other than that, fantastic work! Legitimately useful – I will definitely use this. Brycehughes (talk) 19:08, 30 December 2023 (UTC)Reply
cool, thanks for the feedback! I'll merge your fix, looks good to me as a layman :-D About #1/#2 suggestions - I kind of like that I can refine the query without having to reopen the dialog, but maybe there is some middle ground... We'll see, depending on if there's further feedback. Btw, I added a crude color gradient to the markers, to somehow distinguish the POIs order. In any case, if you use it and add/want t osuggest some improvements, don't hesitate to share... -- andree 21:24, 30 December 2023 (UTC)Reply
The annoyance just depends on screen size (shrink your browser window width and you'll see what I mean). Maybe you could just re-arrange the popup so it was wider instead of taller: Language and Radius could sit next to each other horizontally, then next line you could have a nice big box for Filter (which would conveniently give more room for that and make it more usable), and then next line could have everything else. Anyway, no biggie. Brycehughes (talk) 01:06, 31 December 2023 (UTC)Reply

In the past few days I've been using the tool - and IMO it is a spectacular helper for setting up articles (examples: Reutte, Stołowe_Mountains_National_Park, Greater Košice, Ostrava). It won't help you with words, but if you need to find reasonably popular POIs around the article (or wikidata/WP IDs of the current ones), it significantly speeds up the process - especially if you search wikipages in the local language (de in Austria, sk in Slovakia, etc.). If someone could give it a try, that'd be very nice, we could then put the tool out for general use. I'd clean it up before (minimize the diff to the original code from Roland, and maybe offer it to :de.wv too), just to "show" that there are no intentional backdoors etc. (since it's a JavaScript code). TIA. -- andree 14:05, 3 January 2024 (UTC)Reply

I'm not really editing at the moment (family/personal reasons) but I'll give it a proper try when I get back to it, if only to get some points on Ohana's list. Not sure why it's not getting much attention here. You did "release" it at the worst possible time (holidays :) Brycehughes (talk) 11:59, 8 January 2024 (UTC)Reply
Yeah, it's a bit of a letdown, I even RFCd :-)) In the meantime I extended it with similar function for OSM POIs (but the number of various data is much greater there, and the UI would need some love). It's really almost too easy to spin-off an article with this... :)
I'm thinking, whether the biggest blocker is the 'install' step? @admins, would it make sense for me to apply for 'interface administrator' and make this public, to get broader feedback? It basically doesn't interfere with anything, and we can always uninstall it... -- andree 13:10, 8 January 2024 (UTC)Reply
Yeah the install step is a pain in the ass (WhatamIdoing sorry). Even I had to look up my previous edits on en.wp to remember what common.js was. Wikivoyage editors tend to be less technical (which is good!) and so yeah the installation is a blocker for sure. Brycehughes (talk) 19:00, 8 January 2024 (UTC)Reply
That said, if you wanted to apply for it to be a proper tool (not sure why you would limit it to admins, there are only like 30 here and many of them are non-technical), then I would spend some time fixing the edge cases. A lot of errors are thrown when you click around on various pages. Could use a polish. JS is a pain and sincere respect to anyone who can pull it off cleanly. Brycehughes (talk) 19:35, 8 January 2024 (UTC)Reply
Yes, the installation is the reason, why I'm contemplating, if it makes sense to ask for broader testing before deployment - the gadget icon itself is a trivial tiny code, and unless you click on it, +- nothing is done. So IMO we could put it here, and then take the feedback. We'd setup some discussion page - and I don't mind spending some time on it, if it would be used by the community... After all functions are there and it's stable, we can also work on improving the UI (or even now, if someone has some mockups/suggestions) :-) -- andree 20:19, 8 January 2024 (UTC)Reply
I think it's a really cool tool and could absolutely go into experimental. A couple things 1) I'm a bit of a perfectionist when it comes to code, I like static types, and I'm not super comfortable with the errors I see currently, particularly relating to lat/lon, and I think you should run various test cases to fix those; 2) en.wikivoyage editing culture tends to be pretty (small-c) conservative – habits stick around here – and so it might take a bit of aggressive marketing to actually get editors to adopt the tool. I'd love to collaborate with you on this but 1) I just don't have the time at the moment and 2) I effing (WhatamIdoing I think effing is okay) hate JS. I'll tool around with it some more when I have the time and am actually editing. I don't know what it takes to get it approved on experimental, probably just lobbying. You might ping LPfi, who generally knows the way around the technical side of things here. Brycehughes (talk) 21:04, 8 January 2024 (UTC)Reply
1) that's the thing, I didn't see any issues lately, so by all means, throw at me whatever queries the tool may fail on! Also, BTW this wiki seems to limit JS to ES5, so lot's of fancy things are missing... 2) I'm also no JS guru, half of the (new) code was generated by ChatGPT and the other half is just me hammering it enough :) -- andree 06:53, 9 January 2024 (UTC)Reply
Haha fair enough. I'll let you know when I see them. ChatGPT writing error-throwing code eh? Well at least my job is safe for now :) Brycehughes (talk) 04:52, 10 January 2024 (UTC)Reply
Danny Benjafield (WMDE) was just asking about how people are using Wikidata. I think WMDE will be interested. WhatamIdoing (talk) 17:21, 8 January 2024 (UTC)Reply
I know, but right now only +- I am using the tool... and probably they know the normal usecase on wv? -- andree 17:30, 8 January 2024 (UTC)Reply
Maybe, but maybe not. Also, I wonder if this could be useful for improving Wikipedia articles. If you looked at this tool + looked at the Wikipedia article for a city, maybe you would find things that should be mentioned in the Wikipedia article. WhatamIdoing (talk) 20:37, 8 January 2024 (UTC)Reply
@Andree.sk you have created something exciting here! We are interested in hearing about any way editors have used Wikidata within another project, not just the known / usual cases. It's particularly interesting for us when community members spot or identify a gap or need and create something to fill that opportunity, enriching the Wikiverse with more functionality and reducing friction to content creation. If you would like to talk to us about your POI Search tool or any other WD-usage in WV or any other project, I encourage you to Sign-up for an interview or Write to us! Furthermore, once the tool is ready for more visibility, I think it would be a good candidate to add into the Wikidata Weekly Summary. Danny Benjafield (WMDE) (talk) 10:00, 9 January 2024 (UTC)Reply

V2 => maptool

[edit]

I have revamped the tool to become a swiss-army-knife for dynamic-map stuff, along with the original wikidata/OSM query tool. It now also does:

  • clicking on the map will get you the coordinates
  • displays the displayed area coordinates
  • displays the respective mapframe parameters (you can also resize the map itself)

If we ever agree to make this a permanent tool, I'd write some doc page as well. Also, I'd like to improve the filtering possibilities, if that happens - but for me, right now, it already does +- everything I usually need... As before, any feedback welcome... -- andree 16:47, 14 January 2024 (UTC)Reply


...

The Maptool is now a normal WV gadget. For now it's not enabled by default, please go to your preferences to enable it. I'd enable it for everyone +- during the weekend, if there are no bugs reported by the fellow editors... :) -- andree 18:31, 29 January 2024 (UTC)Reply

mapframe/marker/listing problems

[edit]

When I click the blue number "1" next to Madrid on the page Spain, I get the map part of the screen is not completely filled. There is a white area below the part of the map that is displayed. On the map I expect the blue marker, butt that is not there. The whole map-part of the screen is frozen, no buttons work. When I do the same in the article Central Spain I see the same, but with the blue marker in the center, and again no buttons work. The difference is that the Cetral Spain article contains a mapframe and the Spain article not. --FredTC (talk) 09:40, 6 February 2024 (UTC)Reply

Should be fixed now, you may need to refresh (Ctrl+F5). Sorry, didn't notice it before... -- andree 11:29, 6 February 2024 (UTC)Reply
Yes, it works fine now. FredTC (talk) 11:49, 6 February 2024 (UTC)Reply
@Andree.sk: How long did this problem exist? I noticed it just a few days. Another problem existed several weeks, but I cannot define exactly when it will happen. I'm not shure whether it starts after clicking on the number at a listing or after clicking the full screen button in the map. Then the map was not totally frozen, but the close button did not close the full screen. The being pressed simulation was shown, but the reaction to it did not happen. After pressing the back-button of the browser a few times, the close button did its work. --FredTC (talk) 12:04, 6 February 2024 (UTC)Reply
Since ~Friday, was introduced by me not snipping enough code out of the Maptool, so it interfered with the maplinks... I tried to make it so that it doesn't do anything unless it's used, but missed this case... -- andree 12:44, 6 February 2024 (UTC)Reply