File "gps.phtml"
Full path: /www/map/mapserver-php/gps.phtml
File size: 3.5 KiB (3582 bytes)
MIME-type: text/html
Charset: 8 bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=Shift-JIS">
<title>ѓ_ѓCѓiѓ~ѓbѓNѓЊѓCѓ„Ѓ[</title>
</head>
<body>
<center>
<img src=/mapserver-php/img/powered_mapserver.jpg>
<b>PHP-Mapscript‚рЋg‚Б‚ЅЋФ—ј“®‘ФЉЗ—ќ‚МѓTѓ“ѓvѓ‹ЃEѓvѓЌѓOѓ‰ѓЂ</b>
<br>
<br>
<?php
//
// Loading the map file
//
global $map;
$map = ms_newMapObj("mapfiles/gps.map");
if ( isset($_GET['lat']) && isset($_GET['long']) ) {
$rectobj = $map->extent;
$diffx = ($rectobj->maxx - $rectobj->minx)/2;
$diffy = ($rectobj->maxy - $rectobj->miny)/2;
global $long;
global $lat;
$long = $_GET['long'];
$lat = $_GET['lat'];
$map->setextent($long-$diffx,$lat -$diffy,$long+$diffx,$lat +$diffy);
//
// Create Point and Assign lon,lat values
//
$pointobj = ms_newPointObj();
$pointobj->setXY($_GET['long'],$_GET['lat']);
//
// Create a Line Object that will contain the Point Object
//
$lineobj = ms_newLineObj();
$lineobj->add($pointobj);
$shapeobj = ms_newShapeObj(MS_SHAPE_POINT);
$shapeobj->add($lineobj);
//
// Create a new Dynamic Layer
//
$layerobj = ms_newLayerObj($map);
$layerobj->set('type',MS_LAYER_POINT);
$layerobj->set('status',MS_DEFAULT);
$layerobj->set('name','Dynamic Layer');
//
// Add Line Object to the Layer
//
$layerobj->addFeature($shapeobj);
//
// Create a Class and Style Objects for the Layer
//
$classobj = ms_newClassObj($layerobj);
$styleobj = ms_newStyleObj($classobj);
//
// Assign Graphic Icon to the Style Object
//
$styleobj->set("symbolname","../img/van.png");
}
if ( isset($_GET['p_x']) && isset($_GET['p_y']) ) {
$px = $_GET['p_x'];
$py = $_GET['p_y'];
$rect = ms_newRectObj();
if( isset($_GET['minx']) && isset($_GET['miny']) &&
isset($_GET['maxx']) && isset($_GET['maxy']) ) {
$rect->set('minx', $_GET['minx']);
$rect->set('miny', $_GET['miny']);
$rect->set('maxx', $_GET['maxx']);
$rect->set('maxy', $_GET['maxy']);
}
else {
$rect->set('minx', $map->extent->minx );
$rect->set('miny', $map->extent->miny );
$rect->set('maxx', $map->extent->maxx );
$rect->set('maxy', $map->extent->maxy );
}
$pixelpt = ms_newPointObj();
$pixelpt->setXY($px,$py);
$map->zoompoint(1,$pixelpt,$map->width,$map->height,$rect);
}
$web = $map->web;
$web->set("imagepath","/var/www/html/mapserver-php/tmp/");
$web->set("imageurl","/mapserver-php/tmp/");
$img = $map->draw();
$mapURL = $img->saveWebImage();
?>
<center>
<form>
<input type=image name=p src=<?= $mapURL ?> border="1" >
<?php
if(isset($long) && isset($lat)) {
echo "<input type=hidden name=long value=".$long.">\n";
echo "<input type=hidden name=lat value=".$lat .">\n";
}
echo "<input type=hidden name=minx value=".$map->extent->minx .">\n";
echo "<input type=hidden name=miny value=".$map->extent->miny .">\n";
echo "<input type=hidden name=maxx value=".$map->extent->maxx .">\n";
echo "<input type=hidden name=maxy value=".$map->extent->maxy .">\n";
?>
</form>
<br>
GPS Points
<table width=500 border=1>
<tr bgcolor=pink>
<td>
<a href=/mapserver-php/gps.phtml?long=139.697&lat=35.689>
2004-04-15 13:04:45 </a>
</td>
<td>139.697</td>
<td>35.689</td>
</tr>
<tr>
<td>
<a href=/mapserver-php/gps.phtml?long=139.737&lat=35.628>
2004-04-15 13:24:45 </a>
</td>
<td>139.737</td>
<td>35.628</td>
</tr>
<tr bgcolor=pink>
<td>
<a href=/mapserver-php/gps.phtml?long=139.765&lat=35.681>
2004-04-15 13:54:45 </a>
</td>
<td>139.765</td>
<td>35.681</td>
</tr>
</table>
</body>
</html>