osmimgur : See tagged imgur images on OSM

Posted by rtnf on 19 January 2023 in English (English). Last updated on 20 January 2023.

First, download all OSM objects that contain the substring “imgur” inside the “image:” tag. I use Overpass API on JOSM.

out meta;

Then, export the downloaded OSM objects as GeoJSON file for further processing.

Next, for the sake of simplicity, filter everything except OSM point node. Also trim all of the OSM tag except the image to minimize the GeoJSON filesize.

import json
f = open('imgur.json',encoding='utf-8')
data = json.load(f)
allobj = data['features']
newdata = {}
newdata['type'] = "FeatureCollection"
newdata['generator'] = "rtnf"
newdata['features'] = []

for i in allobj:
	if i['geometry']['type'] == "Point":
		prop = i['properties']
		for j in prop:
			if "image" in j:
				newy = {}
				newy['type'] = "Feature"
				newy['properties'] = {}
				newy['properties']['image'] = prop[j]
				newy['geometry'] = i['geometry']

Finally, show this preprocessed geojson file by using Leaflet frontend. Since the dataset is quite massive, use MarkerCluster plugin. I tried it before without this plugin, and my browser was crashed.

var map ='mapid',{ preferCanvas:true, zoomControl: false }).setView({lat: -6.2, lng:  107.0},1)

// Basemap
  '{z}/{x}/{y}.png', {
    maxZoom: 18,
    attribution: 'Data: © <a href="">OpenStreetMap contributors</a>

// Marker cluster
var markers = L.markerClusterGroup();
markers.addLayer(L.geoJSON(a, {
    onEachFeature: onEachFeature

// Pop-up on click
function onEachFeature(feature, layer) {
    if ( && {
        layer.bindPopup("<img src='""'><br><a target='_blank' href='""'>Image license</a>");

Comment from Pieter Vander Vennet on 19 January 2023 at 16:40

Really cool!

A fun observation: all images reported are from europe. This is certainly a bug, here is an example of a point which has an imgur image.

The overpass-script is:

``` [out:json][timeout:25]; // gather results ( // query part for: “image~/https:\/\/i.imgur.[…]” nwr“image”~”https://i.imgur.*”;

); // print results out body; >; out skel qt; ```

The only two non-european images (japan) are false-positives (I’ve removed the ‘redirect’ in OSM by now).

AT last, the link to the license is slightly incorrect and gives the image, not the imgur page. An image link such as should be transformed into (thus without i. at the start and without .jpg at the end).

But still, the end result is very interesting! I’m honoured that other people are using the results of MapComplete to make their own stuff with it :) That’s very motivating for me.

Comment from rtnf on 20 January 2023 at 03:00

Thank you for the overpass-script. Here’s the update :

Login to leave a comment