Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OKU-GIS
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhamad
OKU-GIS
Commits
0ee76cde
Commit
0ee76cde
authored
Oct 17, 2021
by
Manggar Mahardhika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push fix search point
parent
b0cc89be
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
583 additions
and
107 deletions
+583
-107
API/urls.py
API/urls.py
+4
-0
API/views.py
API/views.py
+105
-1
templates/includes/js-m.html
templates/includes/js-m.html
+2
-1
templates/includes/js-o.html
templates/includes/js-o.html
+89
-77
templates/includes/modal.html
templates/includes/modal.html
+9
-2
templates/layout/layout.html
templates/layout/layout.html
+374
-26
No files found.
API/urls.py
View file @
0ee76cde
...
...
@@ -21,6 +21,9 @@ urlpatterns = [
path
(
'editkependudukan/'
,
views
.
editkependudukan
,
name
=
'kependudukan'
),
path
(
'valideditkependudukan'
,
views
.
valideditkependudukan
,
name
=
'valideditkependudukan'
),
path
(
'editspo'
,
views
.
editpointsearch
,
name
=
'editspo'
),
path
(
'editkantor'
,
views
.
editpointka
,
name
=
'editkantor'
),
path
(
'editlakes'
,
views
.
editpointlk
,
name
=
'editlakes'
),
path
(
'editpks'
,
views
.
editpointpks
,
name
=
'editpks'
),
...
...
@@ -33,6 +36,7 @@ urlpatterns = [
path
(
'edittr'
,
views
.
editpointtr
,
name
=
'edittr'
),
path
(
'editcb'
,
views
.
editpointcb
,
name
=
'editcb'
),
path
(
'saveeditspo'
,
views
.
editsearchpoint
,
name
=
'saveeditspo'
),
path
(
'rumahsakit'
,
views
.
editrumahsakit
,
name
=
'rumahsakit'
),
path
(
'cagarbudaya'
,
views
.
editcagarbudaya
,
name
=
'cagarbudaya'
),
path
(
'kantor'
,
views
.
editkantoradmin
,
name
=
'kantor'
),
...
...
API/views.py
View file @
0ee76cde
...
...
@@ -272,6 +272,50 @@ def editpoly(request):
return
Response
(
build
[
0
][
0
])
@
api_view
((
'GET'
,))
@
renderer_classes
((
TemplateHTMLRenderer
,
JSONRenderer
))
def
editpointsearch
(
request
):
if
request
.
method
==
'GET'
:
id_point
=
request
.
GET
.
get
(
"id_point"
)
db_point
=
request
.
GET
.
get
(
"db_point"
)
if
(
db_point
==
"geo_cagar_budaya"
or
db_point
==
"geo_terminal_bus"
):
l
=
"a.luas"
else
:
l
=
"a.luas_tanah"
print
(
id_point
,
db_point
,
l
)
with
conn
.
cursor
()
as
buldings
:
buldings
.
execute
(
"""SELECT
json_build_object (
'type',
'Feature',
'administrasi',
(
a.id,
A.namobj,
A.remark,
A.alamat,
A.gambar,
A.perangkat,
A.tipe_gambar,
b.kabupaten,
c.kecamatan,
d.desa,
%
s
),
'geometry',
ST_AsGeoJSON ( A.geom :: geometry ) :: json
)
FROM
%
s 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 and a.id =
%
s"""
%
(
l
,
db_point
,
int
(
id_point
)))
build
=
buldings
.
fetchall
()
return
Response
(
build
[
0
][
0
])
@
api_view
((
'GET'
,))
@
renderer_classes
((
TemplateHTMLRenderer
,
JSONRenderer
))
def
editpointka
(
request
):
...
...
@@ -1644,7 +1688,67 @@ def valideditkependudukan(request):
data
=
data_kependuduk
[
0
]
return
Response
(
respon
)
@
api_view
((
'POST'
,))
def
editsearchpoint
(
request
):
idsave
=
request
.
POST
.
get
(
'idspo'
)
dbsave
=
request
.
POST
.
get
(
'dbspo'
)
namobj
=
request
.
POST
.
get
(
'namobj'
)
luas
=
request
.
POST
.
get
(
'luas'
)
remark
=
request
.
POST
.
get
(
'remark'
)
gambar
=
request
.
POST
.
get
(
'gambar'
)
alamat
=
request
.
POST
.
get
(
'alamat'
)
if
(
dbsave
==
"geo_cagar_budaya"
or
dbsave
==
"geo_terminal_bus"
):
l
=
"luas"
else
:
l
=
"luas_tanah"
if
alamat
is
None
:
alamat
=
'alamat'
elif
alamat
==
''
:
alamat
=
'alamat'
else
:
alamat
=
request
.
POST
.
get
(
'alamat'
)
perangkat
=
request
.
POST
.
get
(
'perangkat'
)
if
perangkat
is
None
:
perangkat
=
'bpk'
elif
perangkat
==
''
:
perangkat
=
'bpk'
else
:
perangkat
=
request
.
POST
.
get
(
'perangkat'
)
point
=
request
.
POST
.
get
(
"point"
)
cood_edit
=
json
.
loads
(
point
)
co_edit
=
cood_edit
[
'geometry'
][
'coordinates'
]
file
=
request
.
FILES
.
get
(
'file'
)
fss
=
FileSystemStorage
(
location
=
'/var/www/django/oku.khansia.co.id/static/img/image/'
)
try
:
format
=
(
file
.
name
)
.
split
(
"."
)
num
=
random
.
randrange
(
1
,
10000000000000
)
namafile
=
f
"{namobj}_{num}.{format[-1:][0]}"
filename
=
fss
.
save
(
namafile
,
file
)
# print(file.name)
url
=
fss
.
url
(
filename
)
except
:
namafile
=
gambar
print
(
dbsave
,
co_edit
,
namobj
,
alamat
,
remark
,
l
,
luas
,
perangkat
,
namafile
,
idsave
)
with
conn
.
cursor
()
as
editspo
:
editspo
.
execute
(
"""update
%
s set geom = st_geomfromgeojson('{"type":"Point", "coordinates":
%
s, "crs":{"type":"name","properties":{"name":"EPSG:4326"}}}'), namobj = '
%
s', alamat = '
%
s', remark = '
%
s',
%
s = '
%
s', perangkat = '
%
s', gambar = '
%
s' where id =
%
s"""
%
(
dbsave
,
co_edit
,
namobj
,
alamat
,
remark
,
l
,
luas
,
perangkat
,
namafile
,
idsave
))
conn
.
commit
()
with
conn
.
cursor
()
as
hasiledit
:
hasiledit
.
execute
(
"""select namobj, alamat, remark,
%
s, gambar, perangkat from
%
s where id =
%
s"""
%
(
l
,
dbsave
,
idsave
))
hasileditspo
=
hasiledit
.
fetchall
()
data
=
hasileditspo
[
0
]
data
=
{
'status'
:
'Success'
}
data
=
'SUCCESS'
info
=
'data telah diperbaharui'
status
=
0
respon
=
{
'data'
:
data
,
'info'
:
info
,
'status'
:
status
}
return
Response
(
respon
)
@
api_view
((
'POST'
,))
def
editrumahsakit
(
request
):
...
...
templates/includes/js-m.html
View file @
0ee76cde
...
...
@@ -4448,6 +4448,7 @@
var
gardu_listrik
=
"
{{ gardu_listrik }}
"
.
replace
(
/'/g
,
'
"
'
);
var
result_gardu_listrik
=
JSON
.
parse
(
""
+
gardu_listrik
+
""
)
console
.
log
(
result_gardu_listrik
)
var
geo_po_gardu_listrik
=
L
.
geoJson
(
null
,
{
pointToLayer
:
function
(
feature
,
latlng
)
{
...
...
@@ -8023,7 +8024,7 @@
var
map_bang
=
new
L
.
map
(
'
map-insert-renov-bang
'
,
{
editable
:
false
,
zoomControl
:
false
,
drawControl
:
tru
e
drawControl
:
fals
e
}).
setView
([
-
2
,
118
],
5
);
mapssx
=
L
.
tileLayer
(
'
https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}
'
,
{
...
...
templates/includes/js-o.html
View file @
0ee76cde
...
...
@@ -1313,6 +1313,18 @@
polygon_edit_tuplah
=
L
.
polygon
(
list_poly_edit
).
addTo
(
map_edit_tuplah
)
polygon_edit_tuplah
.
enableEdit
();
$
(
'
#btn_ceklwas
'
).
click
(
function
()
{
var
hasil
=
(
JSON
.
stringify
(
polygon_edit_tuplah
.
toGeoJSON
()))
var
seeArea
=
L
.
GeometryUtil
.
geodesicArea
(
polygon_edit_tuplah
.
getLatLngs
()[
0
]);
var
fixarea
=
seeArea
.
toFixed
(
3
)
var
separ
=
fixarea
.
toString
().
split
(
"
.
"
);
var
areacom
=
separ
.
replace
(
/
\B(?=(\d{3})
+
(?!\d))
/g
,
"
,
"
);
separ
.
join
(
"
.
"
);
$
(
"
#luas_tuplah_edit
"
).
val
(
fixarea
);
})
$
(
'
#btnsavetuplah
'
).
click
(
function
()
{
var
hasil
=
(
JSON
.
stringify
(
polygon_edit_tuplah
.
toGeoJSON
()))
$
(
"
#coordinatetuplah
"
).
val
(
hasil
);
...
...
@@ -1329,10 +1341,11 @@
}
},
})
});
// $(document).on("click", "#btnsavetuplah", function() {
});
// });
$
(
document
).
on
(
"
click
"
,
"
#btnsavetuplah
"
,
function
()
{
var
id_poly
=
$
(
'
#idtuplah
'
).
val
();
...
...
@@ -3850,6 +3863,53 @@
Poly
=
lay
;
});
$
(
"
#tipe_point_b
"
).
change
(
function
()
{
var
tipe
=
$
(
this
).
val
();
$
.
ajax
({
url
:
"
{% url 'api:change-tipe' %}
"
,
data
:
{
'
tipe
'
:
tipe
},
dataType
:
'
json
'
,
success
:
function
(
data
)
{
var
data_all_kab
=
[]
for
(
var
i
=
0
;
i
<
data
[
'
result
'
].
length
;
i
++
)
{
var
data_k
=
data
[
'
result
'
][
i
][
0
];
console
.
log
(
data_k
)
var
data_kab
=
`<option value="`
+
data_k
+
`">`
+
data_k
+
`</option>`
;
data_all_kab
.
push
(
data_kab
)
};
$
(
'
#tipe_point_2_b
'
).
html
(
`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`
+
data_all_kab
);
$
(
'
#tipe_point_3_b
'
).
html
(
`<option value="null" selected disabled>-- Pilih Point --</option>`
);
}
});
});
$
(
"
#tipe_point_2_b
"
).
change
(
function
()
{
var
jenis
=
$
(
this
).
val
();
var
tipx
=
$
(
"
#tipe_point_b
"
).
val
();
$
.
ajax
({
url
:
"
{% url 'api:change-jenis' %}
"
,
data
:
{
'
tipe
'
:
tipx
,
'
jenis
'
:
jenis
},
dataType
:
'
json
'
,
success
:
function
(
data
)
{
console
.
log
(
data
)
var
data_all_kab
=
[]
for
(
var
i
=
0
;
i
<
data
[
'
result
'
].
length
;
i
++
)
{
var
data_id
=
data
[
'
result
'
][
i
][
0
];
var
data_po
=
data
[
'
result
'
][
i
][
1
];
var
data_kab
=
`<option value="`
+
data_id
+
`">`
+
data_po
+
`</option>`
;
data_all_kab
.
push
(
data_kab
)
};
$
(
'
#tipe_point_3_b
'
).
html
(
`<option value="null" selected disabled>-- Pilih Point --</option>`
+
data_all_kab
);
}
});
});
$
(
"
#map-create-all > div.leaflet-control-container > div.leaflet-top.leaflet-left > div
"
).
css
(
"
display
"
,
"
none
"
)
});
...
...
@@ -4181,6 +4241,33 @@
$
(
"
#modal_point
"
).
modal
()
map
.
closePopup
();
});
$
(
"
#tipe_point
"
).
change
(
function
()
{
var
tipe
=
$
(
this
).
val
();
$
.
ajax
({
url
:
"
{% url 'api:change-tipe' %}
"
,
data
:
{
'
tipe
'
:
tipe
},
dataType
:
'
json
'
,
success
:
function
(
data
)
{
console
.
log
(
data
)
var
data_all_kab
=
[]
for
(
var
i
=
0
;
i
<
data
[
'
result
'
].
length
;
i
++
)
{
var
data_k
=
data
[
'
result
'
][
i
][
0
];
var
data_kab
=
`<option value="`
+
data_k
+
`">`
+
data_k
+
`</option>`
;
data_all_kab
.
push
(
data_kab
)
};
$
(
'
#tipe_point_2
'
).
html
(
`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`
+
data_all_kab
);
}
});
});
$
(
"
#map-create-all > div.leaflet-control-container > div.leaflet-top.leaflet-left > div:nth-child(2) > div > div
"
).
css
(
"
display
"
,
"
none
"
)
$
(
"
#map-create-all > div.leaflet-control-container > div.leaflet-top.leaflet-right
"
).
css
(
"
display
"
,
"
none
"
)
...
...
@@ -4189,81 +4276,6 @@
$
(
"
#map-create-all > div.leaflet-control-container > div.leaflet-top.leaflet-left > div:nth-child(2) > div > div > a.leaflet-draw-draw-marker
"
).
css
(
"
display
"
,
"
block!important
"
)
})
$
(
"
#tipe_point
"
).
change
(
function
()
{
var
tipe
=
$
(
this
).
val
();
$
.
ajax
({
url
:
"
{% url 'api:change-tipe' %}
"
,
data
:
{
'
tipe
'
:
tipe
},
dataType
:
'
json
'
,
success
:
function
(
data
)
{
console
.
log
(
data
)
var
data_all_kab
=
[]
for
(
var
i
=
0
;
i
<
data
[
'
result
'
].
length
;
i
++
)
{
var
data_k
=
data
[
'
result
'
][
i
][
0
];
var
data_kab
=
`<option value="`
+
data_k
+
`">`
+
data_k
+
`</option>`
;
data_all_kab
.
push
(
data_kab
)
};
$
(
'
#tipe_point_2
'
).
html
(
`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`
+
data_all_kab
);
}
});
});
$
(
"
#tipe_point_b
"
).
change
(
function
()
{
var
tipe
=
$
(
this
).
val
();
$
.
ajax
({
url
:
"
{% url 'api:change-tipe' %}
"
,
data
:
{
'
tipe
'
:
tipe
},
dataType
:
'
json
'
,
success
:
function
(
data
)
{
var
data_all_kab
=
[]
for
(
var
i
=
0
;
i
<
data
[
'
result
'
].
length
;
i
++
)
{
var
data_k
=
data
[
'
result
'
][
i
][
0
];
console
.
log
(
data_k
)
var
data_kab
=
`<option value="`
+
data_k
+
`">`
+
data_k
+
`</option>`
;
data_all_kab
.
push
(
data_kab
)
};
$
(
'
#tipe_point_2_b
'
).
html
(
`<option value="null" selected disabled>-- Pilih Tipe Point --</option>`
+
data_all_kab
);
}
});
});
$
(
"
#tipe_point_2_b
"
).
change
(
function
()
{
var
jenis
=
$
(
this
).
val
();
var
tipx
=
$
(
"
#tipe_point_b
"
).
val
();
$
.
ajax
({
url
:
"
{% url 'api:change-jenis' %}
"
,
data
:
{
'
tipe
'
:
tipx
,
'
jenis
'
:
jenis
},
dataType
:
'
json
'
,
success
:
function
(
data
)
{
console
.
log
(
data
)
var
data_all_kab
=
[]
for
(
var
i
=
0
;
i
<
data
[
'
result
'
].
length
;
i
++
)
{
var
data_id
=
data
[
'
result
'
][
i
][
0
];
var
data_po
=
data
[
'
result
'
][
i
][
1
];
var
data_kab
=
`<option value="`
+
data_id
+
`">`
+
data_po
+
`</option>`
;
data_all_kab
.
push
(
data_kab
)
};
$
(
'
#tipe_point_3_b
'
).
html
(
`<option value="null" selected disabled>-- Pilih Point --</option>`
+
data_all_kab
);
}
});
});
});
$
(
document
).
on
(
"
click
"
,
"
#create_save_jalan
"
,
function
(
e
)
{
...
...
templates/includes/modal.html
View file @
0ee76cde
...
...
@@ -298,7 +298,14 @@
Luas
</th>
<td>
<input
id=
"luas_tuplah_edit"
type=
"text"
class=
"form-control"
value=
""
style=
"width:fit-content;"
disabled
>
<input
id=
"luas_tuplah_edit"
type=
"text"
class=
"form-control"
value=
""
disabled
>
</td>
<td>
<button
type=
"submit"
id=
"btn_ceklwas"
class=
"btn btn-primary"
title=
"Check Luas"
style=
"border-radius: 0px 10px 10px 0px;
outline: none;
background: linear-gradient(
201.55deg
, #72BBFF -24.21%, #3D5CCA 130.65%);"
><i
class=
"icon-search4 text-muted text-size-base"
style=
"color: white;"
></i></button>
</td>
</tr>
<tr>
...
...
@@ -645,7 +652,7 @@
<div
class=
"col-md-4 text-center"
>
<a
href=
"#"
class=
"btn btn_create_lahan"
>
<div>
<img
src=
"{% static 'img/icon-1/
Vectorpoint
.svg' %}"
alt=
""
style=
"width: 35px;
<img
src=
"{% static 'img/icon-1/
SquareHalflahan
.svg' %}"
alt=
""
style=
"width: 35px;
height: 35px;"
>
</div>
<div
style=
"margin-top: 10px;"
>
...
...
templates/layout/layout.html
View file @
0ee76cde
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment