Skip to content
This repository has been archived by the owner. It is now read-only.

[PATCH] Add links to wiki Key:* and Tag:* pages from /browse/* pages #2245

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 12 comments
Closed

Comments

@openstreetmap-trac
Copy link

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Reporter: StefanB
[Submitted to the original trac issue database at 4.51am, Tuesday, 1st September 2009]

It would be very nice if tags and values in data browser would link to wiki if the wiki page is already existing.

eg highway=residential would be linked to:

http://wiki.openstreetmap.org/wiki/Tag:highway
(on key)
http://wiki.openstreetmap.org/wiki/Tag:highway%3Dresidential
(on value)

links could be prefixed with language code
http://wiki.openstreetmap.org/wiki/DE:Tag:highway%3Dresidential
if translation exists, or fall back onto default (english) page.

I'm sure mediawiki has some api to get list of existing pages (preferably only those with "Tag:" in title) and this list could be cached by rails app for up to some hours.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: tom[at]compton.nu
[Added to the original trac issue at 8.14am, Tuesday, 1st September 2009]

At the very least I think this needs to wait until the wiki is moved to it's new server - more load is the last thing it needs at the moment. That should be happening fairly soon.

It is also of course going to need somebody to write a fairly substantial amount of code.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: StefanB
[Added to the original trac issue at 8.38am, Tuesday, 1st September 2009]

I am interested in coding this, but would need some help here and there.

To prevent serving tons of dead links (frustrating for users) we'd need an API call in wiki to list existing pages like:
http://wiki.openstreetmap.org/index.php?title=Special%3APrefixIndex&from=Tag%3A&namespace=0

but more computer friendly (xml), if possible.
Wikimedia API (as on http://en.wikipedia.org/w/api.php )doesn't seem to be installed
and seems rather handy for the purpose (eg http://en.wikipedia.org/w/api.php?action=query&list=allpages&apprefix=Map&aplimit=50 )
(would need to change prefix to "Tag:" for our use)

alternatively all pages in all subcategories of
http://wiki.openstreetmap.org/wiki/Category:Tags
could be enumerated somehow

Also it's essential to cache the result from the api call.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: StefanB
[Added to the original trac issue at 8.40am, Tuesday, 1st September 2009]

Replying to [comment:2 StefanB]:

Wikimedia API (as on http://en.wikipedia.org/w/api.php )doesn't seem to be installed
oops, it is available at:
http://wiki.openstreetmap.org/api.php
hooray!

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: tom[at]compton.nu
[Added to the original trac issue at 8.55am, Tuesday, 1st September 2009]

In case you didn't get it I'm not exactly enthusiastic about this idea anyway, given how full of shit the tagging pages on the wiki are ;-)

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: StefanB
[Added to the original trac issue at 9.52am, Tuesday, 1st September 2009]

Replying to [comment:4 tom[at]compton.nu]:

In case you didn't get it I'm not exactly enthusiastic about this idea anyway, given how full of shit the tagging pages on the wiki are ;-)
ok, ok, i can hold my horses for a while :)

Might give a nice push to tidy up the wiki documentation once the wiki server can handle the extra load though.

If i come up with anything I'll make sure it is acceptable for you before checking anything in ... this time :) Probably just attaching patches here until then.

Perhaps limiting the linking to few "approved" wiki pages (or just link keys, not values) could also lower the load and make sure only nice pages are linked, but it would take the automation out of the process.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: tom[at]compton.nu
[Added to the original trac issue at 2.51pm, Wednesday, 16th September 2009]

See patch on duplicate case #2289.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: avarab[at]gmail.com
[Added to the original trac issue at 3.01pm, Wednesday, 16th September 2009]

More accurate summary (from the duplicate bug)

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: StefanB
[Added to the original trac issue at 3.10pm, Wednesday, 16th September 2009]

Is there any difference between using mediawiki API or whatlinkshere page in terms of

  • performance
  • correctness
    ?

Perhaps it could be rolled out with a small subset of linked tags and see how extra visits are affecting wiki.

nice trick with added uselang=de parameter!

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: avarab[at]gmail.com
[Added to the original trac issue at 3.18pm, Wednesday, 16th September 2009]

Replying to [comment:8 StefanB]:

Is there any difference between using mediawiki API or whatlinkshere page in terms of

  • performance
  • correctness
    ?

Well the script is run offline so performance doesn't matter. I couldn't find a way to query special pages like WhatLinkshere so I just did a tiny bit of screen-scraping.

If there's a better way using the API then by all means let's use that. Although what we have now works. And some script to be run offline periodically isn't something I'm very enthusiastic about optimizing for speed & correctness.

Perhaps it could be rolled out with a small subset of linked tags and see how extra visits are affecting wiki.

Or turning it on and seeing if it keels over :)

nice trick with added uselang=de parameter!

We should be using that with all outgoing links to the wiki. I'm already using it for the Icelandic translation.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: avarab[at]gmail.com
[Added to the original trac issue at 8.51pm, Sunday, 11th April 2010]

We're now running a new wiki version on a new box behind a sane squid setup.

Would it be OK to enable this patch now?

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: avarab[at]gmail.com
[Added to the original trac issue at 4.17pm, Wednesday, 14th April 2010]

I've updated the patch to use the API on the wiki. Before the upgrade the only way to get the list of key/value links was to screen-scrape.

I didn't add the autogenerated YAML file. This has to be added as:

perl script/misc/update-key-and-tag-description-pages-from-wiki config/wiki-tag-and-key-description.yml

And now gives instructions on how to install the required modules from CPAN if they're missing.

Also there are now per-language templates for these key/values. Right now there's a manual list of the respective languages in the perl script. I thought getting this automatically via the search engine might be too brittle.

@openstreetmap-trac
Copy link
Author

@openstreetmap-trac openstreetmap-trac commented Jul 23, 2021

Author: TomH
[Added to the original trac issue at 10.41pm, Tuesday, 20th April 2010]

This patch has now been merged to the trunk.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant