The Following 6 Users Say Thank You to weißelstone For This Useful Post: | ||
|
2010-06-29
, 20:18
|
Posts: 200 |
Thanked: 300 times |
Joined on Nov 2009
@ The Netherlands
|
#2
|
|
2010-06-29
, 20:24
|
Posts: 1,378 |
Thanked: 1,604 times |
Joined on Jun 2010
@ Göteborg, Sweden
|
#3
|
|
2010-06-29
, 20:37
|
Posts: 94 |
Thanked: 40 times |
Joined on Jun 2010
@ Germany
|
#4
|
*snip the whole gps and internet stuff* if device.fix: if device.fix[1] & location.GPS_DEVICE_LATLONG_SET: print "lat = %f, long = %f" % device.fix[4:6] url= "http://server.de/gps/upload.php?lat=%f&lon=%f&key=XXX" % device.fix[4:6] print url req = urllib2.Request(url) reply = urllib2.urlopen(req)
<?php
$db= new mysqli('localhost', 'root', 'root', 'test');
if (mysqli_connect_errno()) {
die ('Konnte keine Verbindung zur Datenbank aufbauen: '.mysqli_connect_error().'('.mysqli_connect_errno().')');
}
$sql='INSERT INTO
gps(lat, lon, date)
VALUES
('.$_GET['lat'].',
'.$_GET['lon'].',
NOW());';
$result = $db->query($sql);
if (!$result) {
die ('Etwas stimmte mit dem Query nicht: '.$db->error);
}
?>
<?php
$db= new mysqli('localhost', 'root', 'root', 'test');
if (mysqli_connect_errno()) {
die ('Konnte keine Verbindung zur Datenbank aufbauen: '.mysqli_connect_error().'('.mysqli_connect_errno().')');
}
$sql="SELECT
lat,
lon,
DATE_FORMAT(date, '%Y-%m-%dT%H:%i:%sZ') as newdate
FROM
gps
ORDER BY date DESC LIMIT 1";
$result = $db->query($sql);
if (!$result) {
die ('Etwas stimmte mit dem Query nicht: '.$db->error);
}
$row = $result->fetch_assoc();
echo '<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>KmlFile</name>
<Style id="bike-icon">
<IconStyle>
<Icon>
<href>http://server.de/gps/bike.png</href>
</Icon>
</IconStyle>
</Style>';
$sql="SELECT
lat,
lon,
DATE_FORMAT(date, '%Y-%m-%dT%H:%i:%sZ') as newdate
FROM
gps
ORDER BY date DESC LIMIT 1";
$result = $db->query($sql);
if (!$result) {
die ('Etwas stimmte mit dem Query nicht: '.$db->error);
}
while ($row = $result->fetch_assoc()) {
echo '<Placemark>
<name>'.$row['newdate'].'</name>
<description>Hier wurde die letzte Position gesendet.</description>
<Point>
<coordinates>'.$row['lon'].','.$row['lat'].',0</coordinates>
</Point>
<!--<TimeStamp>
<when>'.$row['newdate'].'</when>
</TimeStamp>-->
<styleUrl>#bike-icon</styleUrl>
</Placemark>
';
}
echo '</Document>
</kml>';
?>
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <NetworkLink> <name>Mein N900</name> <visibility>1</visibility> <open>1</open> <description>N900 On Tour</description> <refreshVisibility>0</refreshVisibility> <flyToView>1</flyToView> <Link> <href>http://server.de/gps/lastpos.php?key=XXX</href> <refreshMode>onInterval</refreshMode> <refreshInterval>30</refreshInterval> </Link> </NetworkLink> </kml>
|
2010-06-29
, 21:00
|
|
Posts: 2,853 |
Thanked: 968 times |
Joined on Nov 2005
|
#5
|
|
2010-06-29
, 21:11
|
Posts: 94 |
Thanked: 40 times |
Joined on Jun 2010
@ Germany
|
#6
|
|
2010-06-29
, 21:23
|
Posts: 200 |
Thanked: 300 times |
Joined on Nov 2009
@ The Netherlands
|
#7
|
|
2010-06-29
, 21:29
|
Posts: 9 |
Thanked: 8 times |
Joined on Dec 2009
|
#8
|
|
2010-06-30
, 07:53
|
Posts: 94 |
Thanked: 40 times |
Joined on Jun 2010
@ Germany
|
#9
|
I like to know how you automaticly connect to an available internet connection (detect if there is already a connection and if not connect to a available connect and test if this connection works and if not chose another one and so on...).
|
2010-06-30
, 08:23
|
Posts: 82 |
Thanked: 44 times |
Joined on Feb 2010
|
#10
|
Already done:
TODO ideas:
show speed at the moment of the last locationset up a SVN if others are interestedcreate Google Map on the serverUpdates get different colors to get them in one look
The project is now located here with a very simple first version: https://garage.maemo.org/projects/pygeotrack/
So, is there any interest in this application? If some people would be interested I'd package it up and set up a svn (or garage page, didn't look into the whole garage thing yet). I'd also be happy if someone wants to work on it together with me (that's where the SVN comes into the game).
Last edited by weißelstone; 2010-07-01 at 16:06.