User:Suyash.dwivedi/userscripts/LocationInserter

Wiki's Lazy Coders

Wikidata Location Button

LocationInserter is a utility script that adds a link to your sidebar (toolbox) to quickly generate and copy the

Camera location 00′ 00″ N, 0° 00′ 00″ E Kartographer map based on OpenStreetMap.View all coordinates using: OpenStreetMapinfo

template for any file. It streamlines the manual addition of coordinates by handling the formatting and opening the edit window automatically.

Installation

To install this script, add the following line to your common.js page:

 // Location Inserter Sidebar Link mw.loader.load('https://commons.wikimedia.org/wiki/User:Suyash.dwivedi/userscripts/LocationInserter.js?action=raw&ctype=text/javascript');

How to use

  • Locate the 🌍 Add Location link in the sidebar menu (Tools/Toolbox section).
  • Click the link to trigger the process.
  • A prompt will appear asking for coordinates. Enter them in lat, long format (e.g., 23.2599, 77.4126).
  • A second prompt will ask for the filename (e.g., File:Example.jpg).

The script will:

  • Copy this template to your clipboard automatically.
  • Open the edit page for that specific file in a new browser tab.
  • Paste the copied template into the appropriate section (usually the Summary or Information template) and save.

Features

  • Sidebar Integration: Accessible from any page on Commons via the toolbox.
  • Automatic Clipboard Copy: Saves time by copying the wikitext code for you immediately.
  • Smart Navigation: Opens the target file directly in edit mode for section 1.
  • Input Validation: Ensures the coordinates are numeric and properly separated before proceeding.
Created by Suyash Dwivedi | Updated on: 8 January 2026
Category:User scripts#LocationInserter Category:Wikimedia Commons tools#LocationInserter
Category:Pages with coordinates Category:User scripts Category:Wikimedia Commons tools