Hello,
i hope i use the right terms in the following, there may be some terms
not used correctly.
I try to render a track that i captured with my GPS data logger yesterday.
The data logger is a Columbus V-900 and it captures a CSV file.
The CSV file looked strange and i tried converting it with "gpsbabel".
As i encountered some problems i converted the track with an own
python script that i copied below, please feel free to use it if you like.
So far i converted the input data to a reasonable form, they look ok to me.
Now i extended osm.xml to render the track in /local/mapnik/track.gpx:
<Style name="qwetrack">
<Rule>
<MaxScaleDenominator>5000000000</MaxScaleDenominator>
<PointSymbolizer file= "/local/mapnik/symbols/point.png" type="png"
width="16" height="16" />
</Rule>
</Style>
<Layer name="track" status="on" srs="+proj=merc +a=6378137 +b=6378137
+lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgri...@null
+no_defs +over">
<StyleName>qwetrack</StyleName>
<Datasource>
<Parameter name="type">ogr</Parameter>
<Parameter name="file">/local/mapnik/track.gpx</Parameter>
</Datasource>
</Layer>
But i don't get no error and i don't see the track. I expected to see the dot
i made in "point.png" for every trackpoint.
Can anybody give me a hint on how to draw a track?
Thanks for any hints,
Torsten.
############ gps.py:
#! /usr/bin/python
#coding: latin-1
"""
"""
import sys
infile = '/local/gps/09080903.csv'
class GpsLine(object):
def __init__(self, gps, ln):
self.gps = gps
self.c = ln.split(',')
def __getitem__(self, k):
i = self.gps.key[k]
return self.c[i]
class GpsIter(object):
def __init__(self, gps):
self.gps = gps
self.ix = 0
def __iter__(self):
return GpsIter(self.gps)
def next(self):
if self.ix >= len(self.gps.c):
raise StopIteration
ret = self.gps.c[self.ix]
self.ix += 1
return GpsLine(self.gps, ret)
class Gps(object):
def __init__(self, fn):
c1 = open(fn, "r").read()
self.c = c1.splitlines()
self.hl = self.c.pop(0)
self.key = dict()
self.k = self.hl.split(',')
for i, k in enumerate(self.k):
self.key[k] = i
def __iter__(self):
return GpsIter(self)
def keys(self):
return self.key.keys()
########## qwe.py:
#! /usr/bin/python
#coding: latin-1
"""
"""
import sys
import gps
infile = '/local/gps/09080903.csv'
outfile = '/local/mapnik/track.gpx'
pat1 = """<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="byHand" version="1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1
http://www.topografix.com/GPX/1/1/gpx.xsd">
"""
pat2 = """ <wpt lat="%s" lon="%s">
<ele>%s</ele>
<sym>cross</sym>
</wpt>
"""
gp = gps.Gps(infile)
for x in gp.keys():
print x
print "------------"
out = pat1 + "\n"
for l in gp:
wpt = pat2 % (l['LATITUDE N/S'], l['LONGITUDE E/W'], l['HEIGHT'])
out += wpt
out += "</gpx>" + "\n"
fd = open(outfile, "w")
fd.write(out)
fd.close()
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users