[Openstreetmap] PHP version of gps.jsp
Christopher Schmidt
crschmidt at crschmidt.net
Fri Nov 26 05:12:10 GMT 2004
Hi there -
Found the project tonight via some RDF friends, and noticed the HOWTO
mentioning the ability to make a simpler version of the gps.jsp (for
those of us who aren't javaheads and don't have tomcat around.)
I hacked up the code that *should* be able to do this
(although it is very untested, and it's late, so I may have made stupid
errors.) I don't have an opengis capable database to try this on, so I'm
just guessing in the dark.
The code is attached. Feel free to let me know any problems you find,
and I'll attempt to debug them.
--
Christopher Schmidt
crschmidt at crschmidt.net
-------------- next part --------------
<? // By Christopher Schmidt, crschmidt at crschmidt.net
// Completely untested, mostly because I don't have a db
// that supports 4.1's geometry extensions.
?>
<html>
<head>
<title>OpenStreetMap</title>
</head>
<body>
Enter a text note below:<br><Br>
<FORM method="GET" action="<?=$PHP_SELF?>">
<INPUT type="text" name="txt" size="30" maxlength="255">
<INPUT type="submit" value="Add text note!">
</form>
<?
$x = 0;
$y = 0;
$timestamp = 0;
$conn = mysql_connect("localhost","openstreetmap", "openstreetmap")
mysql_select_db("openstreetmap");
if( $txt )
{
mysql_query("insert into tempNotes values ('".$txt."',NOW())");
}
$results = mysql_query("select x(g) as x,y(g) as y,timestamp from tempPoints order by timestamp desc limit 1");
$rs = mysql_fetch_array($results);
$x = $rs['x'];
$y = $rs['y'];
$timestamp = $rs[timestamp];
?>
<br>
Last recorded point was:
<table>
<tr>
<td align="right">
<b>Lat:</b>
</td>
<td>
<?=$x?>
</td>
<tr>
<td align="right">
<b>Lon:</b>
</td>
<td>
<?=$y?>
</td>
<tr>
<td align="right">
<b>Time:</b>
</td>
<td>
<?=date("l dS of F Y h:i:s A",$timestamp);?>
</td>
</tr>
</table>
</body>
</html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20041126/6bc64f75/attachment.pgp>
More information about the talk
mailing list