Commit 588f190e authored by Muhamad's avatar Muhamad

Merge branch 'master' of http://git.khansia.co.id/Nahrowi/oku-gis

parents 1184c705 bde81e96
......@@ -8,7 +8,21 @@ from django.contrib.auth.decorators import login_required
app_name = 'api'
urlpatterns = [
path('search_auto', views.search_auto, name='search'),
path('kantor_administrasi', views.kantor_administrasi, name='kantor_administrasi'),
path('layanan_kesehatan', views.layanan_kesehatan, name='layanan_kesehatan'),
path('apiviewpuskesmas', views.apiviewpuskesmas, name='apiviewpuskesmas'),
path('rumah_sakit', views.rumah_sakit, name='rumah_sakit'),
path('sarana_ibadah', views.sarana_ibadah, name='sarana_ibadah'),
path('sarana_pendidikan', views.sarana_pendidikan, name='sarana_pendidikan'),
path('apiviewstasiun', views.apiviewstasiun, name='apiviewstasiun'),
path('apiviewterminal', views.apiviewterminal, name='apiviewterminal'),
path('apiviewcagarbudaya', views.apiviewcagarbudaya, name='apiviewcagarbudaya'),
path('apiviewgardulistrik', views.apiviewgardulistrik, name='apiviewgardulistrik'),
path('tuplah', views.tuplah, name='tuplah'),
path('kecamatan', views.kecamatan, name='kecamatan'),
path('desangab', views.desangab, name='desangab'),
path('building', views.building, name='building'),
path('jalan', views.jalan, name='jalan'),
......
......@@ -62,7 +62,448 @@ def search_auto(request):
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def kantor_administrasi(request):
with conn.cursor() as kantor_administrasi:
kantor_administrasi.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,
(
SELECT ARRAY_AGG
( '' || ID || ',' || tgl_perbaikan || ',' || jenis_perbaikan || '' ORDER BY tgl_perbaikan DESC )
FROM
tbl_perbaikan
WHERE
id_object = A.ID
AND type_id = 1
)
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
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.is_deleted = 0""")
kantor_administrasi_res = kantor_administrasi.fetchall()
kantor_administrasi_result = []
for i in kantor_administrasi_res:
if i[0]['administrasi']['f16'] == None:
i[0]['administrasi']['f16'] = "None"
kantor_administrasi_result.append(i[0])
data = {'kantor_administrasi':kantor_administrasi_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def layanan_kesehatan(request):
with conn.cursor() as layanan_kesehatan:
layanan_kesehatan.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
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.is_deleted = 0""")
layanan_kesehatan_res = layanan_kesehatan.fetchall()
layanan_kesehatan_result = []
for i in layanan_kesehatan_res:
layanan_kesehatan_result.append(i[0])
data = {'layanan_kesehatan':layanan_kesehatan_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def apiviewpuskesmas(request):
with conn.cursor() as puskesmas:
puskesmas.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
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.is_deleted = 0""")
puskesmas_res = puskesmas.fetchall()
puskesmas_result = []
for i in puskesmas_res:
puskesmas_result.append(i[0])
data = {'apiviewpuskesmas':puskesmas_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def rumah_sakit(request):
with conn.cursor() as rumah_sakit:
rumah_sakit.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
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.is_deleted = 0""")
rumah_sakit_res = rumah_sakit.fetchall()
rumah_sakit_result = []
for i in rumah_sakit_res:
rumah_sakit_result.append(i[0])
data = {'rumah_sakit':rumah_sakit_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def sarana_ibadah(request):
with conn.cursor() as sarana_ibadah:
sarana_ibadah.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
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.is_deleted = 0""")
sarana_ibadah_res = sarana_ibadah.fetchall()
sarana_ibadah_result = []
for i in sarana_ibadah_res:
if i[0]["administrasi"]['f1'] == None:
i[0]["administrasi"]['f1'] = "None"
sarana_ibadah_result.append(i[0])
data = {'sarana_ibadah':sarana_ibadah_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def sarana_pendidikan(request):
with conn.cursor() as sarana_pendidikan:
sarana_pendidikan.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
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.is_deleted = 0""")
sarana_pendidikan_res = sarana_pendidikan.fetchall()
sarana_pendidikan_result = []
for i in sarana_pendidikan_res:
if i[0]["administrasi"]['f1'] == None:
i[0]["administrasi"]['f1'] = "None"
sarana_pendidikan_result.append(i[0])
data = {'sarana_pendidikan':sarana_pendidikan_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def apiviewstasiun(request):
with conn.cursor() as stasiun:
stasiun.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
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.is_deleted = 0""")
stasiun_res = stasiun.fetchall()
stasiun_result = []
for i in stasiun_res:
stasiun_result.append(i[0])
data = {'apiviewstasiun':stasiun_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def apiviewterminal(request):
with conn.cursor() as terminal:
terminal.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.luas,
a.id
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
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.is_deleted = 0""")
terminal_res = terminal.fetchall()
terminal_result = []
for i in terminal_res:
terminal_result.append(i[0])
data = {'apiviewterminal':terminal_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def apiviewcagarbudaya(request):
with conn.cursor() as cagar_budaya:
cagar_budaya.execute("""SELECT
json_build_object (
'type',
'Feature',
'administrasi',
(
A.namobj,
A.remark,
A.alamat,
A.gambar,
A.perangkat,
A.tipe_gambar,
b.kabupaten,
c.kecamatan,
d.desa,
a.luas,
a.id
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
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.is_deleted = 0""")
cagar_budaya_res = cagar_budaya.fetchall()
cagar_budaya_result = []
for i in cagar_budaya_res:
cagar_budaya_result.append(i[0])
data = {'apiviewcagarbudaya':cagar_budaya_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def apiviewgardulistrik(request):
with conn.cursor() as gardu_listrik:
gardu_listrik.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
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.is_deleted = 0""")
gardu_listrik_res = gardu_listrik.fetchall()
gardu_listrik_result = []
for i in gardu_listrik_res:
gardu_listrik_result.append(i[0])
data = {'apiviewgardulistrik':gardu_listrik_result}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def tuplah(request):
with conn.cursor() as desa:
desa.execute(f"""SELECT
......@@ -87,6 +528,37 @@ def tuplah(request):
data = {'tuplah':all}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def kecamatan(request):
with conn.cursor() as kecamatan:
kecamatan.execute(f"""SELECT kecamatan, json_build_object('type', 'Feature', 'administrasi', (id, kecamatan),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kecamatan""")
kec_res_ = kecamatan.fetchall()
# ltup = []
# for i in all:
# i[0]['legend']['f3'] = '{0:,.2f}'.format(i[0]['legend']['f3'])
# ltup.append(i[0])
kec_res = []
for i in kec_res_:
kec_res.append(i[1])
data = {'kecamatan':kec_res}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def desangab(request):
with conn.cursor() as desa:
desa.execute(f"""SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa, gambar),'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), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan""")
desa_res_ = desa.fetchall()
# ltup = []
# for i in all:
# i[0]['legend']['f3'] = '{0:,.2f}'.format(i[0]['legend']['f3'])
# ltup.append(i[0])
desa_res = []
for i in desa_res_:
desa_res.append(i[0])
data = {'kembangdesa':desa_res}
return Response(data)
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
......@@ -171,7 +643,6 @@ def jalan(request):
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editjalan(request):
if request.method == 'GET':
idjalan = request.GET.get("idjalan")
......
......@@ -20,460 +20,452 @@ class Dashboard(generic.TemplateView):
all_.execute("SELECT * from global_oku")
all = all_.fetchall()
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, gambar),'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), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan")
kel_res_ = kel.fetchall()
# 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, gambar),'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), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan")
# kel_res_ = kel.fetchall()
with conn.cursor() as kec:
kec.execute("SELECT kecamatan, json_build_object('type', 'Feature', 'administrasi', (id, kecamatan),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kecamatan")
kec_res_ = kec.fetchall()
# with conn.cursor() as kec:
# kec.execute("SELECT kecamatan, json_build_object('type', 'Feature', 'administrasi', (id, kecamatan),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kecamatan")
# kec_res_ = kec.fetchall()
# with conn.cursor() as knt:
# knt.execute("SELECT json_build_object('type', 'Feature', 'administrasi', (a.namobj, a.remark),'geometry', ST_AsGeoJSON(a.geom :: geometry) :: json) from geo_kantor_administrasi a join geo_prov_kab b on st_intersects(a.geom,b.geom)")
# knt_res = knt.fetchall()
# kec_res = []
# for i in kec_res_:
# kec_res.append(i[1])
kec_res = []
for i in kec_res_:
kec_res.append(i[1])
# kel_res = []
# for i in kel_res_:
# kel_res.append(i[0])
kel_res = []
for i in kel_res_:
kel_res.append(i[0])
# kntl = []
# for i in knt_res:
# kntl.append(i[0])
with conn.cursor() as kantor_administrasi:
kantor_administrasi.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,
(
SELECT ARRAY_AGG
( '' || ID || ',' || tgl_perbaikan || ',' || jenis_perbaikan || '' ORDER BY tgl_perbaikan DESC )
FROM
tbl_perbaikan
WHERE
id_object = A.ID
AND type_id = 1
)
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
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.is_deleted = 0""")
kantor_administrasi_res = kantor_administrasi.fetchall()
# with conn.cursor() as kantor_administrasi:
# kantor_administrasi.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,
# (
# SELECT ARRAY_AGG
# ( '' || ID || ',' || tgl_perbaikan || ',' || jenis_perbaikan || '' ORDER BY tgl_perbaikan DESC )
# FROM
# tbl_perbaikan
# WHERE
# id_object = A.ID
# AND type_id = 1
# )
# ),
# 'geometry',
# ST_AsGeoJSON ( A.geom :: geometry ) :: json
# )
# 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.is_deleted = 0""")
# kantor_administrasi_res = kantor_administrasi.fetchall()
kantor_administrasi_result = []
for i in kantor_administrasi_res:
if i[0]['administrasi']['f16'] == None:
i[0]['administrasi']['f16'] = "None"
kantor_administrasi_result.append(i[0])
# kantor_administrasi_result = []
# for i in kantor_administrasi_res:
# if i[0]['administrasi']['f16'] == None:
# i[0]['administrasi']['f16'] = "None"
# kantor_administrasi_result.append(i[0])
with conn.cursor() as layanan_kesehatan:
layanan_kesehatan.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
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.is_deleted = 0""")
layanan_kesehatan_res = layanan_kesehatan.fetchall()
# with conn.cursor() as layanan_kesehatan:
# layanan_kesehatan.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
# 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.is_deleted = 0""")
# layanan_kesehatan_res = layanan_kesehatan.fetchall()
layanan_kesehatan_result = []
for i in layanan_kesehatan_res:
layanan_kesehatan_result.append(i[0])
# layanan_kesehatan_result = []
# for i in layanan_kesehatan_res:
# layanan_kesehatan_result.append(i[0])
with conn.cursor() as puskesmas:
puskesmas.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
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.is_deleted = 0""")
puskesmas_res = puskesmas.fetchall()
# with conn.cursor() as puskesmas:
# puskesmas.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
# 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.is_deleted = 0""")
# puskesmas_res = puskesmas.fetchall()
puskesmas_result = []
for i in puskesmas_res:
puskesmas_result.append(i[0])
# puskesmas_result = []
# for i in puskesmas_res:
# puskesmas_result.append(i[0])
with conn.cursor() as rumah_sakit:
rumah_sakit.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
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.is_deleted = 0""")
rumah_sakit_res = rumah_sakit.fetchall()
# with conn.cursor() as rumah_sakit:
# rumah_sakit.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
# 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.is_deleted = 0""")
# rumah_sakit_res = rumah_sakit.fetchall()
rumah_sakit_result = []
for i in rumah_sakit_res:
rumah_sakit_result.append(i[0])
# rumah_sakit_result = []
# for i in rumah_sakit_res:
# rumah_sakit_result.append(i[0])
with conn.cursor() as sarana_ibadah:
sarana_ibadah.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
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.is_deleted = 0""")
sarana_ibadah_res = sarana_ibadah.fetchall()
# with conn.cursor() as sarana_ibadah:
# sarana_ibadah.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
# 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.is_deleted = 0""")
# sarana_ibadah_res = sarana_ibadah.fetchall()
sarana_ibadah_result = []
for i in sarana_ibadah_res:
if i[0]["administrasi"]['f1'] == None:
i[0]["administrasi"]['f1'] = "None"
sarana_ibadah_result.append(i[0])
# sarana_ibadah_result = []
# for i in sarana_ibadah_res:
# if i[0]["administrasi"]['f1'] == None:
# i[0]["administrasi"]['f1'] = "None"
# sarana_ibadah_result.append(i[0])
with conn.cursor() as sarana_pendidikan:
sarana_pendidikan.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
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.is_deleted = 0""")
sarana_pendidikan_res = sarana_pendidikan.fetchall()
# with conn.cursor() as sarana_pendidikan:
# sarana_pendidikan.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
# 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.is_deleted = 0""")
# sarana_pendidikan_res = sarana_pendidikan.fetchall()
sarana_pendidikan_result = []
for i in sarana_pendidikan_res:
if i[0]["administrasi"]['f1'] == None:
i[0]["administrasi"]['f1'] = "None"
sarana_pendidikan_result.append(i[0])
# sarana_pendidikan_result = []
# for i in sarana_pendidikan_res:
# if i[0]["administrasi"]['f1'] == None:
# i[0]["administrasi"]['f1'] = "None"
# sarana_pendidikan_result.append(i[0])
with conn.cursor() as spbu:
spbu.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
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.is_deleted = 0""")
spbu_res = spbu.fetchall()
# with conn.cursor() as spbu:
# spbu.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
# 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.is_deleted = 0""")
# spbu_res = spbu.fetchall()
spbu_result = []
for i in spbu_res:
spbu_result.append(i[0])
# spbu_result = []
# for i in spbu_res:
# spbu_result.append(i[0])
with conn.cursor() as stasiun:
stasiun.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
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.is_deleted = 0""")
stasiun_res = stasiun.fetchall()
# with conn.cursor() as stasiun:
# stasiun.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
# 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.is_deleted = 0""")
# stasiun_res = stasiun.fetchall()
stasiun_result = []
for i in stasiun_res:
stasiun_result.append(i[0])
# stasiun_result = []
# for i in stasiun_res:
# stasiun_result.append(i[0])
with conn.cursor() as terminal:
terminal.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.luas,
a.id
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
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.is_deleted = 0""")
terminal_res = terminal.fetchall()
# with conn.cursor() as terminal:
# terminal.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.luas,
# a.id
# ),
# 'geometry',
# ST_AsGeoJSON ( A.geom :: geometry ) :: json
# )
# 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.is_deleted = 0""")
# terminal_res = terminal.fetchall()
terminal_result = []
for i in terminal_res:
terminal_result.append(i[0])
# terminal_result = []
# for i in terminal_res:
# terminal_result.append(i[0])
with conn.cursor() as cagar_budaya:
cagar_budaya.execute("""SELECT
json_build_object (
'type',
'Feature',
'administrasi',
(
A.namobj,
A.remark,
A.alamat,
A.gambar,
A.perangkat,
A.tipe_gambar,
b.kabupaten,
c.kecamatan,
d.desa,
a.luas,
a.id
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
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.is_deleted = 0""")
cagar_budaya_res = cagar_budaya.fetchall()
# with conn.cursor() as cagar_budaya:
# cagar_budaya.execute("""SELECT
# json_build_object (
# 'type',
# 'Feature',
# 'administrasi',
# (
# A.namobj,
# A.remark,
# A.alamat,
# A.gambar,
# A.perangkat,
# A.tipe_gambar,
# b.kabupaten,
# c.kecamatan,
# d.desa,
# a.luas,
# a.id
# ),
# 'geometry',
# ST_AsGeoJSON ( A.geom :: geometry ) :: json
# )
# 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.is_deleted = 0""")
# cagar_budaya_res = cagar_budaya.fetchall()
cagar_budaya_result = []
for i in cagar_budaya_res:
cagar_budaya_result.append(i[0])
# cagar_budaya_result = []
# for i in cagar_budaya_res:
# cagar_budaya_result.append(i[0])
with conn.cursor() as gardu_listrik:
gardu_listrik.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
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.is_deleted = 0""")
gardu_listrik_res = gardu_listrik.fetchall()
# with conn.cursor() as gardu_listrik:
# gardu_listrik.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
# 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.is_deleted = 0""")
# gardu_listrik_res = gardu_listrik.fetchall()
gardu_listrik_result = []
for i in gardu_listrik_res:
gardu_listrik_result.append(i[0])
# gardu_listrik_result = []
# for i in gardu_listrik_res:
# gardu_listrik_result.append(i[0])
with conn.cursor() as data_per:
data_per.execute("""
......@@ -610,19 +602,19 @@ class Dashboard(generic.TemplateView):
context = {
'title':'Dashboard',
'kelurahan':kel_res,
'kecamatan':kec_res,
'kantor_administrasi':kantor_administrasi_result,
'layanan_kesehatan':layanan_kesehatan_result,
'puskesmas':puskesmas_result,
'rumah_sakit':rumah_sakit_result,
'sarana_ibadah':sarana_ibadah_result,
'sarana_pendidikan':sarana_pendidikan_result,
'spbu':spbu_result,
'stasiun':stasiun_result,
'terminal':terminal_result,
'cagar_budaya':cagar_budaya_result,
'gardu_listrik':gardu_listrik_result,
# 'kelurahan':kel_res,
# 'kecamatan':kec_res,
# 'kantor_administrasi':kantor_administrasi_result,
# 'layanan_kesehatan':layanan_kesehatan_result,
# 'puskesmas':puskesmas_result,
# 'rumah_sakit':rumah_sakit_result,
# 'sarana_ibadah':sarana_ibadah_result,
# 'sarana_pendidikan':sarana_pendidikan_result,
# 'spbu':spbu_result,
# 'stasiun':stasiun_result,
# 'terminal':terminal_result,
# 'cagar_budaya':cagar_budaya_result,
# 'gardu_listrik':gardu_listrik_result,
'global':all[0],
'res_all':res_all,
'thisUser' : user_data,
......
......@@ -85,11 +85,11 @@ DATABASES = {
'NAME': 'oku_gis_new',
'USER': 'postgres',
'PASSWORD' : 'khansia215758',
'HOST': '30.10.20.102',
'PORT': '5432',
# 'HOST': '30.10.20.102',
# 'PORT': '5432',
'HOST': '103.126.28.66',
'PORT': '8082',
# 'HOST': '103.126.28.66',
# 'PORT': '8082',
# 'HOST': '125.164.19.183',
# 'PORT': '5432',
}
}
......
......@@ -92,8 +92,8 @@
<script>
//suk
var kantor_administrasi = "{{ kantor_administrasi }}".replace(/&#x27;/g, '"');
var result_kan_adm = JSON.parse("" + kantor_administrasi + "")
// var kantor_administrasi = "{{ kantor_administrasi }}".replace(/&#x27;/g, '"');
// var result_kan_adm = JSON.parse("" + kantor_administrasi + "")
geo_po_adm = L.geoJson(null, {
......@@ -825,16 +825,91 @@
geo_po_adm.addData(data)
}
geo_json_po_adm(result_kan_adm);
// geo_json_po_adm(result_kan_adm);
function k_adm() {
// var checkBox = document.getElementById("knt_adm");
// if (checkBox.checked == true) {
// newe(markeradm, geo_po_adm, checkBox)
// } else {
// markeradm.remove()
// geo_po_adm.remove()
// // valket()
// }
// var lastZoom;
// map.on('zoomend', function() {
// var zoom = map.getZoom();
// // console.log(zoom)
// if (zoom < 14 && (!lastZoom || lastZoom >= 14)) {
// if (checkBox.checked == true) {
// $.ajax({
// url: "{% url 'api:kantor_administrasi'%}",
// dataType: 'json',
// type: 'GET',
// success: function(response) {
// // loaderPage(false);
// // map.setView([-4.125826277307029, 104.1881561279297], 13);
// // var len = response['kecamatan'].length;
// // console.log(response)
// var data_de = []
// for (var i = 0; i < response['kantor_administrasi'].length; i++) {
// geoj = response['kantor_administrasi'][i];
// data_de.push(geoj);
// }
// // console.log(data_de)
// geo_json_po_adm(data_de);
// }
// });
// markeradm.addLayer(geo_po_adm);
// map.addLayer(markeradm);
// map.removeLayer(markeradm);
// map.addLayer(markeradm);
// map.removeLayer(geo_po_adm);
// // $("#legendapo").css('display', 'block');
// } else {
// // $("#legendapo").css('display', 'none');
// map.removeLayer(markeradm);
// }
// } else if (zoom >= 14 && (!lastZoom || lastZoom < 14)) {
// if (checkBox.checked == true) {
// map.removeLayer(markeradm);
// map.addLayer(geo_po_adm);
// } else {
// map.removeLayer(geo_po_adm);
// }
// }
// lastZoom = zoom;
// })
var checkBox = document.getElementById("knt_adm");
if (checkBox.checked == true) {
newe(markeradm, geo_po_adm, checkBox)
// loaderPage(true);
$.ajax({
url: "{% url 'api:kantor_administrasi'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['kantor_administrasi'].length; i++) {
geoj = response['kantor_administrasi'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_adm(data_de);
newe(markeradm, geo_po_adm, checkBox)
}
});
} else {
markeradm.clearLayers()
geo_po_adm.clearLayers()
markeradm.remove()
geo_po_adm.remove()
// valket()
}
}
......@@ -1024,8 +1099,8 @@
})
});
var layanan_kesehatan = "{{ layanan_kesehatan }}".replace(/&#x27;/g, '"');
var result_lay_kes = JSON.parse("" + layanan_kesehatan + "")
// var layanan_kesehatan = "{{ layanan_kesehatan }}".replace(/&#x27;/g, '"');
// var result_lay_kes = JSON.parse("" + layanan_kesehatan + "")
var geo_po_kes = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -1344,16 +1419,44 @@
geo_po_kes.addData(data)
}
geo_json_po_kes(result_lay_kes);
// geo_json_po_kes(result_lay_kes);
function l_kes() {
// var checkBox = document.getElementById("lyn_kes");
// if (checkBox.checked == true) {
// newe(markerkes, geo_po_kes, checkBox)
// } else {
// markerkes.remove()
// geo_po_kes.remove()
// // valket()
// }
var checkBox = document.getElementById("lyn_kes");
if (checkBox.checked == true) {
newe(markerkes, geo_po_kes, checkBox)
// loaderPage(true);
$.ajax({
url: "{% url 'api:layanan_kesehatan'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['layanan_kesehatan'].length; i++) {
geoj = response['layanan_kesehatan'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_kes(data_de);
newe(markerkes, geo_po_kes, checkBox)
}
});
} else {
markerkes.clearLayers()
geo_po_kes.clearLayers()
markerkes.remove()
geo_po_kes.remove()
// valket()
}
}
......@@ -1450,8 +1553,8 @@
});
var puskesmas = "{{ puskesmas }}".replace(/&#x27;/g, '"');
var result_puskes = JSON.parse("" + puskesmas + "")
// var puskesmas = "{{ puskesmas }}".replace(/&#x27;/g, '"');
// var result_puskes = JSON.parse("" + puskesmas + "")
var geo_po_puskes = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -1766,16 +1869,44 @@
geo_po_puskes.addData(data)
}
geo_json_po_puskes(result_puskes);
// geo_json_po_puskes(result_puskes);
function pks() {
// var checkBox = document.getElementById("pus");
// if (checkBox.checked == true) {
// newe(markerpuskes, geo_po_puskes, checkBox)
// } else {
// markerpuskes.remove()
// geo_po_puskes.remove()
// // valket()
// }
var checkBox = document.getElementById("pus");
if (checkBox.checked == true) {
newe(markerpuskes, geo_po_puskes, checkBox)
// loaderPage(true);
$.ajax({
url: "{% url 'api:apiviewpuskesmas'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['apiviewpuskesmas'].length; i++) {
geoj = response['apiviewpuskesmas'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_puskes(data_de);
newe(markerpuskes, geo_po_puskes, checkBox)
}
});
} else {
markerpuskes.clearLayers()
geo_po_puskes.clearLayers()
markerpuskes.remove()
geo_po_puskes.remove()
// valket()
}
}
......@@ -1871,8 +2002,8 @@
});
var rumah_sakit = "{{ rumah_sakit }}".replace(/&#x27;/g, '"');
var result_rumah_sakit = JSON.parse("" + rumah_sakit + "")
// var rumah_sakit = "{{ rumah_sakit }}".replace(/&#x27;/g, '"');
// var result_rumah_sakit = JSON.parse("" + rumah_sakit + "")
var geo_po_rumah_sakit = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -2174,15 +2305,41 @@
geo_po_rumah_sakit.addData(data)
}
geo_json_po_rumah_sakit(result_rumah_sakit);
// geo_json_po_rumah_sakit(result_rumah_sakit);
function rs() {
// var checkBox = document.getElementById("rusak");
// if (checkBox.checked == true) {
// geo_po_rumah_sakit.addTo(map)
// } else {
// geo_po_rumah_sakit.remove()
// // valket()
// }
var checkBox = document.getElementById("rusak");
if (checkBox.checked == true) {
geo_po_rumah_sakit.addTo(map)
// loaderPage(true);
$.ajax({
url: "{% url 'api:rumah_sakit'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['rumah_sakit'].length; i++) {
geoj = response['rumah_sakit'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_rumah_sakit(data_de);
geo_po_rumah_sakit.addTo(map)
}
});
} else {
geo_po_rumah_sakit.clearLayers()
geo_po_rumah_sakit.remove()
// valket()
}
}
......@@ -2277,8 +2434,8 @@
});
var sarana_ibadah = "{{ sarana_ibadah }}".replace(/&#x27;/g, '"');
var result_sarana_ibadah = JSON.parse("" + sarana_ibadah + "")
// var sarana_ibadah = "{{ sarana_ibadah }}".replace(/&#x27;/g, '"');
// var result_sarana_ibadah = JSON.parse("" + sarana_ibadah + "")
var geo_po_sarana_ibadah = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -2703,16 +2860,44 @@
geo_po_sarana_ibadah.addData(data)
}
geo_json_po_sarana_ibadah(result_sarana_ibadah);
// geo_json_po_sarana_ibadah(result_sarana_ibadah);
function fiksi() {
// var checkBox = document.getElementById("ibdh");
// if (checkBox.checked == true) {
// newe(markeribdh, geo_po_sarana_ibadah, checkBox)
// } else {
// markeribdh.remove()
// geo_po_sarana_ibadah.remove()
// // valket()
// }
var checkBox = document.getElementById("ibdh");
if (checkBox.checked == true) {
newe(markeribdh, geo_po_sarana_ibadah, checkBox)
// loaderPage(true);
$.ajax({
url: "{% url 'api:sarana_ibadah'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['sarana_ibadah'].length; i++) {
geoj = response['sarana_ibadah'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_sarana_ibadah(data_de);
newe(markeribdh, geo_po_sarana_ibadah, checkBox)
}
});
} else {
markeribdh.clearLayers()
geo_po_sarana_ibadah.clearLayers()
markeribdh.remove()
geo_po_sarana_ibadah.remove()
// valket()
}
}
......@@ -2806,8 +2991,8 @@
});
var sarana_pendidikan = "{{ sarana_pendidikan }}".replace(/&#x27;/g, '"');
var result_sarana_pendidikan = JSON.parse("" + sarana_pendidikan + "")
// var sarana_pendidikan = "{{ sarana_pendidikan }}".replace(/&#x27;/g, '"');
// var result_sarana_pendidikan = JSON.parse("" + sarana_pendidikan + "")
var geo_po_sarana_pendidikan = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -3213,16 +3398,44 @@
geo_po_sarana_pendidikan.addData(data)
}
geo_json_po_sarana_pendidikan(result_sarana_pendidikan);
// geo_json_po_sarana_pendidikan(result_sarana_pendidikan);
function didik() {
// var checkBox = document.getElementById("dididik");
// if (checkBox.checked == true) {
// newe(markerpend, geo_po_sarana_pendidikan, checkBox)
// } else {
// markerpend.remove()
// geo_po_sarana_pendidikan.remove()
// // valket()
// }
var checkBox = document.getElementById("dididik");
if (checkBox.checked == true) {
newe(markerpend, geo_po_sarana_pendidikan, checkBox)
// loaderPage(true);
$.ajax({
url: "{% url 'api:sarana_pendidikan'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['sarana_pendidikan'].length; i++) {
geoj = response['sarana_pendidikan'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_sarana_pendidikan(data_de);
newe(markerpend, geo_po_sarana_pendidikan, checkBox)
}
});
} else {
markerpend.clearLayers()
geo_po_sarana_pendidikan.clearLayers()
markerpend.remove()
geo_po_sarana_pendidikan.remove()
// valket()
}
}
......@@ -3692,8 +3905,8 @@
// });
var stasiun = "{{ stasiun }}".replace(/&#x27;/g, '"');
var result_stasiun = JSON.parse("" + stasiun + "")
// var stasiun = "{{ stasiun }}".replace(/&#x27;/g, '"');
// var result_stasiun = JSON.parse("" + stasiun + "")
var geo_po_stasiun = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -3990,15 +4203,41 @@
geo_po_stasiun.addData(data)
}
geo_json_po_stasiun(result_stasiun);
// geo_json_po_stasiun(result_stasiun);
function sthall() {
// var checkBox = document.getElementById("tasiun");
// if (checkBox.checked == true) {
// geo_po_stasiun.addTo(map)
// } else {
// geo_po_stasiun.remove()
// // valket()
// }
var checkBox = document.getElementById("tasiun");
if (checkBox.checked == true) {
geo_po_stasiun.addTo(map)
// loaderPage(true);
$.ajax({
url: "{% url 'api:apiviewstasiun'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['apiviewstasiun'].length; i++) {
geoj = response['apiviewstasiun'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_stasiun(data_de);
geo_po_stasiun.addTo(map)
}
});
} else {
geo_po_stasiun.clearLayers()
geo_po_stasiun.remove()
// valket()
}
}
......@@ -4093,8 +4332,8 @@
});
var terminal = "{{ terminal }}".replace(/&#x27;/g, '"');
var result_terminal = JSON.parse("" + terminal + "")
// var terminal = "{{ terminal }}".replace(/&#x27;/g, '"');
// var result_terminal = JSON.parse("" + terminal + "")
var geo_po_terminal = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -4386,15 +4625,41 @@
geo_po_terminal.addData(data)
}
geo_json_po_terminal(result_terminal);
// geo_json_po_terminal(result_terminal);
function temanggung() {
// var checkBox = document.getElementById("caheum");
// if (checkBox.checked == true) {
// geo_po_terminal.addTo(map)
// } else {
// geo_po_terminal.remove()
// // valket()
// }
var checkBox = document.getElementById("caheum");
if (checkBox.checked == true) {
geo_po_terminal.addTo(map)
// loaderPage(true);
$.ajax({
url: "{% url 'api:apiviewterminal'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['apiviewterminal'].length; i++) {
geoj = response['apiviewterminal'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_terminal(data_de);
geo_po_terminal.addTo(map)
}
});
} else {
geo_po_terminal.clearLayers()
geo_po_terminal.remove()
// valket()
}
}
......@@ -4489,8 +4754,8 @@
});
var cagar_budaya = "{{ cagar_budaya }}".replace(/&#x27;/g, '"');
var result_cagar_budaya = JSON.parse("" + cagar_budaya + "")
// var cagar_budaya = "{{ cagar_budaya }}".replace(/&#x27;/g, '"');
// var result_cagar_budaya = JSON.parse("" + cagar_budaya + "")
var geo_po_cagar_budaya = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -4783,15 +5048,41 @@
geo_po_cagar_budaya.addData(data)
}
geo_json_po_cagar_budaya(result_cagar_budaya);
// geo_json_po_cagar_budaya(result_cagar_budaya);
function cb100() {
// var checkBox = document.getElementById("cabud");
// if (checkBox.checked == true) {
// geo_po_cagar_budaya.addTo(map)
// } else {
// geo_po_cagar_budaya.remove()
// // valket()
// }
var checkBox = document.getElementById("cabud");
if (checkBox.checked == true) {
geo_po_cagar_budaya.addTo(map)
// loaderPage(true);
$.ajax({
url: "{% url 'api:apiviewcagarbudaya'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['apiviewcagarbudaya'].length; i++) {
geoj = response['apiviewcagarbudaya'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_cagar_budaya(data_de);
geo_po_cagar_budaya.addTo(map)
}
});
} else {
geo_po_cagar_budaya.clearLayers()
geo_po_cagar_budaya.remove()
// valket()
}
}
......@@ -4886,9 +5177,9 @@
});
var gardu_listrik = "{{ gardu_listrik }}".replace(/&#x27;/g, '"');
var result_gardu_listrik = JSON.parse("" + gardu_listrik + "")
console.log(result_gardu_listrik)
// var gardu_listrik = "{{ gardu_listrik }}".replace(/&#x27;/g, '"');
// var result_gardu_listrik = JSON.parse("" + gardu_listrik + "")
// console.log(result_gardu_listrik)
var geo_po_gardu_listrik = L.geoJson(null, {
pointToLayer: function(feature, latlng) {
......@@ -5189,15 +5480,41 @@
geo_po_gardu_listrik.addData(data)
}
geo_json_po_gardu_listrik(result_gardu_listrik);
// geo_json_po_gardu_listrik(result_gardu_listrik);
function gl100() {
// var checkBox = document.getElementById("gardu");
// if (checkBox.checked == true) {
// geo_po_gardu_listrik.addTo(map)
// } else {
// geo_po_gardu_listrik.remove()
// // valket()
// }
var checkBox = document.getElementById("gardu");
if (checkBox.checked == true) {
geo_po_gardu_listrik.addTo(map)
// loaderPage(true);
$.ajax({
url: "{% url 'api:apiviewgardulistrik'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['apiviewgardulistrik'].length; i++) {
geoj = response['apiviewgardulistrik'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_po_gardu_listrik(data_de);
geo_po_gardu_listrik.addTo(map)
}
});
} else {
geo_po_gardu_listrik.clearLayers()
geo_po_gardu_listrik.remove()
// valket()
}
}
......@@ -8767,12 +9084,13 @@
},
dataType: 'json',
success: function(data) {
console.log(data)
let list_poly = [];
for (var i = 0; i < data['gen'].length; i++) {
geoj = data['gen'][i][0];
list_poly.push(geoj);
};
console.log(list_poly)
geo_json_bangunan(list_poly);
}
});
......
......@@ -62,13 +62,13 @@
}
var kecamatan = "{{ kecamatan }}".replace(/&#x27;/g, '"');
var result_kec = JSON.parse("" + kecamatan + "");
// var kecamatan = "{{ kecamatan }}".replace(/&#x27;/g, '"');
// var result_kec = JSON.parse("" + kecamatan + "");
var kelurahan = "{{ kelurahan }}".replace(/&#x27;/g, '"');
var result_kel = JSON.parse("" + kelurahan + "")
// var kelurahan = "{{ kelurahan }}".replace(/&#x27;/g, '"');
// var result_kel = JSON.parse("" + kelurahan + "")
var geo_batas_kel = batas_desa_desa();
function batas_desa_desa() {
......@@ -757,9 +757,6 @@
});
var geo_batas_kec = L.geoJson(null, {
style: function(feature) {
return {
......@@ -790,9 +787,9 @@
},
click: function(e) {
$("modal_kecamatan").modal('show');
var geocodeService = L.esri.Geocoding.geocodeService();
var geocoderNominatim = new L.Control.Geocoder.Nominatim();
var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
// var geocodeService = L.esri.Geocoding.geocodeService();
// var geocoderNominatim = new L.Control.Geocoder.Nominatim();
// var geogeo = geocodeService.reverse().latlng(e.latlng).run(function(error, result) {
console.log(feature.administrasi.f1)
content_edit_kec = `
<div class="modal-dialog modal-md">
......@@ -825,7 +822,7 @@
</div>
</div>`;
$("#modal_kecamatan").html(content_edit_kec)
});
// });
}
});
......@@ -840,9 +837,9 @@
geo_batas_kec.addData(data)
}
geo_json_kel(result_kel);
// geo_json_kel(result_kel);
//geo_json_jalan(result_jln)
geo_json_kec(result_kec);
// geo_json_kec(result_kec);
function onEachFeature(feature, layer) {
if (feature.properties && feature.properties.popupContent) {
......@@ -852,10 +849,42 @@
function batasdesa() {
// var checkBox = document.getElementById("batas_desa");
// if (checkBox.checked == true) {
// geo_batas_kel.addTo(map)
// } else {
// geo_batas_kel.remove()
// }
// cek_overlay()
var checkBox = document.getElementById("batas_desa");
if (checkBox.checked == true) {
// loaderPage(true);
if (map.hasLayer(geo_batas_kel)) {
geo_batas_kel.clearLayers()
geo_batas_kel.remove()
// geo_batas_kel.addTo(map)
}
$.ajax({
url: "{% url 'api:desangab'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['kembangdesa'].length; i++) {
geoj = response['kembangdesa'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_kel(data_de);
}
});
geo_batas_kel.addTo(map)
} else {
geo_batas_kel.clearLayers()
geo_batas_kel.remove()
}
cek_overlay()
......@@ -872,10 +901,41 @@
}
function bataskec() {
// var checkBox = document.getElementById("batas_kec");
// if (checkBox.checked == true) {
// geo_batas_kec.addTo(map)
// } else {
// geo_batas_kec.remove()
// }
// cek_overlay()
var checkBox = document.getElementById("batas_kec");
if (checkBox.checked == true) {
// loaderPage(true);
if (map.hasLayer(geo_batas_kec)) {
geo_batas_kec.clearLayers()
geo_batas_kec.remove()
}
$.ajax({
url: "{% url 'api:kecamatan'%}",
dataType: 'json',
type: 'GET',
success: function(response) {
// loaderPage(false);
// map.setView([-4.125826277307029, 104.1881561279297], 13);
// var len = response['kecamatan'].length;
// console.log(response)
var data_de = []
for (var i = 0; i < response['kecamatan'].length; i++) {
geoj = response['kecamatan'][i];
data_de.push(geoj);
}
// console.log(data_de)
geo_json_kec(data_de);
}
});
geo_batas_kec.addTo(map)
} else {
geo_batas_kec.clearLayers()
geo_batas_kec.remove()
}
cek_overlay()
......@@ -898,9 +958,11 @@
document.getElementById("batas_kec").checked = true;
document.getElementById("batas_kota").checked = true;
document.getElementById("batas_desa").checked = true;
geo_batas_kec.addTo(map)
geo_batas.addTo(map)
geo_batas_kel.addTo(map)
// geo_batas_kel.addTo(map)
// geo_batas_kec.addTo(map)
bataskec()
batasdesa()
} else {
document.getElementById("batas_kec").checked = false;
document.getElementById("batas_kota").checked = false;
......
......@@ -379,7 +379,7 @@
<div class="row">
<div class="col-md-6">
<div class="gambar_kelurahan">
<img src="/static/img/imm.png" alt="" style="width:360px;height:290px;border-top-left-radius: 10px;">
<img src="/static/img/image_null.png" alt="" style="width:360px;height:290px;border-top-left-radius: 10px;">
</div>
<div style="margin: 10px;">
......
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