Luthfi Rahmandhani - 211110111120004 - LAMPIRAN

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 50

LAMPIRAN-LAMPIRAN

LAMPIRAN :
LEMBAR ASISTENSI
LAMPIRAN :
DAFTAR KOORDINAT SHELTER TRANS SEMARANG
DAFTAR KOORDINAT SHELTER
KORIDOR 1
Mangkang - Penggaron
NO Shelter Lat Long Keteranagan
1 Terminal Mangkang -6,9691800 110,2905000
2 SMK Texmaco -6,9716090 110,2931850
3 Irigasi -6,9731300 110,2972000
4 Pasar Mangkang -6,9730430 110,3042700
5 Universitas Terbuka -6,9725167 110,3088167
6 Sango -6,9758000 110,3219500
7 KIW -6,9758830 110,3257830
8 SMA 8 -6,9782830 110,3324670
9 Karpet -6,9803830 110,3343000
10 KTI -6,9853500 110,3401830
11 Taman Lele -6,9855830 110,3461500
12 Lapangan Tugu -6,9827167 110,3532167
13 Rumah Sakit Tugu -6,9844000 110,3567167
14 PLN -6,9875300 110,3651000
15 Pengadilan -6,9875000 110,3693830
16 Jembawan (Muradi) -6,9860500 110,3772167
17 Kalibanteng (BMKG) -6,9854500 110,3800830
18 SMP Purnama (Cakrawala) -6,9834000 110,3887000
19 Kr Ayu -6,9817300 110,3943300
20 Amarta -6,9810880 110,3974360
21 Sugiopranoto (Ada Swalayan) -6,9822830 110,4047210
22 Pasar Bulu -6,9833040 110,4070630
23 UDINUS -6,98180700 110,41010100 Transit Point
24 Piere Tendean -6,9781530 110,4138350
25 Balaikota -6,9802167 110,4137670 Transit Point
26 Pandanaran 1 -6,9854040 110,4116460
27 Pandanaran 2 -6,9869330 110,4158670
28 Gramedia -6,9889167 110,4206700
29 Simpang Lima -6,9894167 110,4236330 Transit Point
30 RRI -6,9921830 110,4274170
31 Admodirono -6,9937830 110,4305670
32 Milo -6,9956167 110,4354167
33 Lotte Mart (Gajah) -6,9993670 110,4441330
34 Beruang -7,0042000 110,4518330
35 Ada Majapahit -7,0072833 110,4599000
36 BLK -7,0096300 110,4678830
37 SAMSAT -7,0104167 110,4706500
38 Zebra -7,0125540 110,4771680
39 Manunggal Jati -7,0140670 110,4807190
40 Pucang Gading -7,0181830 110,4904670
41 Terminal Penggaron -7,0171670 110,4937670
Penggaron – Mangkang
NO Shelter Lat Long Keteranagan
1 Terminal Penggaron -7,0171670 110,49376700
2 Bitratex -7,0189830 110,49228300
3 Pucang Gading -7,0168670 110,48670000
4 Manunggal Jati -7,0145000 110,48121670
5 Zebra -7,0125300 110,47673000
6 Samsat -7,0106167 110,47061670
7 BLK -7,0097300 110,46780000
8 Ada Swalayan -7,0076710 110,46074800
9 Pasar Gayamsari -7,0029000 110,44945000
10 Kelinci -6,9985500 110,44186700
11 Milo -6,9958830 110,43570000
12 Admodirono -6,9938830 110,43040000
13 SPBU Ahmad Yani -6,9924167 110,42735000
14 Simpang Lima -6,9894167 110,42363300 Transit Point
15 Gramedia -6,9891300 110,42068300
16 Pandanaran -6,9870830 110,41553000
17 Dinas Kesehatan -6,9869000 110,41493000
18 UDINUS -6,98180700 110,41010100 Transit Point
19 Piere Tendean -6,9781530 110,4138350
20 Balaikota -6,9802167 110,41376700 Transit Point
21 Pasar Bulu -6,9837000 110,40730000
22 Ada Siliwangi -6,9826000 110,40498300
23 Amarta (SMP 30) -6,9813167 110,39740000
24 Pasar Kr Ayu -6,9819500 110,39418300
25 Cakrawala (SMP Purnama) -6,9836500 110,38865000
26 Sri Kuncoro -6,9856500 110,38026700
27 Muradi -6,9864830 110,37603000
28 Pengadilan -6,9875167 110,37106700
29 PLN Krapyak -6,9876300 110,36458300
30 RSUD Tugu -6,9844167 110,35638300
31 Lapangan Tugu -6,9828000 110,35273000
32 Taman Lele -6,9859300 110,34510000
33 KTI -6,9859300 110,34130000
34 Karpet -6,9803667 110,33406700
35 SMA 8 -6,9779167 110,33168300
36 KIW -6,9761167 110,32548300
37 Sango -6,9759670 110,32160000
38 Universitas Terbuka -6,9727167 110,30903300
39 Pasar Mangkang -6,9732670 110,30390000
40 Terminal Mangkang -6,9691800 110,2905000

DAFTAR KOOERDINAT SHELTER


KORIDOR II
Terboyo – Sisemut
NO Shelter Lat Long Keteranagan
1 Terminal Terboyo -6,9502990 110,4616920
2 RSI Sultan Agung -6,9565000 110,4602670
3 UNISULA -6,9569000 110,4555830
4 Kampoeng Semarang -6,9586670 110,4460000
5 Sawah Besar -6,9598000 110,4431500
6 Pengapon -6,9613670 110,4398300
7 Raden Patah -6,9623000 110,4391500
8 Pasar Kobong -6,9646167 110,4353300
9 Greja Blenduk -6,9686300 110,4264300
10 STIE BPD Jateng -6,9703000 110,4236830
11 Johar -6,9722167 110,4217500
12 BCA -6,9760000 110,4180830
13 Balaikota -6,9802167 110,4137670 Transit Point
14 Dominico Savio -6,9859167 110,4091000
15 RSUP Kariadi -6,9924167 110,4064500
16 Ngaglik -6,9966330 110,4076167
17 Gajah Mungkur -7,0044330 110,4088167
18 Elisabeth -7,0079167 110,4168670 Transit Point
19 Kagok -7,0117670 110,4162167
20 Akpol -7,0167167 110,4186500
21 Don Bosco -7,0221670 110,4200830
22 Kesatrian Jatingaleh -7,0300300 110,4184500
23 PDAM Jatingaleh -7,0326770 110,4180440
24 Bukit Sari -7,0442300 110,4215500
25 Ngesrep -7,0476755 110,4203439
26 Tembalang -7,0500300 110,4189300
27 Srondol -7,0513000 110,4179300
28 Ruko Setiabudi -7,0602670 110,4141000
29 SPBU Sukun -7,0638000 110,4126700
30 Banyumanik -7,0655167 110,4122830
31 Gedawang -7,0742830 110,4113000
32 Kodam -7,0820670 110,4110000
33 Pudak Payung -7,0939830 110,4098000
34 BPK Jateng -7,0982167 110,4096300
35 Badan Ketahanan Pangan -7,1105300 110,4128500
36 Polres Ungaran -7,1155300 110,4133000
37 SMK Widya Praja -7,1213000 110,4093167
38 Pasar Ungaran -7,1254830 110,4061167
39 Alun-Alun Ungaran -7,1272010 110,4035470
40 Terminal Sisemut Ungaran -7,1201000 110,4039830

