Commit 701e640b authored by Manggar Mahardhika's avatar Manggar Mahardhika

30/092021 search jadi

parent 4958de4c
...@@ -63,6 +63,9 @@ urlpatterns = [ ...@@ -63,6 +63,9 @@ urlpatterns = [
path('edit-jalan-valid', views.editjalanvalid, name='edit-jalan-valid'), path('edit-jalan-valid', views.editjalanvalid, name='edit-jalan-valid'),
path('3d-maps', views.maps3d, name='3d-maps'), path('3d-maps', views.maps3d, name='3d-maps'),
path('deletejalan', views.deletejalan, name='hapus-jalan') path('deletejalan', views.deletejalan, name='hapus-jalan'),
path('search_spes', views.search_spes, name='search_spes'),
path('search_lanjut', views.search_lanjut, name='search_lanjut')
] ]
\ No newline at end of file
...@@ -2770,3 +2770,327 @@ def createpoint(request): ...@@ -2770,3 +2770,327 @@ def createpoint(request):
respon={'data':data, 'info': info, 'status':status} respon={'data':data, 'info': info, 'status':status}
return Response(respon) return Response(respon)
@api_view(('GET',))
def search_spes(request):
tipe = request.GET.get('type')
inp = request.GET.get('inp')
inp = str(inp)
kill = None
if tipe == ' Point':
with conn.cursor() as search_point:
search_point.execute("""
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_kantor_administrasi'
FROM
geo_kantor_administrasi a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_layanan_kesehatan'
FROM
geo_layanan_kesehatan a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_puskesmas'
FROM
geo_puskesmas a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_rumah_sakit'
FROM
geo_rumah_sakit a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_sarana_ibadah'
FROM
geo_sarana_ibadah a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_sarana_pendidikan'
FROM
geo_sarana_pendidikan a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_spbu'
FROM
geo_spbu a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_stasiun'
FROM
geo_stasiun a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_terminal_bus'
FROM
geo_terminal_bus a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_cagar_budaya'
FROM
geo_cagar_budaya a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
UNION
SELECT a.ID
,
a.namobj,
a.remark,
a.geom,
'geo_gardu_listrik'
FROM
geo_gardu_listrik a
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE
a.namobj ILIKE '%{}%'
LIMIT 10
""".format(inp, inp, inp, inp, inp, inp, inp, inp, inp, inp, inp))
s_point = search_point.fetchall()
kill = s_point
elif tipe == ' Bangunan':
with conn.cursor() as search_bangunan:
search_bangunan.execute("""
select id, name, geom FROM geo_bangunan where name ilike '%{}%' LIMIT 10
""".format(inp))
s_bangunan = search_bangunan.fetchall()
kill = s_bangunan
elif tipe == ' Jalan':
with conn.cursor() as search_jalan:
search_jalan.execute("""select id, namrjl, geom FROM geo_jalan where namrjl ilike '%{}%' LIMIT 10
""".format(inp))
s_jalan = search_jalan.fetchall()
kill = s_jalan
return Response({'result':kill})
@api_view(('GET',))
def search_lanjut(request):
tipe = request.GET.get('type')
idm = request.GET.get('idx')
kills = None
if tipe == ' Point':
db = request.GET.get('db')
suk = ''
if (db == 'geo_cagar_budaya' or db == 'geo_terminal_bus'):
suk == ', a.luas'
else:
suk == ''
with conn.cursor() as search_point:
search_point.execute("""
SELECT
json_build_object (
'type',
'Feature',
'administrasi',
(
A.namobj,
A.remark,
A.alamat,
A.luas_bangunan,
A.luas_tanah,
A.satuan_luas_bangunan,
A.satuan_luas_tanah,
A.gambar,
A.tinggi_bangunan,
A.perangkat,
A.tipe_gambar,
b.kabupaten,
c.kecamatan,
d.desa,
a.id
{}
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
FROM
{} A
JOIN geo_prov_kab b ON st_intersects ( A.geom, b.geom )
JOIN geo_data_kecamatan c ON st_intersects(A.geom, c.geom)
join geo_data_kelurahan d on st_intersects(A.geom, d.geom)
WHERE a.id = {}
""".format(suk, db, idm))
s_point = search_point.fetchall()
kills = s_point
elif tipe == ' Bangunan':
with conn.cursor() as search_bangunan:
search_bangunan.execute("""
SELECT
json_build_object (
'type',
'Feature',
'properties',
( gb.ID, gb.NAME, gb.information,
(
SELECT ARRAY_AGG
( '' || ID || ',' || tgl_perbaikan || ',' || jenis_perbaikan || '' ORDER BY tgl_perbaikan DESC )
FROM
tbl_perbaikan
WHERE
id_object = gb.ID
AND type_id = 1
)
),
'administrasi',
(
gb.address_1,
gb.address_2,
gb.address_3,
gb.provinsi,
gb.alamat,
gb.luas_bangunan,
gb.luas_tanah,
gb.tinggi_bangunan,
gb.gambar,
gb.pemilik,
gb.db_tipe,
gb.remark,
gb.point_id,
gb.point_name
),
'geometry',
ST_AsGeoJSON ( gb.geom :: geometry ) :: json
)
FROM
geo_bangunan gb
WHERE
gb.id = {}
""".format(idm))
s_bangunan = search_bangunan.fetchall()
polbang = []
for i in s_bangunan:
i[0]['properties']['f2'] = i[0]['properties']['f2'].replace("'"," ")
polbang.append(i[0])
data_bang = {'gen':s_bangunan}
kills = data_bang
elif tipe == ' Jalan':
with conn.cursor() as search_jalan:
search_jalan.execute("""SELECT
json_build_object (
'type',
'Feature',
'properties',
(
gj.ID,
namrjl,
st_length ( gj.geom :: geography ),
gj.lebar_jalan,
gj.remark,
gj.gambar,
(
SELECT ARRAY_AGG
( '' || ID || ',' || tgl_perbaikan || '' ORDER BY tgl_perbaikan DESC )
FROM
tbl_perbaikan
WHERE
id_object = gj.ID
AND type_id = 2
)
),
'geometry',
ST_AsGeoJSON ( gj.geom :: geometry ) :: json
)
FROM
geo_jalan gj
WHERE
gj.id = {}""".format(idm))
s_jalan = search_jalan.fetchall()
data_jal = {'gen':s_jalan}
kills = data_jal
return Response(kills)
\ No newline at end of file
...@@ -615,7 +615,6 @@ ...@@ -615,7 +615,6 @@
} }
} }
$(document).on("click", "#btn_edit_adm", function() { $(document).on("click", "#btn_edit_adm", function() {
var map_edit = L.map('map-for-edit', { var map_edit = L.map('map-for-edit', {
editable: true, editable: true,
...@@ -4573,13 +4572,10 @@ ...@@ -4573,13 +4572,10 @@
if ((checkBox1.checked == true) || (checkBox2.checked == true) || (checkBox3.checked == true) || (checkBox4.checked == true) || (checkBox5.checked == true) || (checkBox6.checked == true) || (checkBox7.checked == true) || (checkBox8.checked == true) || (checkBox9.checked == true) || (checkBox10.checked == true) || (checkBox11.checked == true) || (checkBox12.checked == true)) { if ((checkBox1.checked == true) || (checkBox2.checked == true) || (checkBox3.checked == true) || (checkBox4.checked == true) || (checkBox5.checked == true) || (checkBox6.checked == true) || (checkBox7.checked == true) || (checkBox8.checked == true) || (checkBox9.checked == true) || (checkBox10.checked == true) || (checkBox11.checked == true) || (checkBox12.checked == true)) {
showlegend() showlegend()
} else if ((checkBox1.checked == false) && (checkBox2.checked == false) && (checkBox3.checked == false) && (checkBox4.checked == false) && (checkBox5.checked == false) && (checkBox6.checked == false) && (checkBox7.checked == false) && (checkBox8.checked == false) && (checkBox9.checked == false) && (checkBox10.checked == false) && (checkBox11.checked == false) && (checkBox12.checked == false)) { } else if ((checkBox1.checked == false) && (checkBox2.checked == false) && (checkBox3.checked == false) && (checkBox4.checked == false) && (checkBox5.checked == false) && (checkBox6.checked == false) && (checkBox7.checked == false) && (checkBox8.checked == false) && (checkBox9.checked == false) && (checkBox10.checked == false) && (checkBox11.checked == false) && (checkBox12.checked == false)) {
hidelegend() hidelegend()
} }
} }
...@@ -7277,13 +7273,10 @@ ...@@ -7277,13 +7273,10 @@
}, },
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
console.log(data)
var data_all_kab = [] var data_all_kab = []
for (var i = 0; i < data['result'].length; i++) { for (var i = 0; i < data['result'].length; i++) {
var data_id = data['result'][i][0]; var data_id = data['result'][i][0];
var data_po = data['result'][i][1]; var data_po = data['result'][i][1];
console.log(data_id)
console.log(data_po)
var data_kab = `<option value="` +data_id + `">` + data_po + `</option>`; var data_kab = `<option value="` +data_id + `">` + data_po + `</option>`;
data_all_kab.push(data_kab) data_all_kab.push(data_kab)
}; };
......
...@@ -29,11 +29,7 @@ ...@@ -29,11 +29,7 @@
<i class="icon-pie-chart5"></i> <i class="icon-pie-chart5"></i>
</a> </a>
</li> </li>
<li style="margin-top: 400px;position: absolute;">
<a href="#" id="btn-hide-all" class="side-bar-but" style="position: absolute;margin-top: 20px;">
<i class="icon-arrow-right13"></i>
</a>
</li>
</ul> </ul>
...@@ -49,6 +45,12 @@ ...@@ -49,6 +45,12 @@
</a> </a>
</li> </li>
<hr> <hr>
<li>
<a href="#" id="btn-hide-all" class="side-bar-but" style="position: absolute;margin-top: 1px;">
<i class="icon-arrow-right13"></i>
</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</style> </style>
</head> </head>
<body style="background-image:url('../../static/img/bglog.PNG'); width: 100%; height: 100%; background-position: center; background-repeat: no-repeat; background-size: cover;"> <body style="background-image:url('../../static/img/bglog.PNG'); width: 100%; height: 100%; background-position: center; background-repeat: no-repeat; background-size: cover; overflow-x: hidden;">
<!-- <body style="background-color: gainsboro; width: 100%; height: 100%;"> --> <!-- <body style="background-color: gainsboro; width: 100%; height: 100%;"> -->
<!-- <body> --> <!-- <body> -->
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
</div> </div>
<!-- <div class="background-image"></div> --> <!-- <div class="background-image"></div> -->
<div> <div>
<img src="../../static/img/indonesia-ter.PNG" alt="Image" style="margin-top: 4%; margin-bottom: 3%; margin-left: 36%; width:1028px; "> <img src="../../static/img/indonesia-ter.PNG" alt="Image" style="margin-top: 4%; margin-bottom: 3%; margin-left: 38%; width:920px; ">
<span style="margin-top: 5%; margin-left: 45%; -webkit-filter: drop-shadow(5px 5px 5px #222); filter: drop-shadow(5px 5px 5px #222); width: 362px; color:#ffffff; font-family: 'Montserrat', light;">Fitur Teman-KU</span> <span style="margin-top: 5%; margin-left: 45%; -webkit-filter: drop-shadow(5px 5px 5px #222); filter: drop-shadow(5px 5px 5px #222); width: 362px; color:#ffffff; font-family: 'Montserrat', light;">Fitur Teman-KU</span>
<img src="../../static/img/Group_68.png" alt="Image" style="margin-top: 2%; margin-left: 45%; -webkit-filter: drop-shadow(5px 5px 5px #222); filter: drop-shadow(5px 5px 5px #222);"> <img src="../../static/img/Group_68.png" alt="Image" style="margin-top: 2%; margin-left: 45%; -webkit-filter: drop-shadow(5px 5px 5px #222); filter: drop-shadow(5px 5px 5px #222);">
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment