Sistem Informasi Geografis Berbasis Web Untuk Menentukan Jarak Terpendek Menggunakan Algoritma Dijkstra (Studi Kasus : Plaza Mall Dikota Medan)

Teks penuh

(1)

LAMPIRAN

1.List Program Index.php

<!DOCTYPE html> <html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>GIS Jalur Terpendek Mall Medan Universitas Sumatera Utara</title> <link type="text/css" href="css/style.css" rel="stylesheet" />

<script type="text/javascript" src="http://tile.cloudmade.com/wml/latest/web-maps-lite.js"></script>

<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.20.custom.min.js"></script>

<script type="text/javascript" src="css/ui-lightness/jquery-ui-1.8.20.custom.css"></script> <link rel="stylesheet" href="js/script/themes/base/jquery.ui.all.css">

<script src="js/jquery.form.js" type="text/javascript"></script> <script src="js/formQueryBuilder.js" type="text/javascript"></script>

<script type="text/javascript"> $(function() {

peta_awal(); });

function peta_awal(){

var cloudmade = new CM.Tiles.CloudMade.Web({key: '9c4b0691bd814c389ed0817f1c1d407e'});

(2)

var medan=new CM.LatLng(3.5912003919158533, 98.67774286037593); map.setCenter(medan, 14);

map.addControl(new CM.LargeMapControl());

var CloudMadeIcon = new CM.Icon(); CloudMadeIcon.image = "marker.png";

CloudMadeIcon.iconSize = new CM.Size(50, 50); CloudMadeIcon.iconAnchor = new CM.Point(25, 50);

var myMarker = new Array(10); data = new Array (9);

for (i = 0; i < data . length; ++ i) data [i] = new Array (8);

data[0]['x']=3.589492320629244; data[0]['y']=98.661775588989260; data[0]['t']="Medan Plaza";

data[1]['x']=3.583067624935456; data[1]['y']=98.671946525573730; data[1]['t']="Sun Plaza";

(3)

data[4]['x']=3.611421607722068; data[4]['y']=98.61113548278809; data[4]['t']="Millenium Plaza"; data[5]['x']=3.590177618837350; data[5]['y']=98.673191070556640; data[5]['t']="Grand Paladium"; data[6]['x']=3.587265097902338; data[6]['y']=98.682889938354490; data[6]['t']="Medan Mall";

data[7]['x']=3.582553647330075; data[7]['y']=98.68100166320801; data[7]['t']="Yuki Simpang Raya"; data[8]['x']=3.778357838460572; data[8]['y']=98.68709564208984; data[8]['t']="pelabuhan belawan";

for(var i=0; i<=data.length; i++) {

var myMarkerLatLng = new CM.LatLng(data[i]['x'], data[i]['y']); myMarker[i] = new CM.Marker(myMarkerLatLng, {

title: data[i]['t'], icon:CloudMadeIcon });

(4)

}

function slideSwitch() {

var $active = $('#slideshow DIV.active');

if ( $active.length == 0 ) $active = $('#slideshow DIV:last'); var $next = $active.next().length ? $active.next()

: $('#slideshow DIV:first');

$active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active')

.animate({opacity: 1.0}, 1100, function() { $active.removeClass('active last-active'); });

}

function showAlert(obj,txt,tm){ $(obj).hide();

$(obj).html('<p>'+txt+'</p>');$(obj).show('slow');

setTimeout(function(){ $(obj).hide('slow');$(obj).html('');},tm); }

function content_tengah(aksi){ $("#tengah").fadeOut('slow'); $("#tengah").fadeIn('slow');

(5)

}

function content_diagnosa(id){ $("#tengah").fadeOut('slow'); $("#tengah").fadeIn('slow');

$("#tengah").load("tengah.php?get=startdiagnosa&id="+id); }

function PostDetail(form){

var id=$("#IDPasien").val(); var json = buildQuery(form); $.ajax({

type: form.method, url: form.action, data: json, cache: false });

alert("Anda Menuju Halaman Diagnosa ...!!");

$("#tengah").load("tengah.php?get=hasildiagnosa&id="+id); }

</script>

<style type="text/css"> #slideshow {

(6)

height:200px; padding:0px; margin-left:10px; }