Sisemut – Terboyo
NO Shelter Lat Long Keteranagan
1 Terminal Sisemut Ungaran -7,1201000 110,4039830
2 Taman Unyil -7,1093230 110,4123300
3 Dawung -7,1031500 110,4091500
4 BPK -7,0975650 110,4096410
5 Pudak Payung -7,0940440 110,4096250
6 KODAM -7,0825410 110,4106810
7 Terminal Banyumanik -7,0737300 110,4110300
8 Ada Setiabudi -7,0635090 110,4126000
9 TK Setiabudi -7,0599640 110,4140010
10 Srondol -7,0515060 110,4175170
11 Ngesrep -7,0475570 110,4201860
12 Bukit Sari/Gombel -7,0439110 110,4214270
13 Pasar Jatingaleh -7,0319110 110,4178990
14 Kesatrian -7,0288440 110,4182230
15 Don Bosco -7,0225500 110,4200300
16 Akpol -7,0151830 110,4180500
17 Kagok -7,0112167 110,4155000
18 Elisabeth -7,0079167 110,4168670 Transit Point
19 Taman Gajahmungkur -7,0046167 110,4088500
20 Ngaglik -6,9964000 110,4077300
21 RSUP Dr Kariadi -6,9935000 110,4065167
22 RS Wira Bhakti Tama -6,9873500 110,4081670
23 UDINUS -6,9818070 110,4101010 Transit Point
24 Piere Tendean -6,9781530 110,4138350
25 Suzuki Pemuda -6,9755300 110,4181670
26 Johar -6,9716330 110,4221167
27 Layur -6,9684000 110,4220167
28 Stasiun Tawang -6,9654880 110,4269240
29 Pengapon -6,9620830 110,4348300
30 Penjaringan -6,9602000 110,4382830
31 Pasar Kaligawe -6,9592000 110,4440670
32 Kampoeng Semarang -6,9585167 110,4459670
33 UNISULA -6,9566330 110,4556000
34 RSI Sultan Agung -6,9562670 110,4601000
35 Terminal Terboyo -6,9502990 110,4616920

DAFTAR KOORDINAT SHELTER


KORIDOR IIIA

NO Shelter Lat Long Keteranagan


1 Pelabuhan Tanjung Emas 1 -6,94983000 110,42765000
2 Ronggowarsito -6,95782000 110,43074000
3 Pengapon -6,96208300 110,43483000
4 Penjaringan -6,96020000 110,43828300
5 Pengapon -6,96136700 110,43983000
6 Raden Patah -6,96230000 110,43915000
7 Sayangan -6,96461670 110,43533000
8 BRI Patimura -6,96961000 110,43187000
9 RS Pantiwilasa -6,97439000 110,43468000
10 SMK N 1 -6,98094000 110,43511000
11 SMK N 5 -6,98792000 110,43463000
12 Sidodadi -6,99002000 110,43444000
13 Halmahera -6,99315000 110,43414000
14 Kompol Maksum -6,99820000 110,43369000
15 Peterongan -7,00259000 110,43317000
16 Java Mall -7,00727000 110,43228000
17 Singotoro -7,01497000 110,43101000
18 Jangli -7,01752000 110,42742000
19 Kasipah -7,01887000 110,42591000
20 Saint Louis -7,02177000 110,42274000
21 Don Bosco -7,02255000 110,42003000
22 Akpol -7,01518300 110,41805000
23 Kagok -7,01121670 110,41550000
24 Elisabeth -7,00791670 110,41686700 Transit Point
25 Siranda -7,00099000 110,41812000
26 SMA 1 -6,99202300 110,41965000
27 Simpang Lima -6,98941670 110,42363300 Transit Point
28 SMA Kesatrian / Pekunden -6,98687000 110,42247000
29 SMK Theresiana -6,98112000 110,42130000
30 Gumaya -6,97721000 110,42056000
31 BCA -6,97600000 110,41808300
32 Balaikota -6,98021670 110,41376700 Transit Point
33 UDINUS -6,98180700 110,41010100
34 Abimanyu -6,97690000 110,41235000
35 Stasiun Poncol -6,97298000 110,41581000
36 Petek -6,97052000 110,42081000
37 Layur -6,96840000 110,42201670
38 Stasiun Tawang -6,96548800 110,42692400 Transit Point
39 Ronggowarsito -6,95669000 110,43062000
40 Pelabuhan Tanjung Emas 2 -6,94930000 110,42671000

DAFTAR KOORDINAT SHELTER


KORIDOR III B

NO Shelter Lat Long Keteranagan


1 Pelabuhan Tanjung Emas 1 -6,9498300 110,427650
2 Ronggowarsito -6,9578200 110,430740
3 Pengapon -6,9620830 110,434830
4 Penjaringan -6,9602000 110,438283
5 Pengapon -6,9613670 110,439830
6 Raden Patah -6,9623000 110,439150
7 Pasar Kobong -6,9646170 110,435330
8 Greja Blenduk -6,9686300 110,426430
9 STIE BPD Jateng -6,9703000 110,423683
10 Petek -6,9706800 110,420980
11 Stasiun Poncol -6,9730200 110,416080
12 Hotel Bali -6,9768900 110,412430
13 Piere Tendean -6,9781530 110,413835
14 Balaikota -6,9802167 110,413767 Transit Point
15 Pandanaran 1 -6,9854040 110,411646
16 Pandanaran 2 -6,9869330 110,415867
17 Gramedia -6,9889167 110,420670
18 Simpang Lima -6,9894170 110,423633 Transit Point
19 Imam Barjo -6,9939680 110,423367
20 Siranda -7,0011700 110,417800
21 Elisabeth -7,0079170 110,416867 Transit Point
22 Kagok -7,0117670 110,416217
23 Akpol -7,0167170 110,418650
24 Don Bosco -7,0221670 110,420083
25 Saint louis -7,0220600 110,422360
26 Kasipah -7,0198000 110,424630
27 Dokter Wahidin -7,0166900 110,428290
28 Tanah Putih -7,0149000 110,430890
29 Java Mall -7,0076800 110,432150
30 Bangkong -6,9956100 110,431850
31 Stadion Diponegoro -6,9918200 110,431850
32 KP Baris -6,9877700 110,431680
33 Mataram -6,9823300 110,431450
34 Dargo -6,9758300 110,431180
35 Greja Blenduk -6,9686300 110,426430
36 STIE BPD Jateng -6,9703000 110,423683
37 Layur -6,9684000 110,4220167
38 Stasiun Tawang -6,9654880 110,426924 Transit Point
39 Ronggowarsito -6,9566900 110,430620
40 Pelabuhan Tanjung Emas 2 -6,9493000 110,426710
DAFTAR KOORDINAT SHELTER
KORIDOR IV

Terminal Cangkiran – Stasiun Tawang


NO Shelter Lat Long Keterangan
1 Terminal Cangkiran -7,0884150 110,3081050
2 Cangkiran 1 -7,0846900 110,3099400
3 Lapangan Genuk 1 -7,0780100 110,3091000
4 Jatisari -7,0707800 110,3103900
5 Pasar Ace -7,0679400 110,3115100
6 SPBU Mijen -7,0636700 110,3112200
7 SMP N 23 -7,0578300 110,3136300
8 Pasar Mijen -7,0530900 110,3165300
9 Sabhara -7,0508900 110,3187700
10 Beranda Bali -7,0443223 110,3223863
11 Jatibarang -7,0400152 110,3302282
12 SPBU BSB -7,0282700 110,3344400
13 Gang Cermai -7,0205100 110,3366700
14 LP Kedungpane -7,0138500 110,3383000
15 Duwet -7,0107200 110,3376900
16 Pandana Merdeka -7,0040500 110,3390900
17 Permata Medika -7,0002300 110,3412500
18 Bringin -6,9987900 110,3429200
19 Wahyu Asri -6,9980300 110,3449100
20 SMP 16 -6,9948200 110,3489000
21 Ngaliyan Square -6,9925000 110,3518200
22 Aneka Jaya -6,9896700 110,3558800
23 Jrakah -6,9876000 110,3599300
24 PLN -6,9875300 110,3651000
25 Pengadilan -6,9875000 110,3693830
26 Jembawan (Muradi) -6,9860500 110,3772167
27 Kalibanteng (BMKG) -6,9854500 110,3800830
28 Bandara Ahmad Yani -6,9802700 110,3805000
29 SMP Purnama (Cakrawala) -6,9834000 110,3887000
30 Kr Ayu -6,9817300 110,3943300
31 Amarta -6,9810880 110,3974360
32 Sugiopranoto (Ada Swalayan) -6,9822830 110,4047210
33 Pasar Bulu -6,9833040 110,4070630
34 UDINUS -6,9818070 110,41010100 Transit Point
35 Stasiun Poncol -6,9729800 110,4158100
36 Petek -6,9705200 110,4208100
37 Layur -6,9684000 110,4220167
38 Stasiun Tawang -6,9654880 110,4269240 Transit Point

