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