#slideshow DIV { position:absolute; top:0;

left:0; z-index:8; opacity:0.0; height: 100px;

background-color: #FFF; padding:0px;

margin:0px; }

#slideshow DIV.active { z-index:10;

opacity:1.0; }

#slideshow DIV.last-active { z-index:9;

}

(7)

display: block; border: 0;

margin-bottom: 0px; }

</style>

</head> <body>

<div id="wrap">

<div id="header"><img src="img/header.png" height="150" width="100%"></div>

<div id="kanan"><?php include("kanan.php"); ?></div>

<div id="tengah"><div id="petaku" style="width:965px; height:500px; border:solid 1px silver;"></div></div>

<div style="clear:both;"></div>

<div id="foter">Copyright © 2012 - Adly Azhary </div> </div>

</body> </html>

2. List Program kanan.php

<?php

include("connect.php");

(8)

echo "<div style='border-bottom:solid 1px silver;height:auto;text-align:left;margin-bottom:0px;padding:5px'>";

echo "<div class='judul'>Login Area</div><br>"; echo "

<form method='post' action='login.php'> <table>

<tr>

<td>Username</td>

<td><input type='text' name='username' size='10' /></td> </tr>

<tr>

<td>Password</td>

<td><input type='password' name='password' size='10' /></td> </tr>

<tr>

<td>&nbsp;</td>

<td><input type='submit' name='submit' value='Login' /></td> </tr>

</table> </form> ";

echo "</div>";

echo "<div style='border-bottom:solid 1px silver;height:auto;text-align:left;margin-bottom:0px;padding:5px'>";

(9)

echo "

<form method='post' action='ruting.php'> <table>

<tr>

<td>Awal</td>

<td>".ddownAwal()."</td> </tr>

<tr>

<td>Akhir</td>

<td>".ddownAkhir()."</td> </tr>

<tr>

<td>&nbsp;</td>

<td><input type='submit' id='tbldjikstra' value='Djikstra'></td> </tr>

</table> </form> ";

echo "</div>"; ?>

3. List Program Login.php

<?php

session_start();

(10)

$username=$_REQUEST['username']; $password=$_REQUEST['password'];

$sql=mysql_query("select username,password from user where username ='$username' and password=md5('$password')");

if(mysql_num_rows($sql)==1){ // echo "Sukses";

$_SESSION['user']=$username; header("location: admin.php"); }else{

// echo "Gagal";

header("location:http://localhost/adlingis/"); }

?>

4. List Program Routing.php

<script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript" src="http://tile.cloudmade.com/wml/latest/web-maps-lite.js"></script>

<script type="text/javascript"> var map;

function peta_awal(){

var cloudmade = new CM.Tiles.CloudMade.Web({key: '9c4b0691bd814c389ed0817f1c1d407e'});

var map = new CM.Map('cm-example', cloudmade);

(11)

CM.Event.addListener(map, 'click', function(latlng) { kasihtanda(latlng);

}); }

function kasihtanda(lokasi){

$("#form_lokasi").slideDown(); $("#cx").val(lokasi.lat(15)); $("#cy").val(lokasi.lng(15)); }

function setpeta(x,y){

var cloudmade = new CM.Tiles.CloudMade.Web({key: '9c4b0691bd814c389ed0817f1c1d407e'});

var map = new CM.Map('cm-example', cloudmade); var myMarkerLatLng = new CM.LatLng(x, y);

var myMarker = new CM.Marker(myMarkerLatLng, { title: ""

});

map.setCenter(myMarkerLatLng, 14); map.addOverlay(myMarker);

}

