User:Evad37/KML

From Wikipedia, the free encyclopedia

Introduction[edit]

KML files contain coordinates relating to a feature, including linear features and polygons. The {{Attached KML}} template generates links to download or view an article's related KML file, and enables WikiMiniAtlas to display the KML file. As KML files cannot be uploaded directly (see Phab:T28059), they are stored as wikitext. Through the Wikidata property KML file (P3096), an article's Wikidata item can be linked to the item for its related KML file – which may be stored on any wiki connected to Wikidata.

Overview[edit]

The basic process is:

  1. Get a list of Wikidata items which have both a KML file and an article on English Wikipedia
  2. Filter out articles which already have {{Attached KML}}, or are a disambiguation page, or have been noted as an exception
  3. Use AWB to add {{Attached KML}} to the end of each article (prior to DEFAULTSORT, interwikis, categories and stub templates)

Problems[edit]

If there is a problem with the KML file, you can:

  • Fix it on Wikidata (preferred) – if the KML file is not actually related to the article, then you can be bold and fix it! Go to the article's Wikidata item, and adjust the UN document symbol (P3069) statement.
  • Specify a different KML file – add |wikidata= or |from= (see Template:Attached KML/doc)
  • Revert the edit and specify the article as an exception – add {{No KML|reason=Specify a reason}}.[a] If the edit is reverted without specify the article as an exception, then the next AWB run will again add {{Attached KML}}!
  • Report it – at User talk:Evad37/KML

Details[edit]

Here's the full details:

A list of <URL>s for Wikidata items which have a P3096 statement and enwiki sitelink is obtained through the following SPARQL query:

SELECT ?article
WHERE
{
	?article schema:about ?item 
	;	schema:isPartOf	<https://en.wikipedia.org/> .
	?item wdt:P3096 ?kml .
	SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}

Copying into Excel, and using a formula like =LEFT(MID(A2,32,999),LEN(A2)-32) (for cell B2) gives percent-encoded page title. Copying into a web-based url decoder gives the un-encoded page titles.

Filtering articles as specified above is done through a PetScan query like the following (pasting the list of articles into the "Manual list" box): https://petscan.wmflabs.org/?language=en&project=wikipedia&categories=Attached%20KML%20with%20same%20name%20as%20article%0D%0AAll%20Disambiguation%20pages%0D%0APages%20which%20should%20not%20use%20KML%20from%20Wikidata&combination=union&ns%5B0%5D=1&manual_list_wiki=enwiki&source_combination=manual%20NOT%20categories&interface_language=en&active_tab=tab_other_sources

The output from PetScan is the input list for AWB. Edit summary: Added {{Attached KML}} to make use of KML from Wikidata ([[User:Evad37/KML|more information]], [[User talk:Evad37/KML|report problems]])

Notes[edit]

  1. ^ The {{No KML}} template just adds [[Category:Pages which should not use KML from Wikidata]]; you can add this category directly if you prefer, but's its nicer to specify why the KML from Wikidata shouldn't be used.