Hi Jan,
ich weiss nicht ob Dir das hilft (ich glaube Du sprichst perl), aber mit folgendem PROGRESS Programm habe ich immer
meine GPX Files mit Hydranten POIs konvertiert:
/* gpx2osm */
def var ein-name as char format "x(60)". /* Eingabedateiname */
def var aus-name as char format "x(60)". /* Ausgabedateiname */
def var anz as int no-undo. /* Zaehler */
def temp-table t no-undo /* Temporaere Tabelle */
field t-nr as int format "->>>>>>9" label "nr"
field t-name as char format "x(15)" label "name"
field t-lat as dec format "->9.999999" label "lat"
field t-lon as dec format "->9.999999" label "lon"
index i1 is primary t-nr.
form /* Eingabe Formular */
skip(1)
ein-name colon 10
aus-name colon 10
skip(1)
with frame a width 80 side-labels three-d.
session:numeric-format = "AMERICAN".
session:data-entry-return = yes.
ein-name = "/users/cs/downloads/test.gpx".
aus-name = replace(ein-name,".gpx",".osm").
if aus-name = ein-name then aus-name = aus-name + ".gpx".
update /* Eingabe der Dateinamen */
ein-name
aus-name
with frame a.
anz = 0.
run read-gpx(ein-name).
run write-osm(aus-name).
quit.
/*********************************************************/
procedure write-osm.
def input param fname as char.
output to value(fname).
put "<?xml version='1.0' encoding='UTF-8'?>" skip.
put "<osm version='0.6' generator='JOSM'>" skip.
put "<bounds minlat='51.73' minlon='7.35' maxlat='51.80' maxlon='7.50' />" skip.
for each t break by t-nr descending :
put unformatted "<node id='" t-nr "' action='modify' timestamp='2012-01-09T17:15:00Z' visible='true' lat='" t-lat "' lon='" t-lon "'>" skip.
put unformatted " <tag k='emergency' v='fire_hydrant' />" skip.
put unformatted " <tag k='fire_hydrant:diameter' v='" t-name "' />" skip.
put unformatted " <tag k='fire_hydrant:type' v='underground' />" skip.
put unformatted "</node>" skip.
end.
put "</osm>" skip.
output close.
end procedure.
/*********************************************************/
procedure read-gpx.
def input param fname as char.
def var li as char no-undo.
def var s as char no-undo.
def var i as int no-undo.
def var lat as dec no-undo.
def var lon as dec no-undo.
def var name as char no-undo.
input from value(fname).
repeat:
import unformatted li.
li = trim(li).
if li = "" then next.
if li begins "<wpt " then do:
i = index(li, 'lat="') + 5.
s = substr(li,i).
s = entry(1,s,'"').
lat = dec(s).
i = index(li, 'lon="') + 5.
s = substr(li,i).
s = entry(1,s,'"').
lon = dec(s).
end.
if li begins "<name>" then do:
s = substr(li,7).
s = replace(s,"</name>","").
if name = "" then name = s.
end.
if li matches "*</wpt>" and lat <> 0 then do:
anz = anz + 1.
create t.
assign
t-nr = -1000 - anz
t-name = name
t-lat = lat
t-lon = lon.
lat = 0.
lon = 0.
name = "".
end.
end.
input close.
end procedure.