function setnavigasi(x1,y1,x2,y2){ var map = new CM.Map('cm-example',

(12)

var directions = new CM.Directions(map, 'panel', '9c4b0691bd814c389ed0817f1c1d407e');

var points1=new CM.LatLng(x1, y1); var points2=new CM.LatLng(x2, y2); var waypoints = [points1, points2];

directions.loadFromWaypoints(waypoints); directions.getDistance().toString();

} </script> <style>

table{background-color:;border:0px;font-family:tahoma} table th{background-color:black;color:white;padding:1px}

table tr td{background-color:white;color:black;padding 0px;border:solid 1px teal;} #footer{

border:solid 1px silver; -moz-border-radius: 5px;

margin:5px; text-align:center;

background-image:url('img/bg.jpg'); color:white;

font-weight:; padding:5px; }

(13)

#header{

border:solid 1px silver;

margin:0px; color:white; text-align:center;

background-image:url('img/bg.jpg'); }

</style> <?php

include "connect.php";

$awal=$_REQUEST['KodeAwal']; $akhir=$_REQUEST['nomor'];

$sql=mysql_query("SELECT * FROM peta_icon WHERE nomor=$awal"); $row=mysql_fetch_array($sql);

$x1=$row['lat']; $y1=$row['lng'];

$sql2=mysql_query("SELECT * FROM peta_icon WHERE nomor=$akhir"); $row2=mysql_fetch_array($sql2);

$x2=$row2['lat']; $y2=$row2['lng']; ?>

</head>

<body onLoad="javascript:setnavigasi(<?php echo "$x1,$y1,$x2,$y2"?>)">

(14)

<div id="cm-example" style="width: 60%; height: 500px;float:left;border:solid 1px silver"></div>

<div id="detailjalan" style="width: 39%; height: 500px;float:left;border:solid 1px silver;overflow:scroll">

<?php

$aa="select a.nama from peta_icon a where a.nomor='$awal'"; $bb=mysql_query($aa);

$cc=mysql_fetch_array($bb); $pos_awal=$cc['nama'];

$aaa="select a.nama from peta_icon a where a.nomor='$akhir'"; $bbb=mysql_query($aaa);

$ccc=mysql_fetch_array($bbb); $pos_akhir=$ccc['nama']; echo "

<table width=500>

<tr><td colspan=3 align=center>Djikstra Search <br> Dari :".$pos_awal." Ke Mall: ".$pos_akhir."</td></tr>

<tr>

<th>No.</th>

<th>Nama Jalan</th> <th>Jarak</th> </tr>

";

$a="select a.noRute from rute2 a left join rute b on a.noRute=b.noRute where

(15)

while($r=mysql_fetch_array($b)){ $norute=$r['noRute'];

$a1="select a.jalan,a.km,a.rute,a.noRute from rute2 a where a.noRute='$norute'"; $b1=mysql_query($a1);

echo "<tr><td colspan=3 align=left>Melalui Rute :".$norute."</td></tr>"; $no=1;

$ttl_jarak=0;

while($r1=mysql_fetch_array($b1)){ echo "

<tr>

<td>".$no."</td> <td>".$r1['jalan']."</td> <td>".$r1['km']." Km</td> </tr>

";

$ttl_jarak+=$r1['km']; $no++;

}

echo "<tr><td colspan=2 align=left>Jarak Total :</td><td>".$ttl_jarak."</td></tr>";

echo "<tr><td colspan=3></td></tr>"; echo "<tr><td colspan=3></td></tr>"; }

(16)

?> </div>

<div style="clear:both;"></div>

<div id="footer">Copyright : Adly Azhary<br>Ekstensi Ilmu Komputer USU</div> </body>

</html>

5. List Program Admin.php

<?php

session_start();

if(empty($_SESSION['user'])or($_SESSION['user']=="")){

echo "<script>alert('anda belum login');window.location.href='index.php'; </script>"; //header("location: http://localhost/robin/");

}

?> <html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>GIS Jalur Terpendek Mall Medan Universitas Sumatera Utara</title> <link type="text/css" href="css/style2.css" rel="stylesheet" />

<script type="text/javascript" src="http://tile.cloudmade.com/wml/latest/web-maps-lite.js"></script>

(17)

<script type="text/javascript" src="js/jquery-ui-1.8.20.custom.min.js"></script>

<script type="text/javascript" src="css/ui-lightness/jquery-ui-1.8.20.custom.css"></script> <link rel="stylesheet" href="js/script/themes/base/jquery.ui.all.css">

