Created
September 9, 2020 07:27
-
-
Save DeaVenditama/aaf0f75509376db3c3bbe06d215145ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Controllers; | |
class Maps extends BaseController | |
{ | |
public function index() | |
{ | |
$model = new \App\Models\DataModel(); | |
$fileName = base_url("maps/prov.geojson"); | |
$file = file_get_contents($fileName); | |
$file = json_decode($file); | |
$features = $file->features; | |
foreach($features as $index=>$feature) | |
{ | |
$kode_wilayah = $feature->properties->kode; | |
$data = $model->where('id_master_data',1) | |
->where('kode_wilayah', $kode_wilayah) | |
->first(); | |
if($data) | |
{ | |
$features[$index]->properties->nilai = $data->nilai; | |
} | |
} | |
$nilaiMax = $model->select('MAX(nilai) AS nilai')->where('id_master_data', 1)->first()->nilai; | |
return view('maps/index',[ | |
'data' => $features, | |
'nilaiMax' => $nilaiMax, | |
]); | |
} | |
//-------------------------------------------------------------------- | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment