Skip to content

Commit 0d1d11e

Browse files
committed
#77 change gdal_dsn
1 parent 2a6b04d commit 0d1d11e

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

twmap_gen/config.inc.php.sample

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ $db_user = "";
3434
$db_pass = "";
3535
$db_name = "";
3636
$db_port = '5432';
37-
$db_dsn = sprintf("postgres9://%s:%s@%s:%s/%s",$db_user,$db_pass,$db_host,$db_port,$db_name);
38-
$gdal_dsn = sprintf("PG:dbname='%s' user='%s' password='%s' host='%s' port='%s'",$db_name,$db_user,$db_pass,$db_host,$db_port);
37+
$db_dsn = sprintf("postgres://%s:%s@%s:%s/%s",$db_user,$db_pass,$db_host,$db_port,$db_name);
38+
// from gdal 3.4
39+
$gdal_dsn = sprintf("postgresql://%s:%s@%s:%s/%s",$db_user,$db_pass,$db_host,$db_port,$db_name);
3940

4041
require_once(__ROOT__."lib/twmapdb.inc.php");
4142

@@ -77,4 +78,4 @@ $CONFIG['memcache_port'] = 11211;
7778
// redis server
7879
$CONFIG['redis_server'] = '127.0.0.1';
7980
$CONFIG['redis_port'] = 6379;
80-
$CONFIG['redis_password'] = 'myredispassword';
81+
$CONFIG['redis_password'] = 'myredispassword';

twmap_gen/lib/twmapdb.inc.php

+15-4
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ function tilestache_clean($mid, $realdo = 1){
886886
}
887887
// moi_osm_gpx
888888
$cmd2 = sprintf("ssh happyman@twmap tilestache-clean.py -c /home/happyman/etc/tile_main_8089.cfg -l gpxtrack -b %f %f %f %f 10 11 12 13 14 15 16 17 18 2>&1 > /dev/null ",$tl[1],$tl[0],$br[1],$br[0]);
889+
$cmd2 = sprintf("tilestache-clean.py -c /home/happyman/etc/tile_main_8089.cfg -l gpxtrack -b %f %f %f %f 10 11 12 13 14 15 16 17 18 2>&1 > /dev/null ",$tl[1],$tl[0],$br[1],$br[0]);
889890
exec($cmd2);
890891
error_log("tilestache_clean: ". $cmd2);
891892
return array(true, "gpxtrack cleaned");
@@ -1385,17 +1386,27 @@ function ogr2ogr_export_gpx($mid, $merged_gpx) {
13851386
$cmd = sprintf("ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=YES -lco FORCE_GPX_TRACK=YES %s %s -where \"mid=%d\" gpx_trk ", $trk_gpx, $gdal_dsn, $mid);
13861387
// echo $cmd;
13871388
exec($cmd, $out, $ret);
1388-
if ($ret != 0 ) return array(false, "export trk failed");
1389+
if ($ret != 0 ) {
1390+
error_log($cmd . " fail");
1391+
return array(false, "export trk failed");
1392+
}
13891393
$wpt_gpx = tempnam("/tmp","EXPW") . ".gpx";
13901394
$cmd2 = sprintf("ogr2ogr -f GPX -dsco GPX_USE_EXTENSIONS=YES -lco FORCE_GPX_TRACK=YES %s %s -where \"mid=%d\" gpx_wp ", $wpt_gpx, $gdal_dsn, $mid);
13911395
// echo $cmd2;
13921396
exec($cmd2, $out, $ret);
1393-
if ($ret != 0 ) return array(false, "export wpt failed");
1397+
if ($ret != 0 ) {
1398+
error_log($cmd2 . " fail");
1399+
return array(false, "export wpt failed");
1400+
}
13941401
// $merged_gpx = tempnam("/tmp","EXPM") . ".gpx";
13951402
$cmd3 = sprintf("gpsbabel -i gpx -f %s -f %s -o gpx,gpxver=1.1 -F %s",$trk_gpx,$wpt_gpx,$merged_gpx);
13961403
exec($cmd3, $out, $ret);
1397-
if ($ret != 0 ) return array(false, "merge gpx failed: $cmd3");
1398-
unlink($wpt_gpx);unlink($trk_gpx);
1404+
if ($ret != 0 ) {
1405+
error_log($cmd3 . " fail");
1406+
return array(false, "merge gpx failed: $cmd3");
1407+
}
1408+
unlink($wpt_gpx);
1409+
unlink($trk_gpx);
13991410
return array(true, "ok");
14001411
}
14011412
// map ranking system

0 commit comments

Comments
 (0)