Stasiun Tawang – Terminal Cangkiran


NO Shelter Lat Long Keterangan
1 Stasiun Tawang -6,9654880 110,426924 Transit Point
2 Greja Blenduk -6,9686300 110,426430
3 STIE BPD Jateng -6,9703000 110,423683
4 Petek -6,9706800 110,420980
5 Stasiun Poncol -6,9730200 110,416080
6 Hotel Bali -6,9768900 110,412430
7 Piere Tendean -6,9781530 110,413835
8 Balaikota -6,9802167 110,413767 Transit Point
9 Pasar Bulu -6,9837000 110,407300
10 Ada Siliwangi -6,9826000 110,404983
11 Amarta (SMP 30) -6,9813167 110,397400
12 Pasar Kr Ayu -6,9819500 110,394183
13 Cakrawala (SMP Purnama) -6,9836500 110,388650
14 Bandara Ahmad Yani -6,9802700 110,380500
15 Sri Kuncoro -6,9856500 110,380267
16 Muradi -6,9864830 110,376030
17 Pengadilan -6,9875167 110,371067
18 PLN Krapyak -6,9876300 110,364583
19 Jrakah -6,9878860 110,359774
20 Aneka Jaya -6,9893700 110,356450
21 Ngaliyan Square -6,9926800 110,351810
22 SMP N 16 -6,9949900 110,348900
23 Kecamatan Ngaliyan -6,9966900 110,346900
24 Ngaliyan -6,9984500 110,344440
25 Bringin -6,9990200 110,342590
26 RS Permata Medika -7,0002800 110,341330
27 Pandana -7,0042900 110,339220
28 Duwet -7,0113100 110,337810
29 LP Kedungpane -7,0137900 110,338440
30 Durian -7,0190100 110,337570
31 SPBU BSB -7,0282000 110,334660
32 Jatibarang -7,0413400 110,329810
33 Beranda Bali -7,0465440 110,324285
34 Mijen -7,0509400 110,318820
35 Kelurahan Mijen -7,0527000 110,316760
36 SMP N 23 -7,0581900 110,313490
37 SPBU Mijen -7,0632100 110,311250
38 Pasar Ace -7,0683800 110,311380
39 Jatisari -7,0718100 110,310280
40 Lapangan Genuk -7,0779600 110,309170
41 Cangkiran -7,0862000 110,309720
42 Terminal Cangkiran -7,0884150 110,308105

DAFTAR KOORDINAT SHELTER


KORIDOR V
Meteseh – PRPP
NO Shelter Lat Long Keteranagan
1 Perumahan Dinar Mas -7,0626110 110,4621100
2 Dinar Mas -7,0628630 110,4649720
3 Dinar Elok -7,0601450 110,4697503
4 Meteseh -7,0561201 110,4714116
5 Elang Raya -7,0480880 110,4702221
6 SLB -7,0425550 110,4669570
7 Klipang -7,0397726 110,4680644
8 RSUD Ketileng -7,0330505 110,4674596
9 SMP N 15 -7,0229734 110,4635201
10 UNWAHAS -7,0232940 110,4624090
11 Kedungmundu -7,0513451 110,4533190
12 Mrican -7,0110130 110,4425180
13 Java Mall -7,0076800 110,4321500
14 Sriwijaya -7,0048656 110,4314604
15 Wonderia -7,0016915 110,4244440
16 SMA 1 -6,9920230 110,4196500
17 Simpang Lima -6,9894167 110,4236330 Transit Point
18 SMA Kesatrian / Pekunden -6,9868700 110,4224700
19 SMK Theresiana -6,9811200 110,4213000
20 Gumaya -6,9772100 110,4205600
21 BCA -6,9760000 110,4180830
22 Balaikota -6,9802167 110,4137670 Transit Point
23 Dominico Savio -6,9859167 110,4091000
24 RSUP Kariadi -6,9924167 110,4064500
25 SPBU Kaligarang -6,9960560 110,4048880
26 Sam Poo Kong -6,9940050 110,3984830
27 SMA Kesatrian Pamularsih -6,9874500 110,3867320
28 SMP Purnama (Cakrawala) -6,9834000 110,3887000
29 Anjasmoro -6,9803160 110,3911220
30 Puri Anjasmoro -6,9747740 110,3905090
31 Stikes Telogorejo -6,9717920 110,3904340
32 Baby Face -6,9684158 110,3904307
33 PRPP -6,9623184 110,3901789

PRPP – Meteseh
NO Shelter Lat Long Keteranagan
1 PRPP -6,96231840 110,3901789
2 Bundaran Anjasmoro -6,96766160 110,3909492
3 Stikes Telogorejo -6,97166500 110,3906290
4 Puri Anjasmoro -6,97482900 110,3906550
5 Kenconowungu -6,98015040 110,3911963
6 Kr Ayu -6,98173000 110,3943300
7 Amarta -6,98108800 110,3974360
8 Amarta (SMP 30) -6,98131670 110,3974000
9 Pasar Kr Ayu -6,98195000 110,3941830
10 Cakrawala (SMP Purnama) -6,98365000 110,3886500
11 SMA Kesatrian Pamularsih -6,98690200 110,3858760
12 Sam Poo Kong -6,99427370 110,3986011
13 Kaligarang -6,99543000 110,4055040
14 RSUP Dr Kariadi -6,99350000 110,4065167
15 RS Wira Bhakti Tama -6,98735000 110,4081670
16 UDINUS -6,98180700 110,4101010 Transit Point
17 Piere Tendean -6,97815300 110,4138350
18 Thamrin -6,97875530 110,4169804
19 Gramedia -6,98891670 110,4206700
20 Simpang Lima -6,98941670 110,4236330 Transit Point
21 Imam Barjo -6,99396800 110,4233670
22 Taman Singosari -7,00011797 110,4241687
23 Java Mall -7,00727000 110,4322800
24 Mrican -7,01093390 110,4427242
25 PDAM Kedungmundu -7,01628530 110,4542575
26 UNWAHAS -7,02274570 110,4632807
27 Super Indo Kedungmundu -7,02460920 110,4667675
28 RSUD Ketileng -7,03289350 110,4675508
29 Klipang -7,03979500 110,4681687
30 SLB -7,04248660 110,4671586
31 Elang Raya -7,04837100 110,4705130
32 Pasar Meteseh -7,05696900 110,4712140
33 Dinar Elok -7,06023800 110,4696740
34 Dinar Mas -7,06292200 110,4644180
35 Perumahan Dinar Mas -7,06261100 110,4621100

DAFTAR KOORDINAT SHELTER


KORIDOR VI

UNDIP – UNNES
NO Shelter Lat Long Keteranagan
1 Rusunawa UNDIP -7,0542500 110,4448110
2 Polines -7,0549470 110,4347920
3 Kec Banyumanik -7,0526630 110,4285410
4 ngesrep -7,0503170 110,4231630
5 Ngesrep -7,0475570 110,4201860
6 Bukit Sari/Gombel -7,0439110 110,4214270
7 Pasar Jatingaleh -7,0319110 110,4178990
8 Kesatrian -7,0288440 110,4182230
9 Saint louis -7,0220600 110,4223600
10 Kasipah -7,0198000 110,4246300
11 Dokter Wahidin -7,0166900 110,4282900
12 Sisingamangaraja -7,0160150 110,4252470
13 Akpol -7,0151830 110,4180500
14 Kagok -7,0112167 110,4155000
15 Elisabeth -7,0079167 110,4168670 Transit Point
16 Kagok -7,0117670 110,4162167
17 semeru raya -7,0205000 110,4192540
19 Telaga Bodas Raya -7,0253800 110,4116800
20 UNIKA -7,0268480 110,4055837
21 UNTAG -7,0212443 110,3978348
22 AKPELNI -7,0190880 110,3949916
23 Dewi Sartika Raya -7,0213884 110,3888768
24 Sekaran -7,0310534 110,3893635
25 Trangkil -7,0342053 110,3912378
26 Akbid Abdi Husada -7,0393155 110,3913493
27 Kampus UNNES 1 -7,0488260 110,3955189
28 Kampus UNNES 2 -7,0490030 110,3954311
29 Pool UNNES -7,0480760 110,3895850

