2
#poi2osm convert a sqlite poi database comming from tangps to a file you can import in JOSM
3
#Copyright (C) 2009 Denis 'GNUtoo' Carikli
5
#This program is free software; you can redistribute it and/or modify
6
#it under the terms of the GNU General Public License as published by
7
#the Free Software Foundation; either version 2 of the License, or
8
#(at your option) any later version.
10
#This program is distributed in the hope that it will be useful,
11
#but WITHOUT ANY WARRANTY; without even the implied warranty of
12
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
#GNU General Public License for more details.
15
#You should have received a copy of the GNU General Public License along
16
#with this program; if not, write to the Free Software Foundation, Inc.,
17
#51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
from sqlalchemy import *
21
from sqlalchemy.orm import *
24
def __init__(self,id,longitude,latitude,unk1,unk2,unk3,description,unk4,unk5,unk6,unk7,unk8,unk9,unk10,unk11):
30
engine = create_engine('sqlite:///poi.db')
31
session = create_session(bind=engine)
32
metadata = MetaData('sqlite://')
33
poi_table = Table("poi",metadata,
34
Column('idmd5', Integer, primary_key=True),
35
Column('lat', Integer),
36
Column('lon', Integer),
37
Column('visibility', Integer),
38
Column('cat', Integer),
39
Column('subcat', Integer),
40
Column('keywords', String),
41
Column('desc', String),
42
Column('price_range',Integer),
43
Column('extended_open', Integer),
44
Column('creator', String),
45
Column('bookmarked', String),
46
Column('user_rating', String),
47
Column('rating', String),
48
Column('user_comment', String),
50
mapper(Poi, poi_table)
52
print "<osm version=\"0.5\">"
53
for poi in session.query(Poi).all():
54
print " <node id=\""+ str(poi.idmd5) + "\" lat=\"" + str(poi.lat) + "\" lon=\"" + str(poi.lon) + "\">"
55
print " <tag k=\"name\" v=\""+ poi.keywords +"\"/>"