Browsing Category "geo/gps"
30 Dez
2009
Posted in: geo/gps, OS X
By    No Comments

Openstreet Map Karten mit Basecamp auf Mac OS X benutzen

Um das alles mal auszuprobieren hatte ich mir bei der Geofabrik einen Ausschnitt (NRW) vom Planet.osm von der Geofabrik besorgt.

Die eingesetzten Werkzeuge waren:

  • splitter
  • mkgmap
  • gmapi-builder
  • Ursprünglich hatte ich es probiert mit mkgmap die Karten direkt aus dem nrw.osm file zu rechnen. Leider bekam ich selbst nach der Zuweisung von 2GB Heapspace noch “Out of Memory” Errors.

    Nach dem Auspacken des Planet-Auschnittes (1,5GB) habe ich dieses erst einmal in verdauliche Häppchen aufgeteilt. Möglicherweise gehen dabei Relationen verloren, die sich über mehrere Kacheln erstrecken.

    java -Xmx1024m -jar ../tools/splitter-r103/splitter.jar --max-nodes=900000 nordrhein-westfalen.osm

    Die daraus resultierenden Dateien konnte ich dann problemlos mit mkgmap weiterverarbeiten.

    java -Xmx1024m -jar ../tools/mkgmap-r1443/mkgmap.jar --tdbfile  --remove-short-arcs \
    --route --net --no-sort-roads --family-id=7331 --family-name="OSM NRW" \
    --series-name="OSM NoRhWe" -c template.args

    Die Family-Id muss eindeutig sein. Der Series-Name ist bei mir als Name der erstellten Karte innerhalb von Basecamp zu sehen.

    Um die Karten dann unter Basecamp nutzen zu können, muss man noch den gmapi-builder bemühen:

    gmapi-builder.py -t osmmap.tdb -b osmmap.img  *.img

    Das Ergebnis muss dann mit dem Map-Manager installiert werden und die Karten sind dann mit Basecamp (ab Version 2.1.1) und Roadtrip nutzbar.

    Ausblick:

    Ich werde noch ein bisschen mit TYP Files arbeiten um das Aussehen der Karten meinen Bedürfnissen anzupassen. Weiterhin habe ich noch nicht verstanden wir man die Style Dateien einsetzt um bestimmte Elemente innerhalb der Karten ein- bzw.. auszublenden.

    Der Download des Europa-Ausschnitts läuft bereits. Bin mal gespannt wie lange der rechnet :)

    11 Aug
    2008
    Posted in: Cycling, geo/gps, Ruby
    By    No Comments

    Ten times faster!

    I’ve managed to optimize the performance of my Hac4/GPS data merging script.

    Optimized Version
    2,33s user 0,06s system 89% cpu 2,677 total

    Old merge and libxml-ruby
    13,06s user 0,15s system 91% cpu 14,382 total

    Old merge and rexml
    26,86s user 0,21s system 96% cpu 27,987 total

    And this is the track which I used for the tests. The track has 1554 trackpoints. I took this route on Saturday.

    6 Aug
    2008
    Posted in: geo/gps, Ruby
    By    No Comments

    New merge algorithm

    This should be a comment to a previous post, but it seems that code is not well formatted in comments :(

    This code snippet below should lead me into the right direction for better performance in merging my cycling log data

    def new_merge(gpx, hac, delta)

      #
      # adjust the 2 arrays
      # (works only if gpx starts earlier)
      #
      while gpx.first[:time] < asc.first[:time]
        gpx.shift
      end
     
      #
      # merge data
      #
      asc.each do |h|

        # next if there gps dropouts
        next if h[:time] + 2 > gpx.first[:time]
        h.merge!(gpx.shift)
        break if gpx.size == 0
      end
      0
    end
    5 Aug
    2008
    Posted in: geo/gps, Ruby
    By    2 Comments

    Combine Hac4 Data with GPS logger data

    If have already a script running which is merging the data of those two devices. But after using libxml I got aware of the awful performance of the merging algorithm.

    d = Array.new
    asc.each do |c|
    gpx.each do |e|
    f = (c[:time] + @delta.to_i) - e[:time]
    if f = -2
    d &lt;&lt; {:gpx =&gt; e, :asc =&gt; c}
    end
    end
    end

    I created the image which will probably help me in developing a faster algorithm.

    5 Aug
    2008
    Posted in: geo/gps, Ruby
    By    7 Comments

    Reading GPX with Ruby

    Sometime back in May I wrote some utilities to manage the GPX files from my Royaltek RGM 3800. I’ve used rexml to parse the XML file. Now after I’ve read about libxml for ruby I’ve had tried this little gem and I have registered that parsing the GPX file is significantly faster.
    This was the old code from May with rexml:

    def parse_gpx(file)
      require 'rexml/document'
      include REXML
      a = Array.new
      doc = Document.new File.new(file)
      i = 0
      doc.elements.each("gpx/trk/trkseg/trkpt") { |e|
        a << {:time => Time.parse(e.elements["time"].to_a.first.to_s)}
        a[i][:lat] = e.attributes["lat"].to_s;
        a[i][:lon] = e.attributes["lon"].to_s;
        a[i][:ele] = e.elements["ele"].to_a.first.to_s
        a[i][:speed] = e.elements["speed"].to_a.first.to_s
        a[i][:course] = e.elements["course"].to_a.first.to_s
        a[i][:fix] = e.elements["fix"].to_a.first.to_s
        i += 1
      }
      return a
    end

    And this is the code using libxml which I wrote after learning a little bit more ruby ;)

    def parse_gpx(file)
      require 'rubygems'
      require 'libxml'
      a = Array.new
      doc = LibXML::XML::Document.file(file)
      nodes = doc.find '/ns:gpx/ns:trk/ns:trkseg/ns:trkpt',
                         "ns:http://www.topografix.com/GPX/1/0"
      nodes.each do |e|
        a << {:lat => e[:lat], :lon => e[:lon]}
        node = a.last
        e.each do |n|
          node[n.name.to_sym] = n.children.to_s if n.children?
        end
        node[:time] = Time.parse(node[:time])
      end
      return a
    end

    This code is part of a little script which I use to combine data from the GPS logger device with the data which is provided by my cycle computer (heart rate, barometric height, cadence, speed etc.).