Commit 895f1d4e authored by Muhamad's avatar Muhamad

perbaikan 3d

parent 96f254b9
......@@ -48,9 +48,9 @@ import random
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def search_auto(request):
nama_desa = request.GET.get('namadesa')
with conn.cursor() as desa:
desa.execute(f"SELECT id, desa, kecamatan FROM geo_data_kelurahan WHERE desa ILIKE '{nama_desa}%' order by desa ASC limit 5")
desa.execute(f"SELECT id, desa, kecamatan FROM geo_data_kelurahan order by desa ASC")
all = desa.fetchall()
data = {'nama_des':all}
......@@ -737,22 +737,116 @@ def hapus(request):
print(respon)
return Response(respon)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def hasilsearch(request):
if request.method == 'GET':
id_desa = request.GET.get("id_desa_search")
nama_desa = request.GET.get("id_desa_search")
with conn.cursor() as kel:
kel.execute("SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa),'penduduk', (pria, wanita, belum_kawin, kawin, cerai_hidup, cerai_mati, wajib_ktp, islam, kristen, khatolik, hindu, budha, konghucu, kepercayaan_lain, u0, u5, u10, u15, u20, u25, u30, u35, u40, u45, u50, u55, u60, u65, u70, u75),'pekerjaan_pendidikan', (tidak_sekolah, belum_tamat, tamat_sd, sltp, slta, diploma_i, diploma_ii, diploma_iv, strata_ii, strata_iii, tidak_bekerja, aparatur_pemerintah, tenaga_pendidik, wiraswasta, pertanian, tenaga_kesehatan, pensiunan, pegawai, tentara, kepolisian, pedagang, petani, peternak, nelayan, karyawan, buruh, pembantu, tukang, pendeta, pastor, ustadz, dosen, guru, pilot, pengacara, notaris, arsitek, akuntan, konsultan, dokter, bidan, perawat, psikiater, sopir, lainnya),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan where id = %s"% int(id_desa))
kel_res_ = kel.fetchall()
nama_desa = nama_desa.split(",")[0]
with conn.cursor() as bts:
bts.execute("""
SELECT
st_asgeojson ( ST_ExteriorRing ( the_geom ) ) AS erings
FROM
( SELECT ( ST_Dump ( geom ) ).geom AS the_geom FROM geo_data_kelurahan WHERE desa = '%s' ) as foo
"""% nama_desa)
batas = bts.fetchall()
# batas_desa = json.loads(batas)
line_o = []
for i in batas:
o_pol1 = ''
o_poly = []
kel_res = []
for i in kel_res_:
kel_res.append(i[0])
for x in json.loads(i[0])['coordinates']:
o_pol1 += (f'{x[0]},{x[1]}""')
data = {'result':kel_res}
return Response(data)
o_pol2 = o_pol1.replace('""1',',1')
o_poly.append(o_pol2.replace('""',''))
line_o.append(o_poly)
with conn.cursor() as desa:
desa.execute("""
SELECT
ST_AsGeoJson ( ST_centroid ( geom ) )
FROM
geo_data_kelurahan
WHERE
desa = '%s'"""% nama_desa)
lat_lng = desa.fetchall()
with conn.cursor() as bang:
bang.execute("""SELECT
json_build_object (
'type',
'Feature',
'properties',
( buildings.ID, buildings.NAME, buildings.information ),
'administrasi',
(
buildings.address_1,
buildings.address_2,
buildings.address_3,
buildings.provinsi,
buildings.alamat,
buildings.luas_bangunan,
buildings.luas_tanah,
buildings.tinggi_bangunan,
buildings.gambar,
buildings.pemilik
),
'geometry',
ST_AsGeoJSON ( buildings.geom :: geometry ) :: json
)
FROM
geo_bangunan buildings
JOIN geo_data_kelurahan desa ON st_intersects ( ST_SetSRID(desa.geom, 0), buildings.geom )
WHERE
desa.desa = '%s'"""% nama_desa)
bangunan = bang.fetchall()
polygon_o = []
info_polygon = []
tinggi_pol = []
for i in bangunan:
o_pol1 = ''
o_poly = []
for x in i[0]['geometry']['coordinates'][0][0]:
o_pol1 += (f'{x[0]},{x[1]}""')
o_pol2 = o_pol1.replace('""1',',1')
o_poly.append(o_pol2.replace('""',''))
polygon_o.append(o_poly)
tinggi_pol.append(i[0]['administrasi']['f8'])
info_polygon.append(i[0]['properties']['f1'])
# for i in batas:
# o_batas = ''
# o_poly_batas = []
# for x in i[0]['geometry']['coordinates'][0][0]:
# o_batas += (f'{x[0]},{x[1]}""')
# o_pol2 = o_pol1.replace('""1',',1')
# o_poly.append(o_pol2.replace('""',''))
# polygon_o.append(o_poly)
# tinggi_pol.append(i[0]['administrasi']['f8'])
# info_polygon.append(i[0]['properties']['f1'])
lat = json.loads(lat_lng[0][0])['coordinates'][0]
lng = json.loads(lat_lng[0][0])['coordinates'][1]
respon={'polygon_o':polygon_o,'tinggi_pol':tinggi_pol, 'info_polygon': info_polygon, 'lat':lat, 'lng':lng, 'line_o':line_o}
return Response(respon)
import random
......
This diff is collapsed.
......@@ -1054,7 +1054,7 @@
var desa = response['nama_des'][i][1];
var kec = response['nama_des'][i][2];
var da = `<li value='` + id + `'>` + desa + `,` + kec + `</li>`;
var da = `<li value='` + desa + `,` + kec + `'>` + desa + `,` + kec + `</li>`;
data_de.push(da)
}
......@@ -1071,6 +1071,9 @@
});
//3d begin
function setsearch(element) {
var value = $(element).text();
......@@ -1086,11 +1089,8 @@
},
dataType: 'json',
success: function(response) {
var resultan = response['result'][0]
geo_json_search(resultan);
map.setView([resultan['geometry']['coordinates'][0][0][0][1], resultan['geometry']['coordinates'][0][0][0][0]], 14);
search_desa.addTo(map)
geo_batas.remove()
console.log(response)
}
});
}
......
......@@ -579,9 +579,28 @@
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalsearch3d" tabindex="-1" role="dialog">
<div class="modal-dialog modal-xs">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">3D Searching</h4>
</div>
<div class="modal-body">
<fieldset>
<select id="search_desa" placeholder="Pick a state..." style="width: 256px;height: 35px;">
</select>
<br>
</fieldset>
</div>
<div class="modal-footer">
<input class="btn btn-success btn-block" id="search3D" type="submit" value="Search">
</div>
</div>
</div>
</div>
<!--
<script>
$("#tipe_point").change(function() {
var tipe = $(this).val();
......@@ -609,4 +628,4 @@
}
});
});
</script>
\ No newline at end of file
</script> -->
\ No newline at end of file
......@@ -10,9 +10,11 @@
top: 7px;">
</i>
<!-- <i class="icon-location4 fa-gradient"></i> -->
<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OKU-GIS</b>
<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Teman-KU
</b> (Sistem Informasi Pembangunan OKU)
</a>
<ul class="nav navbar-nav pull-right visible-xs-block">
<li><a data-toggle="collapse" data-target="#navbar-mobile"><i class="icon-tree5"></i></a></li>
</ul>
......
{% load static %}
<ul class="dock" style="right: 0;position: absolute;">
<li class="fixed-plugin" style="top: 100px;">
<li class="fixed-plugin" style="top: 50px;">
<div class="dropdown show-dropdown" style="top: 1px;">
<a href="#" type="checkbox">
<input type="checkbox" name="checkbox" onclick="mapsganti()" id="mapschange" style="position: absolute;opacity: 0;width: 48px;height: 30px;">
<div id="labelchange">
<h1 style="color: white;margin-top: 5px;margin-left: 8px;">
3D
</h1>
</div>
<!-- <i class="fa fa-map-o fa-2x" style="color: white;
margin: 10px 10px;
width: auto;"> </i> -->
</a>
</div>
</li>
<li class="fixed-plugin no3d" style="top: 110px;">
<div class="dropdown show-dropdown" style="top: 1px;">
<a href="#" data-toggle="dropdown">
<i class="fa fa-map-o fa-2x" style="color: white;
......@@ -55,9 +73,9 @@
</ul>
</div>
</li>
<li class="fixed-plugin" style="top: 160px;">
<li class="fixed-plugin no3d" style="top: 170px;">
<div class="dropdown show-dropdown">
<div class="dropdown show-dropdown ">
<a href="#" data-toggle="dropdown">
<i class="fa fa-cog fa-2x" style="font-size: 36px;
color: white;
......@@ -71,7 +89,6 @@
<div class="panel-body"> -->
<div class="row" style="margin: 0;padding: 0;">
<div class="col-md-6">
<div class="checkbox">
<label>
<input type="checkbox" id="geo_tuplah" onclick="geotuplah()" style="margin-top:2px;">
......@@ -79,14 +96,13 @@
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="geo_building" style="margin-top:2px;">
Bangunan
</label>
</div>
<ul class="nasted active">
<!-- <ul class="nasted active">
<div class="checkbox">
<label>
<input type="checkbox" id="2d-maps" style="margin-top:2px;">
......@@ -99,13 +115,7 @@
Bangunan 3D Maps
</label>
</div>
</ul>
</ul> -->
<div class="checkbox">
<label>
<input type="checkbox" id="geo_jalan" onclick="geojalan()" style="margin-top:2px;">
......
......@@ -465,7 +465,7 @@
}
li.fixed-plugin .fa:hover {
transform: rotate(180deg);
transform: rotate(360deg);
transition: all 0.3s linear;
}
/*.move-btn .caret {*/
......@@ -683,10 +683,15 @@
<div class="row">
<div class="col-lg-12">
<div id="map">
</div>
<div id="map-cesium" style="z-index: -999; height: 605px; display:none"></div>
<div id="map-cesium" style="z-index: -999; height: 100vh; display:none">
<div class="label-bangunan" style="margin: 0px 0 0px 0px;padding-top: 55px;position: absolute;z-index: 1;right: 20px;">
<label style="background-color: white;">
&nbsp;&nbsp;left click + ctrl to rotate maps&nbsp;&nbsp;
</label>
</div>
<div class="page_loader_3d"></div>
</div>
</div>
</div>
</div>
......
This diff is collapsed.
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