UNNES – UNDIP
NO Shelter Lat Long Keteranagan
1 Pool UNNES -7,0480760 110,3895850
2 Banaran -7,0480760 110,3895850
3 Akbid Abdi Husada -7,0392649 110,3912434
4 Trangkil -7,0345067 110,3911453
5 Sekaran Raya -7,0310792 110,3892575
6 Dewi Sartika Raya -7,0214290 110,3887380
7 AKPELNI -7,0190090 110,3950650
8 UNTAG -7,0209930 110,3976370
9 UNIKA -7,0270850 110,4057810
10 Telaga Bodas -7,0253410 110,4115600
12 Semeru Raya -7,0204820 110,4189730
13 Akpol -7,0151830 110,4180500
14 Kagok -7,0112167 110,4155000
15 Elisabeth -7,0079167 110,4168670 Transit Point
16 Kagok -7,0117670 110,4162167
17 Sisingamangaraja -7,0158400 110,4258470
18 Jangli -7,0175200 110,4274200
19 Kasipah -7,0188700 110,4259100
20 Saint Louis -7,0217700 110,4227400
21 Kesatrian Jatingaleh -7,0300300 110,4184500
22 PDAM Jatingaleh -7,0326770 110,4180440
23 Bukit Sari -7,0442300 110,4215500
24 Ngesrep -7,0479100 110,4201700
25 Kelurahan Sumurboto -7,0512760 110,4256630
26 GSG -7,0522440 110,4326980
27 FEB UNDIP -7,0459970 110,4416620
28 RSND -7,0472080 110,4445490
29 Fakultas Illmu Keperawatan -7,0507211 110,4443552
30 Fakultas Peternakan -7,0537680 110,4399120
31 Rusunawa UNDIP -7,0542500 110,4448110
LAMPIRAN :
SCRIPT APLIKASI

Tampilan menu utama aplikasi


package net.gulojowo.transsemarang;

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.FragmentTransaction;
import android.content.pm.PackageManager;
import android.location.Location;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;

import net.gulojowo.DataAdapter.HomePageAdapter;
import net.gulojowo.DataAdapter.TransData;
import net.gulojowo.DataModel.HomePageDataModel;
import net.gulojowo.config.TransConfig;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.widget.DrawerLayout;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

//class yang pertama kali dieksekusi ketika aplikasi berjalan


public class TransHomePage extends AppCompatActivity implements
GoogleApiClient.OnConnectionFailedListener,
GoogleApiClient.ConnectionCallbacks, LocationListener {

private String[] mNavigationDrawerItemTitles;


private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
Toolbar toolbar;
private CharSequence mDrawerTitle;
private CharSequence mTitle;
android.support.v7.app.ActionBarDrawerToggle mDrawerToggle;
private final String _MENU1 = "Sebaran Shelter";
private final String _MENU2 = "Shelter Terdekat";
private final String _MENU3 = "Tacking Shelter";
private final String _MENU4 = "Info Rute";
public TransData transData = new TransData();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.trans_homepage);
mTitle = mDrawerTitle = getTitle();
mNavigationDrawerItemTitles =
getResources().getStringArray(R.array.navigation_drawer_items_array);
mDrawerLayout = (DrawerLayout)
findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);

setupToolbar();

HomePageDataModel[] drawerItem = new HomePageDataModel[3];

drawerItem[0] = new HomePageDataModel(R.drawable.mypos,


_MENU1);
drawerItem[1] = new HomePageDataModel(R.drawable.shelter,
_MENU2);
drawerItem[2] = new HomePageDataModel(R.drawable.transit,
_MENU3);
drawerItem[3] = new HomePageDataModel(R.drawable.mypos,
_MENU4);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setHomeButtonEnabled(true);

HomePageAdapter adapter = new HomePageAdapter(this,


R.layout.trans_item_row, drawerItem);
mDrawerList.setAdapter(adapter);
mDrawerList.setOnItemClickListener(new
DrawerItemClickListener());
mDrawerLayout = (DrawerLayout)
findViewById(R.id.drawer_layout);
mDrawerLayout.setDrawerListener(mDrawerToggle);
setupDrawerToggle();
buildGoogleApiClient();
updateValuesFromBundle(savedInstanceState);

@Override
public void onLocationChanged(Location location) {

protected synchronized void buildGoogleApiClient() {


Log.i(TransConfig.TAG, "Permission check ...");
if (ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{
android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
}, 1);
}

Log.i(TransConfig.TAG, "Building GoogleApiClient");


transData.mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
createLocationRequest();
}

@SuppressLint("RestrictedApi")
protected void createLocationRequest() {
Log.i(TransConfig.TAG, "Create Location Request");
transData.mLocationRequest = new LocationRequest();

transData.mLocationRequest.setInterval(TransConfig.UPDATE_INTERVAL_IN_
MILLISECONDS);

transData.mLocationRequest.setFastestInterval(TransConfig.FASTEST_UPDA
TE_INTERVAL_IN_MILLISECONDS);

transData.mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_A
CCURACY);
}

private void updateValuesFromBundle(Bundle savedInstanceState) {


if (savedInstanceState != null) {
if
(savedInstanceState.keySet().contains(TransConfig.REQUESTING_LOCATION_
UPDATES_KEY)) {
TransConfig.mRequestingLocationUpdates =
savedInstanceState.getBoolean(
TransConfig.REQUESTING_LOCATION_UPDATES_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LOCATION_KEY)) {
transData.mCurrentLocation =
savedInstanceState.getParcelable(TransConfig.LOCATION_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LAST_UPDATED_TIME_ST
RING_KEY)) {
TransConfig.mLastUpdateTime =
savedInstanceState.getString(
TransConfig.LAST_UPDATED_TIME_STRING_KEY);
}
}
}

protected void stopLocationUpdates() {


LocationServices.FusedLocationApi.removeLocationUpdates(
transData.mGoogleApiClient, this);
}

protected void startLocationUpdates() {


Log.i(TransConfig.TAG, "Start location update");
if (ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
}, 1);
}

LocationServices.FusedLocationApi.requestLocationUpdates(transData.mGo
ogleApiClient, transData.mLocationRequest, this);

LatLng yourPos = transData.getCurrentPosition();//new


LatLng(transData.mCurrentLocation.getLatitude(),
transData.mCurrentLocation.getLongitude());
selectItem(0);
}

@Override
public void onConnected(@Nullable Bundle bundle) {
Log.i(TransConfig.TAG, "Connected to GoogleApiClient");
if (transData.mCurrentLocation == null) {
if (ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
}, 1);
}
transData.mCurrentLocation =
LocationServices.FusedLocationApi.getLastLocation(transData.mGoogleApi
Client);

Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Latitude " +
transData.mCurrentLocation.getLatitude());
Log.i(TransConfig.TAG, "Longiude " +
transData.mCurrentLocation.getLongitude());
Log.i(TransConfig.TAG,
"==================================================================");

startLocationUpdates();
}
}

@Override
public void onConnectionSuspended(int i) {
Log.i(TransConfig.TAG, "Connection suspended");
transData.mGoogleApiClient.connect();
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult
connectionResult) {
Log.i(TransConfig.TAG, "Connection failed:
ConnectionResult.getErrorCode() = " +
connectionResult.getErrorCode());
}

private class DrawerItemClickListener implements


