Database Reference
In-Depth Information
@echo off
for %%I in (runkeeper_gpx\*.gpx*) do (
echo Importing gpx file %%~nxI to
chp03.rk_track_points PostGIS table...
ogr2ogr -append -update -f PostgreSQL
PG:"dbname='postgis_cookbook' user='me'
password='mypassword'" runkeeper_gpx/
%%~nxI -nln chp03.rk_track_points -sql
"SELECT ele, time FROM track_points"
)
4. In Linux, don't forget to assign execution permission to it before running it.
Run the following script:
$ chmod 775 import_gpx.sh
$ ./import_gpx.sh
Importing gpx file 2012-02-26-0930.gpx to
chp03.rk_track_points PostGIS table...
Importing gpx file 2012-02-29-1235.gpx to
chp03.rk_track_points PostGIS table...
...
Importing gpx file 2011-04-15-1906.gpx to
chp03.rk_track_points PostGIS table...
In Windows, just double-click on the .bat file or run it from the command
prompt using the following command:
> import_gpx.bat
5. Now,createapolylinetablecontainingasinglerunner'strackdetails,using
the ST_MakeLine function.Assumethatoneachdistinctdaytherunnerhad
justonetraining.Inthistable,youshouldincludethestartandendtimesof
the track details as follows:
postgis_cookbook=# SELECT
ST_MakeLine(the_geom) AS the_geom,
run_date::date,
MIN(run_time) as start_time,
Search WWH ::




Custom Search