Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

// Main Script SHP to PTSL JSON

// WAJIB ADA: Kolom LUAS (Ceil Upper 0 angka di belakang koma), Kolom NUB

import os.path

arcpy.env.workspace = 'database'
fc='D:/KALBAR 2021/SANGGAU/02_KEBADU/MASTER_KEBADU/KEBADU FIX/TEST_WGS.shp'
cursor=arcpy.da.SearchCursor(fc, ["OID@","SHAPE@","LUAS","GU"])
with open('result.txt', 'w') as output:
for row in cursor: #iterate the rows in the table
if(os.path.exists('D:/KALBAR
2021/SANGGAU/02_KEBADU/MASTER_KEBADU/KEBADU FIX/'+row[3]+'.json')):
f=open('D:/KALBAR 2021/SANGGAU/02_KEBADU/MASTER_KEBADU/KEBADU
FIX/'+row[3]+'.json','a')
else:
if "f" in locals():
f.write("]")
f=open('D:/KALBAR 2021/SANGGAU/02_KEBADU/MASTER_KEBADU/KEBADU
FIX/'+row[3]+'.json','w')
f.write("[\n")

f.write("{\"Alamat\":\"-\",\"Penggunaan\":\"-\",\"Luas\":\""+str(int(row[2]))
+"\",\"StatusHak\":\"-\",\"StatusSengketa\":\"-\",\"StatusPerkara\":\"-\",\"StatusP
embebanan\":\"-\",\"BatasBidang\":\"{\\\"type\\\":\\\"Polygon\\\",\\\"coordinates\\
\":[[")
for point in row[1].getPart(0):
f.write("[{0},{1}],".format(point.X, point.Y))
f.write("]]}\"},\n")

// Main Script SHP to PTSL JSON


// WAJIB ADA: Kolom LUAS (Ceil Upper 0 angka di belakang koma), Kolom NUB

import math

def x(a):
return math.ceil(a)

x(!area!)

You might also like