<script src="js/script/ui/jquery.ui.core.js"></script> <script src="js/script/ui/jquery.ui.widget.js"></script> <script src="js/script/ui/jquery.ui.datepicker.js"></script> <script src="js/jquery.form.js" type="text/javascript"></script> <script src="js/formQueryBuilder.js" type="text/javascript"></script> <script>

function showAlert(obj,txt,tm){ $(obj).hide();

$(obj).html('<p>'+txt+'</p>');$(obj).show('slow');

setTimeout(function(){ $(obj).hide('slow');$(obj).html('');},tm); }

</script> </head> <body>

<div id="wrap">

<div><?php include("adminkanan.php"); ?></div> <div id="konten">

<?php

$act=$_GET['act'];

(18)

else if ($act==3){include("module/grup/index.php"); } else if ($act==4){include("module/user/index.php"); } else if ($act==5){include("module/akses/index.php"); } else if ($act==6){include("module/peta/index.php"); }

else if ($act==7){include("module/rute/index.php"); } else if ($act==8){include("module/manage/index.php"); } ?>

</div>

<div style="clear:both;"></div>

<div id="foter">User Login:<?php echo $_SESSION['user']; ?> </div> </div>

</body> </html>

6. List Program Simpan_lokasi.php

<?php

include("../../connect.php"); $x = $_REQUEST['x']; $y = $_REQUEST['y'];

$nama = $_REQUEST['nama']; $kategori = $_REQUEST['kategori']; $des = $_REQUEST['des'];

(19)

echo "berhasil"; }else{

echo "gagal"; }

?>

7. List Program Input lokasi.php

<script type="text/javascript">