ListView.OnItemClickListener {

@Override
public void onItemClick(AdapterView<?> parent, View view, int
position, long id) {
selectItem(position);
}

private void selectItem(int position) {

Fragment fragment = null;

switch (position) {
case 0:
fragment = new MappingShelter();

break;
case 1:
fragment = new NearestShelter();
break;
case 2:
fragment = new ShelterNavigation();
break;
case 3:
fragment = new ShelterRouteInfo();
break;
default:
break;
}

if (fragment != null) {
Bundle bundl = new Bundle();
bundl.putDouble("dt_lat",
transData.getCurrentPosition().latitude);
bundl.putDouble("dt_lon",
transData.getCurrentPosition().longitude);
fragment.setArguments(bundl);

Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Send lat " +
bundl.getDouble("dt_lat"));
Log.i(TransConfig.TAG, "Send lon " +
bundl.getDouble("dt_lon"));
Log.i(TransConfig.TAG,
"==================================================================");

FragmentManager fragmentManager =
getSupportFragmentManager();

fragmentManager.beginTransaction().replace(R.id.content_frame,
fragment).commit();

mDrawerList.setItemChecked(position, true);
mDrawerList.setSelection(position);
setTitle(mNavigationDrawerItemTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);

} else {
Log.e("MainActivity", "Error in creating fragment");
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}

return super.onOptionsItemSelected(item);
}

@Override
public void setTitle(CharSequence title) {
mTitle = title;
getSupportActionBar().setTitle(mTitle);
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}

@Override
protected void onStart() {
super.onStart();
transData.mGoogleApiClient.connect();
}

@Override
protected void onStop() {
transData.mGoogleApiClient.disconnect();

super.onStop();
}

@Override
protected void onPause() {
super.onPause();
if (transData.mGoogleApiClient.isConnected()) {
stopLocationUpdates();
}
}

@Override
public void onResume() {
super.onResume();
if (transData.mGoogleApiClient.isConnected() && !
TransConfig.mRequestingLocationUpdates) {
startLocationUpdates();
}
}

void setupToolbar() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}

void setupDrawerToggle() {
mDrawerToggle = new
android.support.v7.app.ActionBarDrawerToggle(this, mDrawerLayout,
toolbar, R.string.app_name, R.string.app_name);
//This is necessary to change the icon of the Drawer Toggle
upon state change.
mDrawerToggle.syncState();
}

void initShelterMapping() {
}
Shelter terdekat
package net.gulojowo.transsemarang;

import android.Manifest;
import android.annotation.SuppressLint;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

import net.gulojowo.DataAdapter.AdapterKoridor;
import net.gulojowo.DataAdapter.ShelterAdapter;
import net.gulojowo.DataAdapter.TransData;
import net.gulojowo.DataSource.DataNearestShelter;
import net.gulojowo.DataSource.DataShelter;
import net.gulojowo.DataSource.KoridorDataObject;
import net.gulojowo.DataSource.ShelterDataObject;
import net.gulojowo.config.TransConfig;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class NearestShelter extends Fragment implements


OnMapReadyCallback,
GoogleMap.OnMarkerClickListener,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener {

private GoogleMap mMap;


public TransData transData = new TransData();
private boolean mapReady = false;
private boolean shelterRendered = false;
public static int markCurrent = R.drawable.mypos;
public static int markShelter = R.drawable.shelter;
public static int markTransit = R.drawable.transit;
private Double sourceLat;
private Double sourceLon;
public Map<String, Marker> shellMark = new HashMap<String,
Marker>();
public RecyclerView mRecyclerView;
public RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
public Map<Integer, Map> markContainer = new HashMap<Integer,
Map>();
public ArrayList nearestShelters = new
ArrayList<ShelterDataObject>();

public NearestShelter() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup
container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Received lat " +
getArguments().getDouble("dt_lat"));
Log.i(TransConfig.TAG, "Received lon " +
getArguments().getDouble("dt_lon"));
Log.i(TransConfig.TAG,
"==================================================================");

this.sourceLat = getArguments().getDouble("dt_lat");
this.sourceLon = getArguments().getDouble("dt_lon");
}
View rootView =
inflater.inflate(R.layout.trans_nearest_shelter, container, false);
SupportMapFragment mapFragment =
(SupportMapFragment)

getChildFragmentManager().findFragmentById(R.id.nearest_map_shelter);
mapFragment.getMapAsync(this);
updateValuesFromBundle(savedInstanceState);

mRecyclerView = rootView.findViewById(R.id.shelter_info);
mRecyclerView.setHasFixedSize(true);
mLayoutManager = new LinearLayoutManager(this.getContext());
mRecyclerView.setLayoutManager(mLayoutManager);

mAdapter = new ShelterAdapter(getNearestDataset(), mMap);


mRecyclerView.setAdapter(mAdapter);
initSelectNearest();
return rootView;
}

@Override
public void onConnected(@Nullable Bundle bundle) {
Log.i(TransConfig.TAG, "Connected to GoogleApiClient");
if(transData.mCurrentLocation == null) {
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {

ActivityCompat.requestPermissions(this.getActivity(),new String[]{

android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
}, 1);
}
transData.mCurrentLocation =
LocationServices.FusedLocationApi.getLastLocation(transData.mGoogleApi
Client);

Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Latitude
"+transData.mCurrentLocation.getLatitude());
Log.i(TransConfig.TAG, "Longiude
"+transData.mCurrentLocation.getLongitude());
Log.i(TransConfig.TAG,
"==================================================================");

startLocationUpdates();
}
}

@Override
public void onConnectionSuspended(int i) {
Log.i(TransConfig.TAG, "Connection suspended");
transData.mGoogleApiClient.connect();
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult
connectionResult) {
Log.i(TransConfig.TAG, "Connection failed:
ConnectionResult.getErrorCode() = " +
connectionResult.getErrorCode());
}

@Override
public void onLocationChanged(Location location) {

@Override
public boolean onMarkerClick(Marker marker) {
return false;
}

@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mapReady = true;
buildGoogleApiClient();
Log.i(TransConfig.TAG, "Map is ready !");
if(this.sourceLat != null && this.sourceLon != null){
// Log.i(TransConfig.TAG, "Map and location service is
ready !");
LatLng yourPos = new LatLng(this.sourceLat,
this.sourceLon);
mMap.addMarker(new
MarkerOptions().position(yourPos).title("Posisi saya"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(yourPos,
15));
mMap.setOnMarkerClickListener(this);
renderShelterMapping();
}
}

@SuppressLint("RestrictedApi")
protected void createLocationRequest() {
Log.i(TransConfig.TAG, "Create Location Request");
transData.mLocationRequest = new LocationRequest();

transData.mLocationRequest.setInterval(TransConfig.UPDATE_INTERVAL_IN_
MILLISECONDS);
transData.mLocationRequest.setFastestInterval(TransConfig.FASTEST_UPDA
TE_INTERVAL_IN_MILLISECONDS);

transData.mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_A
CCURACY);
}

private ArrayList<ShelterDataObject> getNearestDataset() {


ArrayList results = new ArrayList<ShelterDataObject>();
return results;
}

private void initSelectNearest(){


Log.i(TransConfig.TAG, "Reload top 10 nearest shelter ..");
DataNearestShelter nearest = new DataNearestShelter(this);
nearest.getNearestShelter();
}

private void updateValuesFromBundle(Bundle savedInstanceState) {


if (savedInstanceState != null) {
if
(savedInstanceState.keySet().contains(TransConfig.REQUESTING_LOCATION_
UPDATES_KEY)) {
TransConfig.mRequestingLocationUpdates =
savedInstanceState.getBoolean(
TransConfig.REQUESTING_LOCATION_UPDATES_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LOCATION_KEY)) {
transData.mCurrentLocation =
savedInstanceState.getParcelable(TransConfig.LOCATION_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LAST_UPDATED_TIME_ST
RING_KEY)) {
TransConfig.mLastUpdateTime =
savedInstanceState.getString(
TransConfig.LAST_UPDATED_TIME_STRING_KEY);
}
}
}

protected void startLocationUpdates() {


Log.i(TransConfig.TAG, "Start location update");
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this.getActivity(),new
String[]{

Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_CO
ARSE_LOCATION
}, 1);
}

LocationServices.FusedLocationApi.requestLocationUpdates(transData.mGo
ogleApiClient, transData.mLocationRequest, this);
if(mapReady) {
LatLng yourPos = transData.getCurrentPosition();//new
LatLng(transData.mCurrentLocation.getLatitude(),
transData.mCurrentLocation.getLongitude());
mMap.addMarker(new
MarkerOptions().position(yourPos).title("Your position"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(yourPos,
15));
mMap.setOnMarkerClickListener(this);
}
}

