User Tools

Site Tools


gis_tools

Openstreetmap

Get extract

wget -O vienna.osm "http://www.overpass-api.de/api/xapi?map?bbox=16.25,48.1,16.5,48.3"

Get statistics

wget -O - http://m.m.i24.cc/osmfilter.c |cc -x c - -O3 -o osmfilter # found at http://wiki.openstreetmap.org/wiki/Osmfilter 
./osmfilter estonia.osm --out-count

QGIS

Gpsbabel

GPSBabel converts waypoints, tracks, and routes between popular GPS receivers and mapping programs. It also has powerful manipulation tools for such data. Install it

sudo aptitude install gpsbabel

General Information

gpsbabel understands lots of formats and supports lots of filter functions like removing duplicates, sorting waypoints etc. Look for the -x option in the man page.

It is written in C.

Routes,Tracks,Waypoints

First a general note: GPSBabel distinguishes between routes, tracks and waypoints. So typically you will want to pass one of the following switches on the commandline

* -r Process route information * -t Process track information * -w Process waypoint information [default]

If you do a conversion and the output file is empty, it is most likely that you need to use a different of the above switches!

Examples

Convert GPX to CSV

gpsbabel -t -i gpx -f input.gpx -o unicsv -x track,course,speed -F output.csv

Add Speed and Course

If you are processing 'track information' use the switch

 -x track,course,speed

Converting GPS NMEA to GPX

 gpsbabel  -i nmea,date=20090601 -f input.nmea -x transform,wpt=trk -o gpx -F output.gpx

Notes:

* a date (see example above) must be given if your GPS data doesn't contain one already. * wpt=trk creates waypoints out of tracks.

Download tracks from QStarz BT-Q1000

These tracking devices connect via USB. In Ubuntu 10.04 the device should be accessible at /dev/ttyACM0 by default.

Data can then be downloaded (details here):

gpsbabel -t -w -i mtk -f /dev/ttyACM0 -o gpx -F out.gpx

More documentation in gpsbabel's manpage and here.

mtkbabel

The OSS mtkbabel (made using Perl) works with Mediatek mtk chipsets, which are eg. part of Qstarz tracking devices. Besides downloading data, allows for scriptable configuration of the device (control settings, change log file layout etc.)

sudo apt-get install mtkbabel

bt747

This Java tool aims to provide a GUI for GPS logging device configuration and log data handling. It is available for desktops and mobile devices.

ogr2ogr

Merge shapefiles

ogr2ogr merged.shp file1.shp                                    # create a copy of file1
ogr2ogr -update -append merged.shp file2.shp -nln merge         # append file2

Merge *.gpx into Shapefile

#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en '\n')
for f in *.gpx
do
  ogr2ogr gpx.shp -append "$f" tracks -fieldTypeToString DateTime
done
IFS=$SAVEIFS 

Export layer from Geopackage to CSV

ogr2ogr -f CSV export.csv source_geopackage.gpkg layer_name -lco GEOMETRY=AS_XY
gis_tools.txt · Last modified: 2019/02/27 15:44 by mstraub