$(document).ready(function(){

var cloudmade = new CM.Tiles.CloudMade.Web({key: '9c4b0691bd814c389ed0817f1c1d407e'});

var map = new CM.Map('petaku', cloudmade);

var medan=new CM.LatLng(3.5912003919158533, 98.67774286037593); map.setCenter(medan, 14);

CM.Event.addListener(map, 'click', function(latlng) { kasihtanda(latlng);

});

function kasihtanda(lokasi){ $("#x").val(lokasi.lat()); $("#y").val(lokasi.lng());

(20)

function SimpanPeta(){

var kategori=$("#kategori").val(); var x=$("#x").val(); var y=$("#y").val();

var nama=$("#nama").val();

var des=$("#des").val(); var query =

"x="+x+"&y="+y+"&nama="+nama+"&des="+des+"&kategori="+kategori; $.ajax({

type:"post",

url:"module/peta/simpanlokasi.php", data:query,

cache:false,

success: function(msg){

alert("penyimpanan data sukses"); $("#x").val("");

$("#y").val(""); $("#nama").val(""); $("#des").val(""); }

}); }

(21)

#petaku{ width:75%; height:100%;

border:solid 1px silver; float:left;

margin-right:10px;

}

#forminput{ width:18%; height:100%;

border:solid 1px silver; float:left;

padding:5px;

}

</style>

<div>

<h3>Peta</h3>

(22)

<form> Kategori:<br>

<select id="kategori">

<option value="0">- Pilih Kategori -</option> <option value="start_point">Start Point</option> <option value="entry_point">Entry Point</option> </select>

<br>

X : <br><input type=text id=x size=30><br> Y : <br><input type=text id=y size=30><br> Nama:<br>

<input type=text id="nama" size=30><p> Deskripsi:<br>

<textarea cols=22 rows=8 id="des"></textarea><p>

<input type="button" name="submit" value="Simpan Peta" onClick="SimpanPeta()" /> </form>

</div>

</div>

8. List Program Admin Input Rute.php

<?php

include("connect.php");

(23)

?>

<script type="text/javascript">

jQuery(document).ready(function($) { _funcindex();

$("#openform").click(function() { $("#dialog").dialog("open"); $("#RuteSet").hide();

$("#Rute").show();

$("#dialog").dialog({ autoOpen: true, height: 170, width: 350, modal: true});

$("#noRute").attr('disabled',false); $("#noRute").val("");

$("#KodeAwal").val(""); $("#nomor").val(""); $("#proses").val("add"); return false;

});

$("#close").click(function() {

$("#dialog").dialog( "close" ); return false;

(24)

$("#reset").click(function() { _funcindex();

return false; });

});

function _back(){

$("#atas").show();

$("#listrecord").load("module/Rute/get.php?get=listrecord"); }

function _funcindex(){ $("#cari").val(""); $("#pertama").show(); $("#ruteset").hide();

$("#listrecord").load("module/Rute/get.php?get=listrecord"); }

function _funcformsetrute(a,b,c){

$("#dialog").dialog("open"); $("#RuteSet").show();

(25)

$("#proses2").val("add2"); $("#Rute").hide();

$("#dialog").dialog({ autoOpen: true, height: 170, width: 350, modal: true});

} function _funcedit(id){

$("#dialog").dialog("open"); $("#uploadimage").hide();

$("#Rute").show();

$("#dialog").dialog({ autoOpen: true, height: 170, width: 350, modal: true}); $("#noRute").attr('disabled',true); var query="get=editrecord&id="+id; $.ajax({

type:"post",

url:"module/Rute/get.php", data:query,

(26)

success: function(msg){ data=msg.split("|"); $("#noRute").val(data[0]); $("#KodeAwal").val(data[1]); $("#nomor").val(data[2]); $("#proses").val("edit"); }

}); }

function _funcdelete2(id,a,b,c){

var query="act=manage&proses=delete2&idrute2="+id; $.ajax({

type:"post",

url:"module/Rute/act.php", data:query,

cache:false,

success: function(msg){ if(msg=="sukses"){

_funcsetrute(a,b,c); }else{

alert("Delete Gagal"); }

(27)

}); }

function _funcdelete(id){

var query="act=manage&proses=delete&noRute="+id; $.ajax({

type:"post",

url:"module/Rute/act.php", data:query,

cache:false,

success: function(msg){ if(msg=="sukses"){

_funcindex(); }else{

alert("Delete Gagal"); }

}

}); }

function _funcsetrute(id,awal,akhir){ $("#pertama").hide();

$("#ruteset").show(); $('#a').val(id);

(28)

$('#c').val(akhir);

$('#a').attr('disabled',true); $('#b').attr('disabled',true); $('#c').attr('disabled',true);

$("#listrecord2").load("module/Rute/get.php?get=setrute&id="+id); }

function _funcsearch(){ var key=$("#cari").val();

$("#listrecord").load("module/Rute/get.php?get=listrecord&key="+key); }

function PostSearch(){ var key=$("#cari").val();

$("#listrecord").load("module/Rute/get.php?get=listrecord&key="+key); }

function PostRute(){

var query="act=manage&proses="+$('#proses').val()+ "&noRute="+$('#noRute').val()+

"&nomor="+$('#nomor').val()+

"&KodeAwal="+$('#KodeAwal').val(); $.ajax({

type:"post",

url:"module/Rute/act.php", data:query,

cache:false,

(29)

if(msg=="RecordSama"){

showAlert('.frmalert','Kode Rute sudah ada',2000); }else if(msg=="noRute"){

showAlert('.frmalert','Kode Rute tidak boleh kosong',2000);

}else if(msg=="KodeAwal"){

showAlert('.frmalert','Posisi Awal tidak boleh kosong',2000);

}else{

if(msg=="sukses"){

$("#dialog").dialog("close"); _funcindex();

}else{

alert("Penyimpanan Gagal"); }

} }

}); }

function PostSetRute(){

var a=$('#ruteno').val(); var b=$('#posa').val(); var c=$('#posb').val();

var query="act=manage&proses="+$('#proses2').val()+ "&ruteno="+$('#ruteno').val()+

(30)

"&km="+$('#km').val()+ "&rute="+$('#rute').val(); $.ajax({

type:"post",

url:"module/Rute/act.php", data:query,

cache:false,

success: function(msg){ if(msg=="RecordSama"){

showAlert('.frmalert2','Kode Rute sudah ada',2000); }else if(msg=="ruteno"){

showAlert('.frmalert2','No. Rute tidak boleh kosong',2000);

}else if(msg=="jalan"){

showAlert('.frmalert2','Jalan tidak boleh kosong',2000); }else if(msg=="km"){

showAlert('.frmalert2','Km tidak boleh kosong',2000); }else if(msg=="rute"){

showAlert('.frmalert2','Urutan Rute tidak boleh kosong',2000);

}else{

if(msg=="sukses"){

$("#dialog").dialog("close"); _funcsetrute(a,b,c);

}else{

(31)

} }

}

}); }

</script>

<div id="pertama" style="display:none;border:solid 0px silver;width:auto;height:auto;"> <h3>Rute</h3>

<form id="frmRute" onsubmit="_funcsearch(); return false;">

Cari : <input type="text" id="cari" name="cari" size="15" /> &nbsp;<input type="submit" name="submit" value="Cari" /> &nbsp;<button id="openform"> Create New</button>&nbsp; <button id="reset">Reset</button>

</form>

<div id="listrecord"></div> </div>

<div id="ruteset" style="display:none"> <h3>Rute Setting</h3>

<div id="frmalert" class="frmalert" style="background-color:red;color:white;font-weight:bold;text-align:center;padding:0px"></div>

<form id="frmRute" onsubmit="PostRute(); return false;"> <table class="tbl1" width="500" border="0">

<tr><td>Kode Rute</td><td><input type="text" name="a" size="10" id="a"/></td></tr>

(32)

<tr><td>Posisi Akhir</td><td><input type="text" name="c" size="40" id="c"/></td></tr>

<tr>

<td><div style="width:30px"></div>

<input type="hidden" name="proses" id="proses" size="10"/></td> <td>

<input type="button" name="submit" value="Set Rute" onClick="_funcformsetrute(a.value,b.value,c.value)" />

<input type="button" name="submit" value="Kembali" onClick="_funcindex()" /> </td>

</tr> </table>

</form>

<div id="listrecord2"></div> </div>

<div id="dialog" title="Rute Form" style="display:none"> <div id="Rute" style="display:none">

<div id="frmalert" class="frmalert" style="background-color:red;color:white;font-weight:bold;text-align:center;padding:0px"></div>

<form id="frmRute" onsubmit="PostRute(); return false;"> <table width"500" border="0">

<tr>

<td>Kode Rute</td><td><input type="text" name="noRute" size="10" id="noRute" /></td>

(33)

<tr>

<td>Posisi Awal</td><td><?php echo ddownAwal(); ?></td> </tr>

<tr>

<td>Posisi Akhir</td><td><?php echo ddownAkhir(); ?></td> </tr>

<tr>

<td><div style="width:80px"></div>

<input type="hidden" name="proses" id="proses" size="10"/></td> <td>

<input type="submit" id="save" name="save" value="save" /> <button id="close">Close</button>

</td> </tr> </table>

</form> </div>

<div id="RuteSet" style="display:none">

<div id="frmalert2" class="frmalert2" style="background-color:black;color:white;font-weight:bold;text-align:center;padding:0px"></div>

<form id="frmRute" onsubmit="PostSetRute(); return false;"> <table width"500" border="0">

<tr>

(34)

<input type="hidden" name="ruteno" size="5" id="ruteno" /> <input type="hidden" name="posa" size="30" id="posa" /> <input type="hidden" name="posb" size="30" id="posb" /> </td>

</tr> <tr>

<td>Nama Jalan</td><td><input type="text" name="jalan" size="30" id="jalan" /></td> </tr>

<tr>

<td>Jarak Km</td><td><input type="text" name="km" size="5" id="km" /></td> </tr>

<tr>

<td>Rute Ke</td><td><input type="text" name="rute" size="5" id="rute" /></td> </tr>

<tr>

<td><div style="width:80px"></div>

<input type="hidden" name="proses2" id="proses2" size="10"/></td> <td>

<input type="submit" id="save" name="save" value="save" /> <button id="close">Close</button>

</td> </tr> </table>

(35)
(36)

Figur

Memperbarui...

Referensi

Memperbarui...

Related subjects :