protected synchronized void buildGoogleApiClient() {


Log.i(TransConfig.TAG, "Permission check ...");
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this.getActivity(),new
String[]{
android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
}, 1);
}

Log.i(TransConfig.TAG, "Building GoogleApiClient");


transData.mGoogleApiClient = new
GoogleApiClient.Builder(this.getContext())
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
createLocationRequest();
}

public GoogleMap getmMap() {


return mMap;
}

void renderShelterMapping(){
DataShelter shelter = new DataShelter(this);
shelter.getAllShelter(2);
shelterRendered = true;
}

public Double getSourceLat() {


return sourceLat;
}

public Double getSourceLon() {


return sourceLon;
}
}
Posisi user
package net.gulojowo.transsemarang;

import android.Manifest;
import android.annotation.SuppressLint;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

import net.gulojowo.DataAdapter.ShelterAdapter;
import net.gulojowo.DataAdapter.TransData;
import net.gulojowo.DataSource.DataNearestTracking;
import net.gulojowo.DataSource.KoridorDataObject;
import net.gulojowo.DataSource.ShelterDataObject;
import net.gulojowo.config.TransConfig;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class ShelterNavigation extends Fragment implements


OnMapReadyCallback,
GoogleMap.OnMarkerClickListener,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener {

private GoogleMap mMap;


public TransData transData = new TransData();
private boolean mapReady = false;
private boolean shelterRendered = false;
public static int markCurrent = R.drawable.mypos;
public static int markShelter = R.drawable.shelter;
public static int markTransit = R.drawable.transit;
private Double sourceLat;
private Double sourceLon;

public Map<String, Marker> shellMark = new HashMap<String,


Marker>();
public Map<Integer, LatLng> shellPos = new HashMap<Integer,
LatLng>();
public RecyclerView mRecyclerView;
public RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
public ArrayList nearestShelters = new
ArrayList<ShelterDataObject>();

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup
container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Received lat " +
getArguments().getDouble("dt_lat"));
Log.i(TransConfig.TAG, "Received lon " +
getArguments().getDouble("dt_lon"));
Log.i(TransConfig.TAG,
"==================================================================");

this.sourceLat = getArguments().getDouble("dt_lat");
this.sourceLon = getArguments().getDouble("dt_lon");
}
View rootView =
inflater.inflate(R.layout.trans_shelter_tracking, container, false);
SupportMapFragment mapFragment =
(SupportMapFragment)

getChildFragmentManager().findFragmentById(R.id.nearest_map_shelter);
mapFragment.getMapAsync(this);
updateValuesFromBundle(savedInstanceState);

mRecyclerView = rootView.findViewById(R.id.shelter_info);
mRecyclerView.setHasFixedSize(true);
mLayoutManager = new LinearLayoutManager(this.getContext());
mRecyclerView.setLayoutManager(mLayoutManager);

mAdapter = new ShelterAdapter(getNearestDataset(), mMap);


mRecyclerView.setAdapter(mAdapter);
initSelectNearest();
return rootView;
}

@Override
public void onConnected(@Nullable Bundle bundle) {
Log.i(TransConfig.TAG, "Connected to GoogleApiClient");
if(transData.mCurrentLocation == null) {
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {

ActivityCompat.requestPermissions(this.getActivity(),new String[]{

android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
}, 1);
}
transData.mCurrentLocation =
LocationServices.FusedLocationApi.getLastLocation(transData.mGoogleApi
Client);

Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Latitude
"+transData.mCurrentLocation.getLatitude());
Log.i(TransConfig.TAG, "Longiude
"+transData.mCurrentLocation.getLongitude());
Log.i(TransConfig.TAG,
"==================================================================");

startLocationUpdates();
}
}

@Override
public void onConnectionSuspended(int i) {
Log.i(TransConfig.TAG, "Connection suspended");
transData.mGoogleApiClient.connect();
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult
connectionResult) {
Log.i(TransConfig.TAG, "Connection failed:
ConnectionResult.getErrorCode() = " +
connectionResult.getErrorCode());
}

@Override
public void onLocationChanged(Location location) {
transData.mCurrentLocation = location;//ambil posisi lat long
hp terakhir
TransConfig.mLastUpdateTime =
DateFormat.getTimeInstance().format(new Date());
Log.d("Loc_update", "updated");
// reloadPosition();
}

@Override
public boolean onMarkerClick(Marker marker) {
return false;
}

@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
buildGoogleApiClient();
mapReady = true;
Log.i(TransConfig.TAG, "Map is ready !");
if(this.sourceLat != null && this.sourceLon != null){
Log.i(TransConfig.TAG, "Map and location service is
ready !");
LatLng yourPos = new LatLng(this.sourceLat,
this.sourceLon);
mMap.addMarker(new
MarkerOptions().position(yourPos).title("Posisi saya"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(yourPos,
15));
mMap.setOnMarkerClickListener(this);

renderShelterNavigation();
}
}

@SuppressLint("RestrictedApi")
protected void createLocationRequest() {
Log.i(TransConfig.TAG, "Create Location Request");
transData.mLocationRequest = new LocationRequest();
transData.mLocationRequest.setInterval(TransConfig.UPDATE_INTERVAL_IN_
MILLISECONDS);

transData.mLocationRequest.setFastestInterval(TransConfig.FASTEST_UPDA
TE_INTERVAL_IN_MILLISECONDS);

transData.mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_A
CCURACY);
}

private void renderShelterNavigation(){

protected synchronized void buildGoogleApiClient() {


Log.i(TransConfig.TAG, "Permission check ...");
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this.getActivity(),new
String[]{
android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
}, 1);
}

Log.i(TransConfig.TAG, "Building GoogleApiClient");


transData.mGoogleApiClient = new
GoogleApiClient.Builder(this.getContext())
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
createLocationRequest();
}

private void updateValuesFromBundle(Bundle savedInstanceState) {


if (savedInstanceState != null) {
if
(savedInstanceState.keySet().contains(TransConfig.REQUESTING_LOCATION_
UPDATES_KEY)) {
TransConfig.mRequestingLocationUpdates =
savedInstanceState.getBoolean(
TransConfig.REQUESTING_LOCATION_UPDATES_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LOCATION_KEY)) {
transData.mCurrentLocation =
savedInstanceState.getParcelable(TransConfig.LOCATION_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LAST_UPDATED_TIME_ST
RING_KEY)) {
TransConfig.mLastUpdateTime =
savedInstanceState.getString(
TransConfig.LAST_UPDATED_TIME_STRING_KEY);
}
}
}

private ArrayList<ShelterDataObject> getNearestDataset() {


ArrayList results = new ArrayList<ShelterDataObject>();
return results;
}

private void initSelectNearest(){


Log.i(TransConfig.TAG, "Reload top 10 nearest shelter ..");
DataNearestTracking nearest = new DataNearestTracking(this);
nearest.getNearestShelter();
}

protected void startLocationUpdates() {


Log.i(TransConfig.TAG, "Start location update");
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this.getActivity(),new
String[]{

Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_CO
ARSE_LOCATION
}, 1);
}

LocationServices.FusedLocationApi.requestLocationUpdates(transData.mGo
ogleApiClient, transData.mLocationRequest, this);
if(mapReady) {

LatLng yourPos = transData.getCurrentPosition();//new


LatLng(transData.mCurrentLocation.getLatitude(),
transData.mCurrentLocation.getLongitude());
mMap.addMarker(new
MarkerOptions().position(yourPos).title("Your position"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(yourPos,
15));
mMap.setOnMarkerClickListener(this);
}
}

public GoogleMap getmMap() {


return mMap;
}

public Double getSourceLat() {


return sourceLat;
}

public Double getSourceLon() {


return sourceLon;
}
}
Sebaran shelter
package net.gulojowo.transsemarang;

import android.Manifest;
import android.annotation.SuppressLint;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

import net.gulojowo.DataAdapter.AdapterKoridor;
import net.gulojowo.DataAdapter.ShelterAdapter;
import net.gulojowo.DataAdapter.TransData;
import net.gulojowo.DataSource.DataKoridor;
import net.gulojowo.DataSource.DataNearestShelter;
import net.gulojowo.DataSource.DataShelter;
import net.gulojowo.DataSource.KoridorDataObject;
import net.gulojowo.DataSource.ShelterDataObject;
import net.gulojowo.config.TransConfig;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class MappingShelter extends Fragment implements


