Commit 0ad599b2 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push

parent 92c4273e
...@@ -18,15 +18,29 @@ urlpatterns = [ ...@@ -18,15 +18,29 @@ urlpatterns = [
path('editkependudukan/', views.editkependudukan, name='kependudukan'), path('editkependudukan/', views.editkependudukan, name='kependudukan'),
path('edit-point-rumahsakit', views.editrumahsakit, name='rumahsakit'), path('editkantor', views.editpointka, name='editkantor'),
path('edit-point-cagarbudaya', views.editcagarbudaya, name='cagarbudaya'), path('editlakes', views.editpointlk, name='editlakes'),
path('edit-point-kantor', views.editkantoradmin, name='kantor'), path('editpks', views.editpointpks, name='editpks'),
path('edit-point-puskesmas', views.editpuskesmas, name='puskesmas'), path('editrs', views.editpointrs, name='editrs'),
path('edit-point-ibadah', views.editibadah, name='ibadah'), path('editsi', views.editpointsi, name='editsi'),
path('edit-point-sekolah', views.editsekolah, name='sekolah'), path('editsp', views.editpointsp, name='editsp'),
path('edit-point-spbu', views.editspbu, name='spbu'), path('editpom', views.editpointspbu, name='editpom'),
path('edit-point-stasiun', views.editstasiun, name='stasiun'), path('editst', views.editpointst, name='editst'),
path('edit-point-terminal', views.editterminal, name='terminal'), path('editgl', views.editpointgl, name='editgl'),
path('edittr', views.editpointtr, name='edittr'),
path('editcb', views.editpointcb, name='editcb'),
path('rumahsakit', views.editrumahsakit, name='rumahsakit'),
path('cagarbudaya', views.editcagarbudaya, name='cagarbudaya'),
path('kantor', views.editkantoradmin, name='kantor'),
path('layanankesehatan', views.editlayanankesehatan, name='layanankesehatan'),
path('puskesmas', views.editpuskesmas, name='puskesmas'),
path('ibadah', views.editibadah, name='ibadah'),
path('sekolah', views.editsekolah, name='sekolah'),
path('spbu', views.editspbu, name='spbu'),
path('stasiun', views.editstasiun, name='stasiun'),
path('terminal', views.editterminal, name='terminal'),
path('gardu', views.editgardu, name='gardu'),
path('edit-tuplah', views.edittuplah, name='tuplah'), path('edit-tuplah', views.edittuplah, name='tuplah'),
path('cobsgambar', views.cobagam, name="coba"), path('cobsgambar', views.cobagam, name="coba"),
......
...@@ -101,6 +101,454 @@ def editpoly(request): ...@@ -101,6 +101,454 @@ def editpoly(request):
return Response(build[0][0]) return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointka(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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_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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointlk(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointpks(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointrs(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointsi(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointsp(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointspbu(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointst(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointgl(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointtr(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
@api_view(('GET',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer))
def editpointcb(request):
if request.method == 'GET':
id_point = request.GET.get("id_point")
with conn.cursor() as buldings:
buldings.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.id = %s"""% int(id_point))
build = buldings.fetchall()
return Response(build[0][0])
import json import json
@api_view(('POST',)) @api_view(('POST',))
@renderer_classes((TemplateHTMLRenderer, JSONRenderer)) @renderer_classes((TemplateHTMLRenderer, JSONRenderer))
...@@ -182,22 +630,35 @@ def editkependudukan(request): ...@@ -182,22 +630,35 @@ def editkependudukan(request):
@api_view(('POST',)) @api_view(('POST',))
def editrumahsakit(request): def editrumahsakit(request):
idrs = request.POST.get('id') idrs = request.POST.get('idrs')
namars = request.POST.get('namars') namars = request.POST.get('namobj')
alamat = request.POST.get('alamat')
remark = request.POST.get('remark') remark = request.POST.get('remark')
luasbangunan = request.POST.get('luasbangunan') luasbangunan = request.POST.get('luasbangunan')
luastanah = request.POST.get('luastanah') luastanah = request.POST.get('luastanah')
tinggibangunan = request.POST.get('tinggibangunan') tinggibangunan = request.POST.get('tinggibangunan')
# gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat')
if alamat is None:
alamat = "alamat"
else:
alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = "bpk"
else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
gambar = request.POST.get('gambar')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_rumah_sakit set namobj = '%s', alamat = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s' where id = %s"""%(namars, alamat, remark, luasbangunan, luastanah, tinggibangunan, perangkat, gambar, idrs)) editrs.execute("""update geo_rumah_sakit set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', alamat = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s' where id = %s"""%(co_edit, namars, alamat, remark, luasbangunan, luastanah, tinggibangunan, perangkat, idrs))
conn.commit() conn.commit()
with conn.cursor() as hasledit: with conn.cursor() as hasledit:
hasledit.execute("select SELECT idrs, namobj, alamat, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, json_build_object('type', 'Feature', 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_rumah_sakit where id = %s"% idrs) hasledit.execute("SELECT id, namobj, alamat, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, json_build_object('type', 'Feature', 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_rumah_sakit where id = %s"% idrs)
hasil_editrs = hasledit.fetchall() hasil_editrs = hasledit.fetchall()
data = hasil_editrs[0] data = hasil_editrs[0]
...@@ -205,7 +666,7 @@ def editrumahsakit(request): ...@@ -205,7 +666,7 @@ def editrumahsakit(request):
@api_view(('POST',)) @api_view(('POST',))
def editcagarbudaya(request): def editcagarbudaya(request):
idcagar = request.POST.get('id') idcagar = request.POST.get('idcb')
namobj = request.POST.get('namobj') namobj = request.POST.get('namobj')
luas = request.POST.get('luas') luas = request.POST.get('luas')
remark = request.POST.get('remark') remark = request.POST.get('remark')
...@@ -232,12 +693,25 @@ def editkantoradmin(request): ...@@ -232,12 +693,25 @@ def editkantoradmin(request):
luas_bangunan = request.POST.get('luasbangunan') luas_bangunan = request.POST.get('luasbangunan')
luat_tanah = request.POST.get('luastanah') luat_tanah = request.POST.get('luastanah')
tinggi_bangunan = request.POST.get('tinggibangunan') tinggi_bangunan = request.POST.get('tinggibangunan')
gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat')
if alamat is None:
alamat = "alamat"
else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = "Bpk"
else:
perangkat = request.POST.get('perangkat')
with conn.cursor() as editrs: point = request.POST.get("point")
editrs.execute("""update geo_kantor_administrasi set namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s', alamat = '%s' where id = %s"""%(namobj, alamat, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, gambar, alamat, idkantor)) cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editka:
editka.execute("""update geo_kantor_administrasi set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = %s, luas_tanah = %s, tinggi_bangunan = %s, perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idkantor))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -247,20 +721,69 @@ def editkantoradmin(request): ...@@ -247,20 +721,69 @@ def editkantoradmin(request):
data = hasileditkantor[0] data = hasileditkantor[0]
return Response(data) return Response(data)
@api_view(('POST',))
def editlayanankesehatan(request):
idlakes = request.POST.get('id')
namobj = request.POST.get('namobj')
remark = request.POST.get('remark')
luas_bangunan = request.POST.get('luasbangunan')
luat_tanah = request.POST.get('luastanah')
tinggi_bangunan = request.POST.get('tinggibangunan')
# gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat')
if alamat is None:
alamat = "alamat"
else:
alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = "bpk"
else:
perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editka:
editka.execute("""update geo_layanan_kesehatan set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = %s, luas_tanah = %s, tinggi_bangunan = %s, perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idlakes))
conn.commit()
with conn.cursor() as hasiledit:
hasiledit.execute("""select namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, alamat from geo_layanan_kesehatan where id = %s"""% idlakes)
hasileditkantor = hasiledit.fetchall()
data = hasileditkantor[0]
return Response(data)
@api_view(('POST',)) @api_view(('POST',))
def editpuskesmas(request): def editpuskesmas(request):
idpus = request.POST.get('id') idpus = request.POST.get('idpus')
namobj = request.POST.get('namobj') namobj = request.POST.get('namobj')
remark = request.POST.get('remark') remark = request.POST.get('remark')
luas_bangunan = request.POST.get('luasbangunan') luas_bangunan = request.POST.get('luasbangunan')
luat_tanah = request.POST.get('luastanah') luat_tanah = request.POST.get('luastanah')
tinggi_bangunan = request.POST.get('tinggibangunan') tinggi_bangunan = request.POST.get('tinggibangunan')
gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None:
alamat = "alamat"
else:
alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = "bpk"
else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_puskesmas set namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s', alamat = '%s' where id = %s"""%(namobj, alamat, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, gambar, alamat, idpus)) editrs.execute("""update geo_puskesmas set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idpus))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -273,18 +796,33 @@ def editpuskesmas(request): ...@@ -273,18 +796,33 @@ def editpuskesmas(request):
@api_view(('POST',)) @api_view(('POST',))
def editibadah(request): def editibadah(request):
idsarib = request.POST.get('id') idsarib = request.POST.get('idsi')
namobj = request.POST.get('namobj') namobj = request.POST.get('namobj')
remark = request.POST.get('remark') remark = request.POST.get('remark')
luas_bangunan = request.POST.get('luasbangunan') luas_bangunan = request.POST.get('luasbangunan')
luat_tanah = request.POST.get('luastanah') luat_tanah = request.POST.get('luastanah')
tinggi_bangunan = request.POST.get('tinggibangunan') tinggi_bangunan = request.POST.get('tinggibangunan')
gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat')
alamat = request.POST.get('alamat')
if alamat is None:
alamat = "alamat"
else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = "bpk"
else:
perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_sarana_ibadah set namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s', alamat = '%s' where id = %s"""%(namobj, alamat, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, gambar, alamat, idsarib)) editrs.execute("""update geo_sarana_ibadah set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idsarib))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -298,18 +836,31 @@ def editibadah(request): ...@@ -298,18 +836,31 @@ def editibadah(request):
@api_view(('POST',)) @api_view(('POST',))
def editsekolah(request): def editsekolah(request):
idsekolah = request.POST.get('id') idsekolah = request.POST.get('idsp')
namobj = request.POST.get('namobj') namobj = request.POST.get('namobj')
remark = request.POST.get('remark') remark = request.POST.get('remark')
luas_bangunan = request.POST.get('luasbangunan') luas_bangunan = request.POST.get('luasbangunan')
luat_tanah = request.POST.get('luastanah') luat_tanah = request.POST.get('luastanah')
tinggi_bangunan = request.POST.get('tinggibangunan') tinggi_bangunan = request.POST.get('tinggibangunan')
gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None:
alamat = "alamat"
else:
alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = "bpk"
else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_sarana_ibadah set namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s', alamat = '%s' where id = %s"""%(namobj, alamat, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, gambar, alamat, idsekolah)) editrs.execute("""update geo_sarana_pendidikan set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idsekolah))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
...@@ -321,25 +872,37 @@ def editsekolah(request): ...@@ -321,25 +872,37 @@ def editsekolah(request):
data = {'sukses':'sukses'} data = {'sukses':'sukses'}
return Response(data) return Response(data)
@api_view(('POST',)) @api_view(('POST',))
def editspbu(request): def editspbu(request):
idspbu = request.POST.get('id') idspbu = request.POST.get('idspbu')
namobj = request.POST.get('namobj') namobj = request.POST.get('namobj')
remark = request.POST.get('remark') remark = request.POST.get('remark')
luas_bangunan = request.POST.get('luasbangunan') luas_bangunan = request.POST.get('luasbangunan')
luat_tanah = request.POST.get('luastanah') luat_tanah = request.POST.get('luastanah')
tinggi_bangunan = request.POST.get('tinggibangunan') tinggi_bangunan = request.POST.get('tinggibangunan')
gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat')
if alamat is None:
alamat = 'alamat'
else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = 'bpk'
else:
perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_kantor_administrasi set namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s', alamat = '%s' where id = %s"""%(namobj, alamat, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, gambar, alamat, idspbu)) editrs.execute("""update geo_spbu set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idspbu))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
hasiledit.execute("""select namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, alamat from geo_kantor_administrasi where id = %s"""% idspbu) hasiledit.execute("""select namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, alamat from geo_spbu where id = %s"""% idspbu)
hasileditkantor = hasiledit.fetchall() hasileditkantor = hasiledit.fetchall()
data = hasileditkantor[0] data = hasileditkantor[0]
...@@ -348,22 +911,35 @@ def editspbu(request): ...@@ -348,22 +911,35 @@ def editspbu(request):
@api_view(('POST',)) @api_view(('POST',))
def editstasiun(request): def editstasiun(request):
idstasiun = request.POST.get('id') idstasiun = request.POST.get('idst')
namobj = request.POST.get('namobj') namobj = request.POST.get('namobj')
remark = request.POST.get('remark') remark = request.POST.get('remark')
luas_bangunan = request.POST.get('luasbangunan') luas_bangunan = request.POST.get('luasbangunan')
luat_tanah = request.POST.get('luastanah') luat_tanah = request.POST.get('luastanah')
tinggi_bangunan = request.POST.get('tinggibangunan') tinggi_bangunan = request.POST.get('tinggibangunan')
gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat')
if alamat is None:
alamat = 'alamat'
else:
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = 'bpk'
else:
perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_kantor_administrasi set namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s', alamat = '%s' where id = %s"""%(namobj, alamat, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, gambar, alamat, idstasiun)) editrs.execute("""update geo_stasiun set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idstasiun))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
hasiledit.execute("""select namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, alamat from geo_kantor_administrasi where id = %s"""% idstasiun) hasiledit.execute("""select namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, alamat from geo_stasiun where id = %s"""% idstasiun)
hasileditkantor = hasiledit.fetchall() hasileditkantor = hasiledit.fetchall()
data = hasileditkantor[0] data = hasileditkantor[0]
...@@ -372,22 +948,70 @@ def editstasiun(request): ...@@ -372,22 +948,70 @@ def editstasiun(request):
@api_view(('POST',)) @api_view(('POST',))
def editterminal(request): def editterminal(request):
idterm = request.POST.get('id') idterm = request.POST.get('idtr')
namobj = request.POST.get('namobj')
remark = request.POST.get('remark')
luas = request.POST.get('luas')
# gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat')
if alamat is None:
alamat = 'alamat'
else:
alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = 'bpk'
else:
perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editrs:
editrs.execute("""update geo_terminal_bus set namobj = '%s', remark = '%s', luas = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(namobj, remark, luas, perangkat, alamat, idterm))
conn.commit()
with conn.cursor() as hasiledit:
hasiledit.execute("""select namobj, remark, luas, perangkat, gambar, alamat from geo_terminal_bus where id = %s"""% idterm)
hasileditkantor = hasiledit.fetchall()
data = hasileditkantor[0]
return Response(data)
@api_view(('POST',))
def editgardu(request):
idgardu = request.POST.get('idgl')
namobj = request.POST.get('namobj') namobj = request.POST.get('namobj')
remark = request.POST.get('remark') remark = request.POST.get('remark')
luas_bangunan = request.POST.get('luasbangunan') luas_bangunan = request.POST.get('luasbangunan')
luat_tanah = request.POST.get('luastanah') luat_tanah = request.POST.get('luastanah')
tinggi_bangunan = request.POST.get('tinggibangunan') tinggi_bangunan = request.POST.get('tinggibangunan')
gambar = request.POST.get('gambar') # gambar = request.POST.get('gambar')
alamat = request.POST.get('alamat') alamat = request.POST.get('alamat')
if alamat is None:
alamat = 'alamat'
else:
alamat = request.POST.get('alamat')
perangkat = request.POST.get('perangkat')
if perangkat is None:
perangkat = 'bpk'
else:
perangkat = request.POST.get('perangkat') perangkat = request.POST.get('perangkat')
point = request.POST.get("point")
cood_edit = json.loads(point)
co_edit = cood_edit['geometry']['coordinates']
with conn.cursor() as editrs: with conn.cursor() as editrs:
editrs.execute("""update geo_kantor_administrasi set namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', gambar = '%s', alamat = '%s' where id = %s"""%(namobj, alamat, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, gambar, alamat, idterm)) editrs.execute("""update geo_gardu_listrik set geom = st_geomfromgeojson('{"type":"Point", "coordinates":%s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '%s', remark = '%s', luas_bangunan = '%s', luas_tanah = '%s', tinggi_bangunan = '%s', perangkat = '%s', alamat = '%s' where id = %s"""%(co_edit, namobj, remark, luas_bangunan, luat_tanah, tinggi_bangunan, perangkat, alamat, idgardu))
conn.commit() conn.commit()
with conn.cursor() as hasiledit: with conn.cursor() as hasiledit:
hasiledit.execute("""select namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, alamat from geo_kantor_administrasi where id = %s"""% idterm) hasiledit.execute("""select namobj, remark, luas_bangunan, luas_tanah, tinggi_bangunan, perangkat, gambar, alamat from geo_gardu_listrik where id = %s"""% idgardu)
hasileditkantor = hasiledit.fetchall() hasileditkantor = hasiledit.fetchall()
data = hasileditkantor[0] data = hasileditkantor[0]
......
...@@ -58,7 +58,8 @@ class Dashboard(generic.TemplateView): ...@@ -58,7 +58,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -94,7 +95,8 @@ class Dashboard(generic.TemplateView): ...@@ -94,7 +95,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -132,7 +134,8 @@ class Dashboard(generic.TemplateView): ...@@ -132,7 +134,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -169,7 +172,8 @@ class Dashboard(generic.TemplateView): ...@@ -169,7 +172,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -206,7 +210,8 @@ class Dashboard(generic.TemplateView): ...@@ -206,7 +210,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -245,7 +250,8 @@ class Dashboard(generic.TemplateView): ...@@ -245,7 +250,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -284,7 +290,8 @@ class Dashboard(generic.TemplateView): ...@@ -284,7 +290,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -321,7 +328,8 @@ class Dashboard(generic.TemplateView): ...@@ -321,7 +328,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -359,7 +367,8 @@ class Dashboard(generic.TemplateView): ...@@ -359,7 +367,8 @@ class Dashboard(generic.TemplateView):
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa, d.desa,
a.luas a.luas,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -392,7 +401,8 @@ class Dashboard(generic.TemplateView): ...@@ -392,7 +401,8 @@ class Dashboard(generic.TemplateView):
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa, d.desa,
a.luas a.luas,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
...@@ -429,7 +439,8 @@ class Dashboard(generic.TemplateView): ...@@ -429,7 +439,8 @@ class Dashboard(generic.TemplateView):
A.tipe_gambar, A.tipe_gambar,
b.kabupaten, b.kabupaten,
c.kecamatan, c.kecamatan,
d.desa d.desa,
a.id
), ),
'geometry', 'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json ST_AsGeoJSON ( A.geom :: geometry ) :: json
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
</div> </div>
</div> </div>
</div> </div>
{% include 'includes/js-m.html' %}
<div class="modal fade" id="modal_delete_1" tabindex="+1" role="dialog"> <div class="modal fade" id="modal_delete_1" tabindex="+1" role="dialog">
<div class="modal-dialog modal-md"> <div class="modal-dialog modal-md">
<div class="modal-content"> <div class="modal-content">
......
...@@ -66,6 +66,9 @@ ...@@ -66,6 +66,9 @@
.leaflet-draw-section { .leaflet-draw-section {
display: none; display: none;
} }
.modal-backdrop {
z-index: -999!important;
}
.geocoder-control { .geocoder-control {
margin: auto; margin: auto;
...@@ -183,6 +186,8 @@ ...@@ -183,6 +186,8 @@
<script src="https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.js" charset="utf-8"></script> <script src="https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.js" charset="utf-8"></script>
<!-- <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> -->
<!-- CSS Files --> <!-- CSS Files -->
<link href="{% static 'css/plugin.css'%}" rel="stylesheet" /> <link href="{% static 'css/plugin.css'%}" rel="stylesheet" />
<!-- CSS Just for demo purpose, don't include it in your project --> <!-- CSS Just for demo purpose, don't include it in your project -->
...@@ -329,7 +334,6 @@ ...@@ -329,7 +334,6 @@
<script type="text/javascript" src="{% static 'js/plugins/ui/moment/moment.min.js' %}"></script> <script type="text/javascript" src="{% static 'js/plugins/ui/moment/moment.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/plugins/pickers/daterangepicker.js' %}"></script> <script type="text/javascript" src="{% static 'js/plugins/pickers/daterangepicker.js' %}"></script>
{% include 'includes/scripts.html' %} {% include 'includes/scripts.html' %}
<script type="text/javascript" src="{% static 'js/plugins/ui/ripple.min.js' %}"></script> <script type="text/javascript" src="{% static 'js/plugins/ui/ripple.min.js' %}"></script>
<!-- /theme JS files --> <!-- /theme JS files -->
......
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