cfgReadChar('gpsdatabase.host'); $gps_db_port = $savvyext->cfgReadLong('gpsdatabase.port'); $gps_db_name = $savvyext->cfgReadChar('gpsdatabase.name'); $gps_db_user = $savvyext->cfgReadChar('gpsdatabase.user'); $gps_db_pass = $savvyext->cfgReadChar('gpsdatabase.pass'); $conn_string_gps = "host=${gps_db_host} port=${gps_db_port} dbname=${gps_db_name} user=${gps_db_user} password=${gps_db_pass}"; $pgconn_gps = pg_connect($conn_string_gps); $res = []; $min_lat = PHP_INT_MAX; $min_lng = PHP_INT_MAX; $max_lat = PHP_INT_MIN; $max_lng = PHP_INT_MIN; $center_lat = 0; $center_lng = 0; $limit_lat = 48.90972600; $limit_lng = 24.78142110; $limit_rad = 3500; //$q = "select * from members_tracking where member_id=13 and id>1961278 and id<1961766 order by created"; $q = "select * from members_tracking where member_id=13 and id>1961278 and id<1961766 "; $q.= " and ST_DWithin(gps,ST_SetSRID(ST_MakePoint(${limit_lng},${limit_lat}),4326)::geography,${limit_rad}) "; $q.= " order by created"; //echo $q; $r = pg_query($pgconn_gps, $q); while ($f=pg_fetch_assoc($r)) { $res[] = $f; if ($f["lat"]<$min_lat) $min_lat = $f["lat"]; if ($f["lng"]<$min_lng) $min_lng = $f["lng"]; if ($f["lat"]>$max_lat) $max_lat = $f["lat"]; if ($f["lng"]>$max_lng) $max_lng = $f["lng"]; } $center_lat = ($min_lat+$max_lat)/2; $center_lng = ($min_lng+$max_lng)/2; pg_close($pgconn_gps); ?> GPS speed test

ID GPS Speed Time Created
,