~ubuntu-branches/debian/wheezy/foxtrotgps/wheezy

« back to all changes in this revision

Viewing changes to contrib/poi2osm

  • Committer: Package Import Robot
  • Author(s): Daniel Baumann
  • Date: 2012-02-14 06:13:28 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120214061328-zo4mu0rvgz06q5nw
Tags: 1.1.0-1
* Using compression level 9 also for binary packages.
* Merging upstream version 1.1.0:
  - includes osb2tango and poi2osm (Closes: #647986).
* Removing curl.patch, included upstream.
* Updating to debhelper version 9.
* Updating years in copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
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
 
4
#
 
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.
 
9
#
 
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.
 
14
#
 
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.
 
18
 
 
19
 
 
20
from sqlalchemy import *
 
21
from sqlalchemy.orm import *
 
22
 
 
23
class Poi(object):
 
24
        def __init__(self,id,longitude,latitude,unk1,unk2,unk3,description,unk4,unk5,unk6,unk7,unk8,unk9,unk10,unk11):
 
25
                self.id = id
 
26
        def __repr__(self):
 
27
                print repr(self.id)
 
28
 
 
29
 
 
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),
 
49
    )
 
50
mapper(Poi, poi_table)
 
51
 
 
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  +"\"/>"
 
56
        print "  </node>"
 
57
print "</osm>"