Commit 96f254b9 authored by Manggar Mahardhika's avatar Manggar Mahardhika

push

parent 1dc705f3
...@@ -48,6 +48,7 @@ urlpatterns = [ ...@@ -48,6 +48,7 @@ urlpatterns = [
path('dkantor', views.deletekantoradmin, name='dkantor'), path('dkantor', views.deletekantoradmin, name='dkantor'),
path('change-tipe', views.changetipe, name='change-tipe'), path('change-tipe', views.changetipe, name='change-tipe'),
path('change-jenis', views.changejenis, name='change-jenis'),
path('c_bangunan', views.createbang, name='c_bangunan'), path('c_bangunan', views.createbang, name='c_bangunan'),
path('create-jalan', views.createjalan, name='create-jalan'), path('create-jalan', views.createjalan, name='create-jalan'),
......
...@@ -82,7 +82,7 @@ def building(request): ...@@ -82,7 +82,7 @@ def building(request):
# kulon lor, wetan lor, wetan kidul, kulon kidul, kulon lor # kulon lor, wetan lor, wetan kidul, kulon kidul, kulon lor
with conn.cursor() as buldings: with conn.cursor() as buldings:
buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE st_intersects(geom,'SRID=0;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))')"% (kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor)) buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik, db_tipe, remark, point_id, point_name), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE st_intersects(geom,'SRID=0;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))')"% (kulon, lor, wetan, lor, wetan, kidul, kulon, kidul, kulon, lor))
prov_res = buldings.fetchall() prov_res = buldings.fetchall()
polbang = [] polbang = []
...@@ -193,7 +193,7 @@ def editpoly(request): ...@@ -193,7 +193,7 @@ def editpoly(request):
if request.method == 'GET': if request.method == 'GET':
id_poly = request.GET.get("id_poly") id_poly = request.GET.get("id_poly")
with conn.cursor() as buldings: with conn.cursor() as buldings:
buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information, 'osm'), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE id = %s"% int(id_poly)) buldings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information, 'osm'), 'administrasi',(address_1, address_2, address_3, provinsi, alamat, luas_bangunan, luas_tanah, tinggi_bangunan, gambar, pemilik, db_tipe, remark, point_id), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_bangunan WHERE id = %s"% int(id_poly))
build = buldings.fetchall() build = buldings.fetchall()
return Response(build[0][0]) return Response(build[0][0])
...@@ -1512,6 +1512,9 @@ def createbang(request): ...@@ -1512,6 +1512,9 @@ def createbang(request):
po_create = p_create.replace(', ','],[') po_create = p_create.replace(', ','],[')
name = request.GET.get('name') name = request.GET.get('name')
tipedb = request.GET.get('tipedb')
poin = request.GET.get('poin')
remark = request.GET.get('remark')
info = request.GET.get('info') info = request.GET.get('info')
atalam = request.GET.get('alamat') atalam = request.GET.get('alamat')
lb = request.GET.get('lb') lb = request.GET.get('lb')
...@@ -1545,7 +1548,20 @@ def createbang(request): ...@@ -1545,7 +1548,20 @@ def createbang(request):
else: else:
lt = lt lt = lt
if tipedb == "":
tdb = "bangunan"
else:
tdb = tipedb
if poin == "":
pointopeto = 0
else:
pointopeto = poin
if remark == "":
rem = "bangunan"
else:
rem = remark
if atalam == "": if atalam == "":
alamat = "None" alamat = "None"
...@@ -1573,7 +1589,6 @@ def createbang(request): ...@@ -1573,7 +1589,6 @@ def createbang(request):
ltb = ltbang ltb = ltbang
except: except:
ltb = 0 ltb = 0
print(ltb)
if kilimep == "": if kilimep == "":
pemilik = "unnamed" pemilik = "unnamed"
else: else:
...@@ -1581,7 +1596,6 @@ def createbang(request): ...@@ -1581,7 +1596,6 @@ def createbang(request):
print(pemilik) print(pemilik)
# try: # try:
with conn.cursor() as kel: with conn.cursor() as kel:
kel.execute("SELECT desa, kecamatan, kab_kota, provinsi FROM geo_data_kelurahan WHERE st_intersects(geom, 'SRID=4326;POINT(%s)'::geometry)"% latlng) kel.execute("SELECT desa, kecamatan, kab_kota, provinsi FROM geo_data_kelurahan WHERE st_intersects(geom, 'SRID=4326;POINT(%s)'::geometry)"% latlng)
...@@ -1590,7 +1604,7 @@ def createbang(request): ...@@ -1590,7 +1604,7 @@ def createbang(request):
administrasi = adm[0] administrasi = adm[0]
with conn.cursor() as buldings: with conn.cursor() as buldings:
buldings.execute("""INSERT INTO geo_bangunan(geom, name, information, sumber, alamat, address_1, address_2, address_3, provinsi, no, luas_bangunan, luas_tanah, tinggi_bangunan, lantai, gambar, pemilik) VALUES (ST_GeomFromEWKT('SRID=0;MULTIPOLYGON(((%s)))'), '%s', '%s', 'new', '%s', '%s', '%s', '%s', '%s', '0', '%s', '%s', '%s', '%s', '%s', '%s')"""% (p_create, name, info, alamat, administrasi[0], administrasi[1], administrasi[2], administrasi[3], lb, lt, tb, ltb, namafile, pemilik )) buldings.execute("""INSERT INTO geo_bangunan(geom, name, information, sumber, alamat, address_1, address_2, address_3, provinsi, no, luas_bangunan, luas_tanah, tinggi_bangunan, lantai, gambar, pemilik, point_id, type_id, remark, db_tipe) VALUES (ST_GeomFromEWKT('SRID=0;MULTIPOLYGON(((%s)))'), '%s', '%s', 'new', '%s', '%s', '%s', '%s', '%s', '0', '%s', '%s', '%s', '%s', '%s', '%s', %s, '1', '%s', '%s')"""% (p_create, name, info, alamat, administrasi[0], administrasi[1], administrasi[2], administrasi[3], lb, lt, tb, ltb, namafile, pemilik, pointopeto, rem, tdb ))
conn.commit() conn.commit()
data = {'status':'Success'} data = {'status':'Success'}
...@@ -1678,12 +1692,15 @@ def createjalan(request): ...@@ -1678,12 +1692,15 @@ def createjalan(request):
def changetipe(request): def changetipe(request):
tipe_point = request.GET.get('tipe') tipe_point = request.GET.get('tipe')
if tipe_point == 'administrasi': if tipe_point == 'bangunan':
tipepoint = [['Rumah'],['Ruko'],['Pabrik'],['Pasar/Swalayan']]
if tipe_point == 'kantor_administrasi':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_kantor_administrasi""") point.execute("""SELECT DISTINCT remark FROM geo_kantor_administrasi""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'layanankesehatan': if tipe_point == 'layanan_kesehatan':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_layanan_kesehatan""") point.execute("""SELECT DISTINCT remark FROM geo_layanan_kesehatan""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
...@@ -1693,22 +1710,22 @@ def changetipe(request): ...@@ -1693,22 +1710,22 @@ def changetipe(request):
point.execute("""SELECT DISTINCT remark FROM geo_puskesmas""") point.execute("""SELECT DISTINCT remark FROM geo_puskesmas""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'rumahsakit': if tipe_point == 'rumah_sakit':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_rumah_sakit""") point.execute("""SELECT DISTINCT remark FROM geo_rumah_sakit""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'saranaibadah': if tipe_point == 'sarana_ibadah':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_sarana_ibadah""") point.execute("""SELECT DISTINCT remark FROM geo_sarana_ibadah""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'saranapendidikan': if tipe_point == 'sarana_pendidikan':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_sarana_pendidikan""") point.execute("""SELECT DISTINCT remark FROM geo_sarana_pendidikan""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'cagarbudaya': if tipe_point == 'cagar_budaya':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_cagar_budaya""") point.execute("""SELECT DISTINCT remark FROM geo_cagar_budaya""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
...@@ -1723,12 +1740,12 @@ def changetipe(request): ...@@ -1723,12 +1740,12 @@ def changetipe(request):
point.execute("""SELECT DISTINCT remark FROM geo_stasiun""") point.execute("""SELECT DISTINCT remark FROM geo_stasiun""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'terminalbus': if tipe_point == 'terminal_bus':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_terminal_bus""") point.execute("""SELECT DISTINCT remark FROM geo_terminal_bus""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
if tipe_point == 'gardulistrik': if tipe_point == 'gardu_listrik':
with conn.cursor() as point: with conn.cursor() as point:
point.execute("""SELECT DISTINCT remark FROM geo_gardu_listrik""") point.execute("""SELECT DISTINCT remark FROM geo_gardu_listrik""")
tipepoint = point.fetchall() tipepoint = point.fetchall()
...@@ -1736,6 +1753,19 @@ def changetipe(request): ...@@ -1736,6 +1753,19 @@ def changetipe(request):
respon = {'result':tipepoint} respon = {'result':tipepoint}
return Response(respon) return Response(respon)
@api_view(('GET',))
def changejenis(request):
tipe_point = request.GET.get('tipe')
jenis_point = request.GET.get('jenis')
if tipe_point == 'bangunan':
tipepoint1 = [['0','-']]
else:
with conn.cursor() as point:
point.execute("""SELECT id, namobj FROM geo_%s where remark = '%s'"""% (tipe_point, jenis_point))
tipepoint1 = point.fetchall()
respon = {'result':tipepoint1}
return Response(respon)
@api_view(('POST',)) @api_view(('POST',))
def createpoint(request): def createpoint(request):
gambar = request.FILES.get('gambar') gambar = request.FILES.get('gambar')
......
This diff is collapsed.
This diff is collapsed.
...@@ -476,17 +476,17 @@ ...@@ -476,17 +476,17 @@
<div class="col-lg-9"> <div class="col-lg-9">
<select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="tipe_point" data-placeholder="select point.." class="select-size-md"> <select style="border-bottom: 1px solid rgb(83, 83, 83) !important;" id="tipe_point" data-placeholder="select point.." class="select-size-md">
<option value="null" selected disabled>-- Pilih Jenis Point --</option> <option value="null" selected disabled>-- Pilih Jenis Point --</option>
<option value="administrasi">Kantor Administrasi</option> <option value="kantor_administrasi">Kantor Administrasi</option>
<option value="layanankesehatan">Layanan Kesehatan</option> <option value="layanan_kesehatan">Layanan Kesehatan</option>
<option value="puskesmas">Puskesmas</option> <option value="puskesmas">Puskesmas</option>
<option value="rumahsakit">Rumah Sakit</option> <option value="rumah_sakit">Rumah Sakit</option>
<option value="saranaibadah">Sarana Ibadah</option> <option value="sarana_ibadah">Sarana Ibadah</option>
<option value="saranapendidikan">Sarana Pendidikan</option> <option value="sarana_pendidikan">Sarana Pendidikan</option>
<option value="spbu">SPBU</option> <option value="spbu">SPBU</option>
<option value="stasiun">Stasiun</option> <option value="stasiun">Stasiun</option>
<option value="terminalbus">Terminal Bus</option> <option value="terminal_bus">Terminal Bus</option>
<option value="cagarbudaya">Cagar Budaya dan Tempat Wisata</option> <option value="cagar_budaya">Cagar Budaya dan Tempat Wisata</option>
<option value="gardulistrik">Gardu Listrik</option> <option value="gardu_listrik">Gardu Listrik</option>
</select> </select>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment