Commons:Search by location

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Many Wikimedia Commons files are indicating specific location for example with Template:Location.

Human-usable frontend[edit]

Desktop: Wikishootme, the blue dots are the Commons pictures.

Mobile: Commons:Mobile app, tap Explore then Map.

API[edit]

It is possible to use this info, for example to query for files near specific location. It is possible thanks to GeoData extension enabled on Commons.

Use action=query&list=geosearch&gscoord=lat|lon&gsradius=meters&gsnamespace=6&gsprimary=all

Excerpt from the API documentation

 gscoord             - Coordinate around which to search: two floating-point values separated by pipe (|)
 gspage              - Title of page around which to search
 gsradius            - Search radius in meters
                       This parameter is required
                       The value must be between 10 and 10000
 gsmaxdim            - Restrict search to objects no larger than this, in meters
 gslimit             - Maximum number of pages to return
                       No more than 500 (5000 for bots) allowed
                       Default: 10
 gsnamespace         - Namespace(s) to search
                       Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 100, 101, 102, 103, 104, 105, 106, 107, 460,
                           461, 490, 491, 1198, 1199, 828, 829
                       Maximum number of values 50 (500 for bots)
                       Default: 0
 gsprop              - What additional coordinate properties to return
                       Values (separate with '|'): type, name, dim, country, region, globe
                       Default: globe

File namespace is NS 6 in MediaWiki by default.

Example: https://commons.wikimedia.org/w/api.php?format=jsonfm&action=query&list=geosearch&gsprimary=all&gsnamespace=6&gsradius=500&gscoord=51.5%7C11.95