OnMapReadyCallback,
GoogleMap.OnMarkerClickListener,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener {

private GoogleMap mMap;


public TransData transData = new TransData();
private boolean mapReady = false;
private boolean shelterRendered = false;
public static int markCurrent = R.drawable.mypos;
public static int markShelter = R.drawable.shelter;
public static int markTransit = R.drawable.transit;
private Double sourceLat;
private Double sourceLon;

public RecyclerView mRecyclerView;


public RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
public Map<String, Marker> shellMark = new HashMap<String,
Marker>();
public Map<Integer, Map> markContainer = new HashMap<Integer,
Map>();
public ArrayList objKoridor = new ArrayList<KoridorDataObject>();

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup
container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Received lat " +
getArguments().getDouble("dt_lat"));
Log.i(TransConfig.TAG, "Received lon " +
getArguments().getDouble("dt_lon"));
Log.i(TransConfig.TAG,
"==================================================================");

this.sourceLat = getArguments().getDouble("dt_lat");
this.sourceLon = getArguments().getDouble("dt_lon");
}
View rootView =
inflater.inflate(R.layout.trans_shelter_mapping, container, false);
SupportMapFragment mapFragment =
(SupportMapFragment)

getChildFragmentManager().findFragmentById(R.id.mapping_shelter);
mapFragment.getMapAsync(this);
updateValuesFromBundle(savedInstanceState);

mRecyclerView = rootView.findViewById(R.id.select_koridor);
mRecyclerView.setHasFixedSize(true);
mLayoutManager = new LinearLayoutManager(this.getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
mAdapter = new AdapterKoridor(getKoridorDataset(), mMap, new
LatLng(sourceLat, sourceLon));
mRecyclerView.setAdapter(mAdapter);
initSelectKoridor();
return rootView;
}

@Override
public void onConnected(@Nullable Bundle bundle) {
Log.i(TransConfig.TAG, "Connected to GoogleApiClient");
if(transData.mCurrentLocation == null) {
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {

ActivityCompat.requestPermissions(this.getActivity(),new String[]{

Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_CO
ARSE_LOCATION
}, 1);
}
transData.mCurrentLocation =
LocationServices.FusedLocationApi.getLastLocation(transData.mGoogleApi
Client);

Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Latitude
"+transData.mCurrentLocation.getLatitude());
Log.i(TransConfig.TAG, "Longiude
"+transData.mCurrentLocation.getLongitude());
Log.i(TransConfig.TAG,
"==================================================================");

startLocationUpdates();
}
}

@Override
public void onConnectionSuspended(int i) {
Log.i(TransConfig.TAG, "Connection suspended");
transData.mGoogleApiClient.connect();
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult
connectionResult) {
Log.i(TransConfig.TAG, "Connection failed:
ConnectionResult.getErrorCode() = " +
connectionResult.getErrorCode());
}

@Override
public void onLocationChanged(Location location) {
transData.mCurrentLocation = location;//ambil posisi lat long
hp terakhir
TransConfig.mLastUpdateTime =
DateFormat.getTimeInstance().format(new Date());
Log.d("Loc_update", "updated");
// reloadPosition();
}

@Override
public boolean onMarkerClick(Marker marker) {
return false;
}

@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
buildGoogleApiClient();
if(this.sourceLat != null && this.sourceLon != null){
Log.i(TransConfig.TAG, "Map and location service is
ready !");
LatLng yourPos = new LatLng(this.sourceLat,
this.sourceLon);
mMap.addMarker(new
MarkerOptions().position(yourPos).title("Posisi saya"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(yourPos,
15));
mMap.setOnMarkerClickListener(this);

renderShelterMapping();
}
}

@Override
public void onResume() {
super.onResume();
try {
if (transData.mGoogleApiClient.isConnected() && !
TransConfig.mRequestingLocationUpdates) {
startLocationUpdates();
}
}catch(Exception e){

}
}

protected synchronized void buildGoogleApiClient() {


Log.i(TransConfig.TAG, "Permission check ...");
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this.getActivity(),new
String[]{
android.Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION
}, 1);
}

Log.i(TransConfig.TAG, "Building GoogleApiClient");


transData.mGoogleApiClient = new
GoogleApiClient.Builder(this.getContext())
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
createLocationRequest();
}

private void initSelectKoridor(){


Log.i(TransConfig.TAG, "Reload list koridor ..");
DataKoridor koridor = new DataKoridor(this);
koridor.getAllKoridor();
}

@SuppressLint("RestrictedApi")
protected void createLocationRequest() {
Log.i(TransConfig.TAG, "Create Location Request");
transData.mLocationRequest = new LocationRequest();

transData.mLocationRequest.setInterval(TransConfig.UPDATE_INTERVAL_IN_
MILLISECONDS);

transData.mLocationRequest.setFastestInterval(TransConfig.FASTEST_UPDA
TE_INTERVAL_IN_MILLISECONDS);

transData.mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_A
CCURACY);
}

private void updateValuesFromBundle(Bundle savedInstanceState) {


if (savedInstanceState != null) {
if
(savedInstanceState.keySet().contains(TransConfig.REQUESTING_LOCATION_
UPDATES_KEY)) {
TransConfig.mRequestingLocationUpdates =
savedInstanceState.getBoolean(
TransConfig.REQUESTING_LOCATION_UPDATES_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LOCATION_KEY)) {
transData.mCurrentLocation =
savedInstanceState.getParcelable(TransConfig.LOCATION_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LAST_UPDATED_TIME_ST
RING_KEY)) {
TransConfig.mLastUpdateTime =
savedInstanceState.getString(
TransConfig.LAST_UPDATED_TIME_STRING_KEY);
}
}
}

protected void stopLocationUpdates() {


LocationServices.FusedLocationApi.removeLocationUpdates(
transData.mGoogleApiClient, this);
}

protected void startLocationUpdates() {


Log.i(TransConfig.TAG, "Start location update");
if (ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this.getContext(),
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this.getActivity(),new
String[]{

Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_CO
ARSE_LOCATION
}, 1);
}

LocationServices.FusedLocationApi.requestLocationUpdates(transData.mGo
ogleApiClient, transData.mLocationRequest, this);

if(mapReady) {
initSelectKoridor();
LatLng yourPos = transData.getCurrentPosition();//new
LatLng(transData.mCurrentLocation.getLatitude(),
transData.mCurrentLocation.getLongitude());
mMap.addMarker(new
MarkerOptions().position(yourPos).title("Your position"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(yourPos,
15));
mMap.setOnMarkerClickListener(this);
}
}

private ArrayList<KoridorDataObject> getKoridorDataset() {


ArrayList results = new ArrayList<KoridorDataObject>();
return results;
}

void renderShelterMapping(){
DataShelter shelter = new DataShelter(this);
shelter.getAllShelter(1);
shelterRendered = true;
}

public GoogleMap getmMap() {


return mMap;
}

public Double getSourceLat() {


return sourceLat;
}

public Double getSourceLon() {


return sourceLon;
}
}

Tracking shelter
package net.gulojowo.transsemarang;

import android.Manifest;
import android.annotation.SuppressLint;
import android.content.pm.PackageManager;
import android.location.Location;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.location.LocationServices;

import net.gulojowo.DataAdapter.ShelterAdapter;
import net.gulojowo.DataAdapter.TransData;
import net.gulojowo.DataSource.DataNearestShelter;
import net.gulojowo.DataSource.DataShelter;
import net.gulojowo.DataSource.ShelterDataObject;
import net.gulojowo.config.TransConfig;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class TransTracking extends FragmentActivity implements


