[Talk-de] OpenOffice Calc makros für OSM

Werner Hoch werner.ho at gmx.de
Mo Jan 4 13:49:51 UTC 2010


Hallo allerseits,

ich hab mir zwei kleine Makros gemacht mit denen man aus ooCalc heraus Relationen in JOSM laden oder im Browser ansehen kann:

-------------
sub osm_browse_relation
	' browse the relation with the id of the selected cell
	oDoc = thisComponent
	oCell=oDoc.getCurrentSelection()
	if HasUnoInterfaces(oCell, "com.sun.star.table.XCell") then
		url =  "http://www.openstreetmap.org/browse/relation/" + oCell.value
		shell("/usr/bin/firefox/ " + url)
	end if
end sub

sub josm_load_relation
	' load relation with the id of the selected cell
	oDoc = thisComponent
	oCell = oDoc.getCurrentSelection()
	if HasUnoInterfaces(oCell, "com.sun.star.table.XCell") then
		josm_url = "http://localhost:8111/import?url="
		osm_api =  "http://www.openstreetmap.org/api/0.6/"
		url = josm_url + osm_api + "relation/" + oCell.value + "/full"
		shell("/usr/bin/wget -O/dev/null " + url)
	end if
end sub
-------------

Die Makros sind nicht besonders schön. Vieleicht findet sich ja jemand der etwas mehr Ahnung von der Makro-Programmierung hat.

Verwendung:
* Zelle mit der Relations-ID makrieren.
* eines der Makro ausführen (ggf. über eine Schaltfläche oder Tastenkürzel)

Für Ways, Nodes, ... muss nur die URL geändert werden.

Grüße
Werner (werner2101)




Mehr Informationen über die Mailingliste Talk-de