Wie kann man als Stammtisch auf openstreetmap.de erscheinen?

Hallo zusammen, liebe openstreetmap.de-Betreiber,

in Dessau (Sachsen-Anhalt) gibt es mittlerweile auch einen Stammtisch. Auf unserer Wiki-Seite (http://wiki.openstreetmap.org/wiki/Dessau-Ro%C3%9Flau/Stammtisch) habe ich die Stammtisch-Vorlage eingebaut. Muss ich sonst noch etwas tun damit ich auf http://www.openstreetmap.de/karte.html?zoom=9&lat=51.81824&lon=12.76918&layers=B000TT als
Gruppe erscheine? Gibt es einen Bot, der das Wiki gelegentlich abgrast oder geschieht das manuell? Liegt der Fehler bei mir (falsche Vorlage)?

Viele Grüße

Michael

Das ist eigentlich die Aufgabe des UserGroupsBot. Allerdings scheint der momentan nicht zu funktionieren.

Doch, nur leider gibt es noch keinen automatischen Abgleich zu osm.de
http://usergroups.openstreetmap.de

Ich kümmere mich mal drum, diese Woche das zu aktualisieren. Ist bei mir leider etwas eingeschlafen, da ich zur Zeit ziemlich eingespannt bin und ich das ganze irgendwann™ mal besser lösen wollte.

Magst du das dann vielleicht vorher mit mir absprechen? Da sind noch ein paar andere Punkte, die mir aufgefallen sind - z.B. werden alle Stammtischbilder immer in Originalgröße geladen und erst clientseitig verkleinert.

Vielleicht kann ich helfen, weil ich für ein anderes Projekt doch sowieso gerade an einem Wikitemplate-Parser bastle.

Dann nehmt unseren Wolf mit ins Boot, er macht das gleiche für die Geschichtskarten:

http://forum.openstreetmap.org/viewtopic.php?id=19886

http://www.netzwolf.info/kartografie/osm/c/thumbcache.php?DEBUG=1&image=http://de.wikipedia.org/wiki/Friedrich_Baumann_%28Arzt%29

Beides sehr gerne :slight_smile: Ich hatte damals nur so eine gefrikelte Lösung und danach angefangen einen stabileren/getesteten Parser zu bauen, der auch mit lustigen Abwandungen, die Nutzer bei Wikisyntax so machen umgehen können sollte. Ist leider nie fertig geworden und wird es in absehbarer Zet auch nicht.
Wir schnacken da mal…

Kurzfristig will ich da aber zumindest die Datei mal aktualisieren und die Admins bitten nen Crownjob anzulegen, der die Daten rüberzieht. Ist nur ne Krücke dann, aber besser als der jetzige Zustand.

Nahmd,

Zur allgemeinen Ergötzung und Selbstbedienung hier das (wie üblich) hochaufwendige™ Machwerk:


<?php
#===============================================================================
#	$Id: thumbcache.php,v 1.14 2013/03/24 22:45:51 wolf Exp wolf $
#===============================================================================
#
#	Provides Thumbnail-JPEG for Image-URL
#
#	image=		Image or Website URL. Mandatory.
#	DEBUG=		If set, error messages instead of replacement picture
#
#===============================================================================

$THUMB_WIDTH	= 200;
$THUMB_HEIGHT	= 300;
$THUMB_MINRATIO	= 0.4;
$THUMB_MAXRATIO	= 2.0;

$POS_CACHE_TIME	= 7 * 24 * 3600;	# 1 week
$NEG_CACHE_TIME	= 1 *  6 * 3600;	# 6 hours

$ERROR_IMAGE	= '/i/w/sorry_160x80.gif';

$CACHE_DIR	= '/tmp';

#-------------------------------------------------------------------------------
#	Wikimedia commons needs non default User-Agent
#-------------------------------------------------------------------------------

$USER_AGENT = 'thumbcache.php @ http://geschichtskarten.openstreetmap.de/historische_objekte/; prereads, thumbnails and caches images to display in map popup info boxes. In case of trouble contact <XXX@YYY> or <UUU@VVV>.';

ini_set('user_agent', $USER_AGENT);

#-------------------------------------------------------------------------------
#	Error handler
#-------------------------------------------------------------------------------

$URLs = array();

function Fail ($message) {

	global $URLs;

	if ($_GET['DEBUG']) {
		header ("HTTP/1.0 400 Something went wrong.");
	} else {
		global $ERROR_IMAGE;
		header ("HTTP/1.0 302 Not found.");
		header ("Location: {$ERROR_IMAGE}");
	}

	header ("Content-Type: text/plain");

	echo join (";\n", $URLs),"\n";

	echo "ERROR: $message\n";
	exit (1);
}

#-------------------------------------------------------------------------------
#	Image URL
#-------------------------------------------------------------------------------

if (!preg_match("#^(https?://\S+)$#", $_GET['image'], $match)) {

	Fail ("Parameter 'image=' missing or unknown protocol");
}

$url = $match[1];

#-------------------------------------------------------------------------------
#	Checksum image url
#-------------------------------------------------------------------------------

$hash = md5 ($url);

#-------------------------------------------------------------------------------
#	Cache entry
#-------------------------------------------------------------------------------

$cachePath = "{$CACHE_DIR}/{$hash}.jpg";

$message = "'$url' not in cache.";

#-------------------------------------------------------------------------------
#	If not in cache, must fetch
#-------------------------------------------------------------------------------

$mustFetch = !file_exists ($cachePath);

#-------------------------------------------------------------------------------
#	If in cache, check if stale
#-------------------------------------------------------------------------------

if (!$mustFetch) {

	#-------------------------------------------------------------------------------
	#	Determine max age for positive and negative cache entries
	#-------------------------------------------------------------------------------

	$maxAge = filesize($cachePath)>0 ? $POS_CACHE_TIME : $NEG_CACHE_TIME;

	#-------------------------------------------------------------------------------
	#	If too old, must fetch
	#-------------------------------------------------------------------------------

	if (time() - filemtime ($cachePath) > $maxAge) $mustFetch = TRUE;
}

if ($mustFetch || $_SERVER['HTTP_PRAGMA']=="no-cache" ||
		$_SERVER['HTTP_CACHE_CONTROL']=='no-cache') {

	$message = getThumb ($url, $cachePath);
	touch ($cachePath);
}

#-------------------------------------------------------------------------------
#	If still not in cache, throw error-
#-------------------------------------------------------------------------------

$size = @filesize ($cachePath);

if (!$size) Fail ($message);

#-------------------------------------------------------------------------------
#	Deliver image from cache
#-------------------------------------------------------------------------------

header ("Content-Type: image/jpeg");
header ("Content-Length: $size");

readfile ($cachePath);

exit(0);

#-------------------------------------------------------------------------------
#	If webpage instead of image retrieved, try to extract image url.
#-------------------------------------------------------------------------------

function getThumb ($url, $cachePath) {

	global $URLs;

	for ($redirect=0; $redirect<3; $redirect++) {

		$URLs[] = $url;

		#---------------------------------------------------------------
		#	Fetch content of URL
		#---------------------------------------------------------------

		$data = @file_get_contents ($url);

		if ($data === FALSE) return "Couldn't fetch URL '$url'.";

		$size = strlen($data);

		#---------------------------------------------------------------
		#	Decode image.
		#---------------------------------------------------------------

		$image = @imagecreatefromstring ($data);

		#---------------------------------------------------------------
		#	If image then :-)
		#---------------------------------------------------------------

		if ($image !== FALSE) break;

		#---------------------------------------------------------------
		#	Else: OSM-Wiki and link to /w/images/ ?
		#---------------------------------------------------------------
		#src="/w/images/thumb/6/68/Stundenstein_Heideweg.jpg/800px-Stundenstein_Heideweg.jpg"
		#---------------------------------------------------------------

		if (preg_match ('#http://(wiki\.openstreetmap\.org)/#', $url, $host) &&
			preg_match ('#src="(/w/images/thumb/[^<>"]+)"#', $data, $match)) {

			$url = "http://{$host[1]}{$match[1]}";
			$URLs[] = 'A';
			continue;
		}

		#---------------------------------------------------------------
		#	Else: Link to //upload.wikimedia.org/* ?
		#---------------------------------------------------------------

		if (preg_match ('#href="(//upload.wikimedia.org/[^\\s"<>]+jpe?g)"#i', $data, $match)) {

			$url = "http:{$match[1]}";
			$URLs[] = 'B';
			continue;
		}

		#---------------------------------------------------------------
		#	Else: Wikipedia page and link to /wiki/[Namespace}:* ?
		#---------------------------------------------------------------
		#	<a href="/wiki/{Namespace}:{filename}jp[e]g" class="image"
		#---------------------------------------------------------------

		if (preg_match ('#//(\w+\.wikipedia\.org)/#', $url, $host) &&
			preg_match ('#<a href="(/wiki/\w+:[^<>"]+jpe?g)"\s+class="image"[^>]*><img#i',
				$data, $match)) {

			$url = "http://{$host[1]}{$match[1]}";
			$URLs[] = 'C';
			continue;
		}

		#---------------------------------------------------------------
		#	Else: Wikipedia page and srcset ?
		#---------------------------------------------------------------
		#	srcset="//upload.wikimedia.org/wikipedia/de/1/1a/Denkmal_sanitaetsrat_dr_baumann.jpg 
		#---------------------------------------------------------------

		if (preg_match ('#srcset="(//upload.wikimedia.org/[^\\s"<>]+jpe?g)\\s#i', $data, $match)) {

			$url = "http:{$match[1]}";
			$URLs[] = 'D';
			continue;
		}

		#---------------------------------------------------------------
		#	If no image then :-(
		#---------------------------------------------------------------

		break;
	}

	#-----------------------------------------------------------------------
	#	No image ?
	#-----------------------------------------------------------------------

	if ($image === FALSE) {

		return "No image found for URL '$url' ($size bytes).";
	}

	#-----------------------------------------------------------------------
	#	Scale image
	#-----------------------------------------------------------------------

	global $THUMB_WIDTH;
	global $THUMB_HEIGHT;
	global $THUMB_MINRATIO;
	global $THUMB_MAXRATIO;

	$origWidth = imagesx($image);
	$origHeight= imagesy($image);

	#-----------------------------------------------------------------------
	#	Trim if neccessary
	#-----------------------------------------------------------------------

	$widthTrim = max (0, round (($origWidth - $origHeight*$THUMB_MAXRATIO) / 2));
	$heightTrim= max (0, round (($origHeight- $origWidth /$THUMB_MINRATIO) / 2));

	$trimmedWidth = $origWidth - 2 * $widthTrim;
	$trimmedHeight= $origHeight- 2 * $heightTrim;

	#-----------------------------------------------------------------------
	#	Scale down into given box preserving w/h-ratio. NO scale up.
	#-----------------------------------------------------------------------

	$scale = min (1, $THUMB_WIDTH/$trimmedWidth, $THUMB_HEIGHT/$trimmedHeight);

	$thumbWidth = round ($scale * $trimmedWidth);
	$thumbHeight= round ($scale * $trimmedHeight);

	$thumb = imagecreatetruecolor($thumbWidth, $thumbHeight);

	imagecopyresampled ($thumb, $image,
		0, 0, $widthTrim, $heightTrim,
		$thumbWidth, $thumbHeight, $trimmedWidth, $trimmedHeight);

	#-----------------------------------------------------------------------
	#	Store thumbnail
	#-----------------------------------------------------------------------

	$tempFile = "{$cachePath}." . getmypid() . ".tmp";
	if (imagejpeg ($thumb, $tempFile)) {

		@chmod ($tempFile, 0440);

		if (!rename ($tempFile, $cachePath)) {
			@unlink ($cachePath);
			@rename ($tempFile, $cachePath);
		}
	}
	@unlink ($tempFile);

	return '';
}

#===============================================================================
#	$Id: thumbcache.php,v 1.14 2013/03/24 22:45:51 wolf Exp wolf $
#===============================================================================
?>

Gruß Wolf

Ich grabe diesen 13 Monate alten Thread aus, weil das Problem noch immer/wieder existiert.

Weder der Stammtisch Dessau noch der Freiberger sind auf der openstreetmap.de-Karte zu finden; auf der usergroups-Seite dagegen schon…

[Edit: Links verbessert]

Da scheint es wohl (noch immer/wieder) ein Problem mit dem Abgleich zu geben. Der Düsseldorfer Stammtisch hat vor einiger Zeit seinen Austragungsort gewechselt. Während der Marker auf der usergroups-Seite den korrekten Treffpunkt (Düsseldorf-Gerresheim) zeigt, sind wir auf openstreetmap.de noch in Düsseldorf-Derendorf verortet :wink:

Das Mappertreffen in Lüneburg erscheint dort auch doppelt auf openstreetmap.de !

auf usergroups… ist es OK!