OnMapReadyCallback,
GoogleMap.OnMarkerClickListener,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener {

public ArrayList nearestShelters = new


ArrayList<ShelterDataObject>();
public RecyclerView mRecyclerView;
public RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
private GoogleMap mMap;
public TransData transData = new TransData();
private boolean mapReady = false;
private boolean shelterRendered = false;
public static int markCurrent = R.drawable.mypos;
public static int markShelter = R.drawable.shelter;
public static int markTransit = R.drawable.transit;

public Map<String, Marker> shellMark = new HashMap<String,


Marker>();
// public Map<Integer, TransShelter> shellContainer = new
HashMap<Integer, TransShelter>();
// public Map<String, TransShelter> routeContainer = new
HashMap<String, TransShelter>();

public GoogleMap getmMap() {


return mMap;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
buildGoogleApiClient();
setContentView(R.layout.trans_nearest_shelter);
// Obtain the SupportMapFragment and get notified when the map
is ready to be used.
// SupportMapFragment mapFragment = (SupportMapFragment)
getSupportFragmentManager()
// .findFragmentById(R.id.map);
// mapFragment.getMapAsync(this);
// updateValuesFromBundle(savedInstanceState);
// Button refreshNearest = (Button)
findViewById(R.id.btn_refresh_nearest);
// prepareMenu();
//
// mRecyclerView = (RecyclerView)
findViewById(R.id.shelter_info);
// mRecyclerView.setHasFixedSize(true);
// mLayoutManager = new LinearLayoutManager(this);
// mRecyclerView.setLayoutManager(mLayoutManager);
//
// mAdapter = new ShelterAdapter(getShelterInfoDataSet(),
mMap);
// mRecyclerView.setAdapter(mAdapter);
//
// refreshNearest.setOnClickListener(
// new Button.OnClickListener(){
// @Override
// public void onClick(View view) {
// initNearestShelter();
// }
// }
// );
}

private void prepareMenu(){

private void initNearestShelter(){


Log.i(TransConfig.TAG, "Reload top 10 nearest shelter ..");
// DataNearestShelter nearest = new DataNearestShelter(this);
// nearest.getNearestShelter();
}

private ArrayList<ShelterDataObject> getShelterInfoDataSet() {


ArrayList results = new ArrayList<ShelterDataObject>();
// for (int index = 0; index < 2; index++) {
// ShelterDataObject obj = new ShelterDataObject("-",
// "-");
// results.add(index, obj);
// }
return results;
}

protected synchronized void buildGoogleApiClient() {


Log.i(TransConfig.TAG, "Permission check ...");
if (ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,new String[]{

Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_CO
ARSE_LOCATION
}, 1);
}

Log.i(TransConfig.TAG, "Building GoogleApiClient");


transData.mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
createLocationRequest();
}

private void reloadPosition(){

private void renderShelterMap(){


if(!shelterRendered) {
// DataShelter shelter = new DataShelter(this);
// shelter.getAllShelter();
// shelterRendered = true;
}
// transData.shelterHandler = new TransRenderShelter(this);
// transData.routeHandler = new TransRenderRoute(this);
// transData.shelterHandler.beginRender();//tampilkan semua
icon shelter
}

@SuppressLint("RestrictedApi")
protected void createLocationRequest() {
Log.i(TransConfig.TAG, "Create Location Request");
transData.mLocationRequest = new LocationRequest();

transData.mLocationRequest.setInterval(TransConfig.UPDATE_INTERVAL_IN_
MILLISECONDS);

transData.mLocationRequest.setFastestInterval(TransConfig.FASTEST_UPDA
TE_INTERVAL_IN_MILLISECONDS);

transData.mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_A
CCURACY);
}

private void updateValuesFromBundle(Bundle savedInstanceState) {


if (savedInstanceState != null) {
if
(savedInstanceState.keySet().contains(TransConfig.REQUESTING_LOCATION_
UPDATES_KEY)) {
TransConfig.mRequestingLocationUpdates =
savedInstanceState.getBoolean(
TransConfig.REQUESTING_LOCATION_UPDATES_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LOCATION_KEY)) {
transData.mCurrentLocation =
savedInstanceState.getParcelable(TransConfig.LOCATION_KEY);
}

if
(savedInstanceState.keySet().contains(TransConfig.LAST_UPDATED_TIME_ST
RING_KEY)) {
TransConfig.mLastUpdateTime =
savedInstanceState.getString(
TransConfig.LAST_UPDATED_TIME_STRING_KEY);
}
}
}

protected void stopLocationUpdates() {


LocationServices.FusedLocationApi.removeLocationUpdates(
transData.mGoogleApiClient, this);
}

protected void startLocationUpdates() {


Log.i(TransConfig.TAG, "Start location update");
if (ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,new String[]{

Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_CO
ARSE_LOCATION
}, 1);
}

LocationServices.FusedLocationApi.requestLocationUpdates(transData.mGo
ogleApiClient, transData.mLocationRequest, this);

if(mapReady) {
initNearestShelter();
LatLng yourPos = transData.getCurrentPosition();//new
LatLng(transData.mCurrentLocation.getLatitude(),
transData.mCurrentLocation.getLongitude());
mMap.addMarker(new
MarkerOptions().position(yourPos).title("Your position"));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(yourPos,
15));
mMap.setOnMarkerClickListener(this);
renderShelterMap();
}
}

@Override
public void onConnected(@Nullable Bundle bundle) {
Log.i(TransConfig.TAG, "Connected to GoogleApiClient");
if(transData.mCurrentLocation == null) {
if (ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,new String[]{

Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_CO
ARSE_LOCATION
}, 1);
}
transData.mCurrentLocation =
LocationServices.FusedLocationApi.getLastLocation(transData.mGoogleApi
Client);

Log.i(TransConfig.TAG,
"==================================================================");
Log.i(TransConfig.TAG, "Latitude
"+transData.mCurrentLocation.getLatitude());
Log.i(TransConfig.TAG, "Longiude
"+transData.mCurrentLocation.getLongitude());
Log.i(TransConfig.TAG,
"==================================================================");

startLocationUpdates();
}
}

@Override
public void onConnectionSuspended(int i) {
Log.i(TransConfig.TAG, "Connection suspended");
transData.mGoogleApiClient.connect();
}

@Override
public void onConnectionFailed(@NonNull ConnectionResult
connectionResult) {
Log.i(TransConfig.TAG, "Connection failed:
ConnectionResult.getErrorCode() = " +
connectionResult.getErrorCode());
}

@Override
public void onLocationChanged(Location location) {
transData.mCurrentLocation = location;//ambil posisi lat long
hp terakhir
TransConfig.mLastUpdateTime =
DateFormat.getTimeInstance().format(new Date());
Log.d("Loc_update", "updated");
reloadPosition();
}

@Override
public boolean onMarkerClick(Marker marker) {
try {
int shelID = Integer.parseInt(marker.getSnippet());

}catch(Exception e){

}
return false;
}

@Override
protected void onStart() {
super.onStart();
transData.mGoogleApiClient.connect();
}

@Override
protected void onStop() {
transData.mGoogleApiClient.disconnect();

super.onStop();
}

@Override
protected void onPause() {
super.onPause();
if (transData.mGoogleApiClient.isConnected()) {
stopLocationUpdates();
}
}

@Override
public void onResume() {
super.onResume();
if (transData.mGoogleApiClient.isConnected() && !
TransConfig.mRequestingLocationUpdates) {
startLocationUpdates();
}
}

/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or
move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the
user will be prompted to install
* it inside the SupportMapFragment. This method will only be
triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mapReady = true;
mMap = googleMap;
if(transData.mGoogleApiClient.isConnected() &&
transData.mCurrentLocation != null) {
Log.i(TransConfig.TAG, "Map and location service is
ready !");
// LatLng sydney = new
LatLng(transData.mCurrentLocation.getLatitude(),
transData.mCurrentLocation.getLongitude());
LatLng yourPos = transData.getCurrentPosition();
mMap.addMarker(new
MarkerOptions().position(yourPos).title("Posisi saya"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(yourPos));
mMap.setOnMarkerClickListener(this);
}else{
Log.i(TransConfig.TAG, "Location service is not ready!");
}
// mMap = googleMap;
//
// // Add a marker in Sydney and move the camera
// LatLng sydney = new LatLng(-34, 151);
// mMap.addMarker(new
MarkerOptions().position(sydney).title("Marker in Sydney"));
// mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}

You might also like