Commit 5a8d85e8 authored by Manggar Mahardhika's avatar Manggar Mahardhika

suk

parent b489e4bd
...@@ -10,13 +10,27 @@ class Dashboard(generic.TemplateView): ...@@ -10,13 +10,27 @@ class Dashboard(generic.TemplateView):
# @method_decorator(login_required(login_url='maps:login')) # @method_decorator(login_required(login_url='maps:login'))
def get(self, request): def get(self, request):
with conn.cursor() as prov: with conn.cursor() as kel:
prov.execute("SELECT json_build_object('geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_prov_kab where kabupaten = 'OGAN KOMERING ULU'") kel.execute("SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa),'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),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan")
prov_res = prov.fetchall() kel_res_ = kel.fetchall()
# print(prov_res)
with conn.cursor() as kec:
kec.execute("SELECT kecamatan, json_build_object('type', 'Feature','geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kecamatan")
kec_res_ = kec.fetchall()
kec_res = []
for i in kec_res_:
kec_res.append(i[1])
kel_res = []
for i in kel_res_:
kel_res.append(i[0])
context = { context = {
'title':'NA - Dashboard', 'title':'NA - Dashboard',
'prov_res': prov_res[0]} 'kelurahan':kel_res,
'kecamatan':kec_res,
}
return render (request, self.template_name, context) return render (request, self.template_name, context)
class SearchLocation(generic.TemplateView): class SearchLocation(generic.TemplateView):
...@@ -27,48 +41,7 @@ class SearchLocation(generic.TemplateView): ...@@ -27,48 +41,7 @@ class SearchLocation(generic.TemplateView):
return redirect("apps:dashboard") return redirect("apps:dashboard")
def post(self, request): def post(self, request):
# self.search_kab = request.POST.get('polykab')
# self.search_desa = request.POST.get('polydes')
# batas_desa = []
# with conn.cursor() as poly_k:
# poly_k.execute("SELECT json_build_object('type', 'Feature', 'administrasi',('kode_desa_dagri', kelurahan, kecamatan, kota, provinsi), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from data_desa_new where kelurahan = '%s' and kota = '%s'" % (self.search_desa, self.search_kab))
# poly_des = poly_k.fetchall()
# # print(poly_prov)
# poly_desa = []
# for i in poly_des:
# poly_desa.append(i[0])
# with conn.cursor() as c_buildings:
# c_buildings.execute("select json_build_object('type', 'Feature', 'properties', (buildings.id, buildings.name, 'None', 'None'), 'administrasi',(buildings.address_1, 'undefined', buildings.address_3, buildings.provinsi, 'None'), 'geometry', ST_AsGeoJSON(buildings.geom :: geometry) :: json) from geo_settle_update buildings join data_desa_new desa on st_intersects(desa.geom ,buildings.geom) where desa.kelurahan = '%s' AND desa.kota = '%s'"% (self.search_desa, self.search_kab))
# polygon_buildings = c_buildings.fetchall()
# polbang = []
# for i in polygon_buildings:
# i[0]['properties']['f2'] = i[0]['properties']['f2'].replace("'"," ")
# polbang.append(i[0])
# with conn.cursor() as c_trees:
# c_trees.execute("select json_build_object('type', 'Feature', 'properties', (buildings.id, buildings.name, buildings.information, buildings.sumber), 'administrasi',(buildings.address_1, buildings.address_2, buildings.address_3, buildings.provinsi, buildings.no), 'geometry', ST_AsGeoJSON(buildings.geom :: geometry) :: json) from geom_master buildings join data_desa_new desa on st_intersects(desa.geom ,buildings.geom) where desa.kelurahan = '%s' AND desa.kota = '%s' and buildings.sumber = 'osm'"% (self.search_desa, self.search_kab))
# polygon_trees = c_trees.fetchall()
# poltrees = []
# for i in polygon_trees:
# i[0]['properties']['f2'] = i[0]['properties']['f2'].replace("'"," ")
# i[0]['properties']['f2'] = i[0]['properties']['f2'].replace('"','')
# poltrees.append(i[0])
# with conn.cursor() as jalan:
# jalan.execute("SELECT json_build_object ('type', 'Feature', 'properties', ( jl.id, jl.name ), 'geometry', ST_AsGeoJSON ( st_intersection(d.geom, jl.geom) :: geometry ) :: json ) FROM geo_roads jl JOIN data_desa_new d ON st_intersects ( d.geom, jl.geom ) WHERE d.kelurahan = '%s' AND d.kota = '%s'"% (self.search_desa, self.search_kab))
# data_jalan = jalan.fetchall()
# line_jalan = []
# for i in data_jalan:
# i[0]['properties']['f2'] = i[0]['properties']['f2'].replace("'"," ")
# line_jalan.append(i[0])
# lat, lng, zoom = setview(polbang, poltrees)
return render (request, self.template_name, {"title":"NA - CheckByPolygon"})#,"polbang":polbang,"poltrees":poltrees,'jumlah_bangunan' : len(polbang)+len(poltrees), 'batas_co':batas_desa, 'search_by': 'address', 'address':f'{self.search_desa},{self.search_kab}', 'poly_desa':poly_desa, 'lat':lat, 'lng':lng, 'zoom':zoom, 'line_jalan':line_jalan}) return render (request, self.template_name, {"title":"NA - CheckByPolygon"})#,"polbang":polbang,"poltrees":poltrees,'jumlah_bangunan' : len(polbang)+len(poltrees), 'batas_co':batas_desa, 'search_by': 'address', 'address':f'{self.search_desa},{self.search_kab}', 'poly_desa':poly_desa, 'lat':lat, 'lng':lng, 'zoom':zoom, 'line_jalan':line_jalan})
...@@ -80,26 +53,6 @@ class SearchRadius(generic.TemplateView): ...@@ -80,26 +53,6 @@ class SearchRadius(generic.TemplateView):
return redirect("apps:dashboard") return redirect("apps:dashboard")
def post(self, request): def post(self, request):
# self.latM = request.POST.get('latM')
# self.lonM = request.POST.get('lonM')
# self.radius = request.POST.get('radius')
# zon = ''
# with conn.cursor() as c:
# c.execute("select json_build_object('type', 'Feature', 'properties', (id, name, information, sumber), 'administrasi',(address_1, address_2, address_3, provinsi, no), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geom_master where ST_DWithin ( buildings.geom, 'SRID=4326;POINT(%.10s %.10s)', %s) and sumber = 'gen'" % (self.lonM, self.latM, self.radius))
# # c.execute("SELECT json_build_object ('type', 'Feature', 'properties', ( buildings.id, buildings.name ), 'geometry', ST_AsGeoJSON ( buildings.geom :: geometry ) :: json), json_build_object ('type', 'Feature', 'properties', ( osm.id, osm.name ), 'geometry', ST_AsGeoJSON ( osm.geom :: geometry ) :: json) FROM geo_settle AS buildings JOIN geo_build_osm AS osm ON ST_Intersects(osm.geom,buildings.geom) WHERE ST_DWithin ( buildings.geom, 'SRID=4326;POINT(%.10s %.10s)', %s) AND ST_DWithin ( osm.geom, 'SRID=4326;POINT(%.10s %.10s)', %s) AND osm.is_delete=1 AND buildings.is_delete=1" % (self.lonM, self.latM, self.radius, self.lonM, self.latM, self.radius))
# polygon = c.fetchall()
# polbang = []
# for i in polygon:
# polbang.append(i[0])
# with conn.cursor() as c_trees:
# c_trees.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, name, information, sumber), 'administrasi',(address_1, address_2, address_3, provinsi, no), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geom_master WHERE ST_DWithin(geom, Geography(ST_MakePoint(%.10s, %.10s)), %s) and sumber = 'osm'" % (self.lonM, self.latM, self.radius))
# polygon_trees = c_trees.fetchall()
# poltrees = []
# for i in polygon_trees:
# poltrees.append(i[0])
return render (request, self.template_name, {"title":"NA - CheckByRadius"})#, "polbang":polbang, "poltrees":poltrees, 'jumlah_bangunan' : len(polbang)+len(poltrees), 'batas_co':zon, 'search_by': 'radius', 'address':'None'}) return render (request, self.template_name, {"title":"NA - CheckByRadius"})#, "polbang":polbang, "poltrees":poltrees, 'jumlah_bangunan' : len(polbang)+len(poltrees), 'batas_co':zon, 'search_by': 'radius', 'address':'None'})
...@@ -112,70 +65,5 @@ class SearchPolygon(generic.TemplateView): ...@@ -112,70 +65,5 @@ class SearchPolygon(generic.TemplateView):
return redirect("apps:dashboard") return redirect("apps:dashboard")
def post(self, request): def post(self, request):
# zon = [[[]]]
# self.coordinatZone = request.POST.get('coordinateZone')
# ZoneCo = self.coordinatZone.replace('"','')
# zon = list(ZoneCo.split(","))
# # for i in zon:
# with conn.cursor() as c_trees:
# c_trees.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, 'name', 'information', 'sumber'), 'administrasi',(address_1, address_2, address_3, provinsi, 'no'), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_settle WHERE st_intersects(geom,'SRID=4326;POLYGON((%s))') and sumber = 'osm'"% ZoneCo)
# polygon_trees = c_trees.fetchall()
# polygon_trees_geom = []
# poltrees = []
# nnnn = []
# for i in polygon_trees:
# i[0]['properties']['f2'] = i[0]['properties']['f2'].replace("'"," ")
# poltrees.append(i[0])
# polygon_trees_geom.append(tuple(i[0]['geometry']['coordinates'][0][0]))
# mmm = []
# multip = ""
# for x, y in i[0]['geometry']['coordinates'][0][0]:
# multip += (f'{x} {y}, ')
# mmm.append(multip)
# qqq = []
# zzz = ""
# for xc in mmm:
# zzz += xc[:-2]
# qqq.append(zzz)
# # mnmn = ""
# # cc = []
# # for k in nnn[:-1]:
# # mnmn += k
# # cc.append(k)
# # # nnnn.append(k)
# # listTo = ' '.join([str(elem) for elem in cc])
# # p1 = polystr.replace("[","(")
# # p2 = p1.replace("]",")")
# with conn.cursor() as c_buildings:
# c_buildings.execute("SELECT json_build_object('type', 'Feature', 'properties', (id, 'name', 'information', 'sumber'), 'administrasi',(address_1, address_2, address_3, provinsi, 'no'), 'geometry', ST_AsGeoJSON(geom :: geometry) :: json) FROM geo_settle WHERE st_intersects(geom,'SRID=4326;POLYGON((%s))')"% ZoneCo)
# polygon_buildings = c_buildings.fetchall()
# polbang = []
# for i in polygon_buildings:
# i[0]['properties']['f2'] = i[0]['properties']['f2'].replace("'"," ")
# polbang.append(i[0])
# with conn.cursor() as jalan:
# jalan.execute("""SELECT json_build_object ('type', 'Feature', 'properties', ( id, name ), 'geometry', ST_AsGeoJSON ( st_intersection(geom, 'SRID=4326;POLYGON((%s))') :: geometry ) :: json ) FROM geo_roads WHERE st_intersects(geom,'SRID=4326;POLYGON((%s))')"""% (ZoneCo, ZoneCo))
# data_jalan = jalan.fetchall()
# line_jalan = []
# for i in data_jalan:
# i[0]['properties']['f2'] = i[0]['properties']['f2'].replace("'"," ")
# line_jalan.append(i[0])
# lat, lng, zoom = setview(polbang, poltrees)
return render (request, self.template_name, {"title":"NA - CheckByPolygon"})#,"polbang":polbang,"poltrees":poltrees,'jumlah_bangunan' : len(polbang)+len(poltrees), 'batas_co':zon, 'search_by': 'polygon', 'address':'None', 'lat':lat, 'lng':lng, 'zoom':zoom, 'line_jalan':line_jalan}) return render (request, self.template_name, {"title":"NA - CheckByPolygon"})#,"polbang":polbang,"poltrees":poltrees,'jumlah_bangunan' : len(polbang)+len(poltrees), 'batas_co':zon, 'search_by': 'polygon', 'address':'None', 'lat':lat, 'lng':lng, 'zoom':zoom, 'line_jalan':line_jalan})
...@@ -80,10 +80,10 @@ WSGI_APPLICATION = 'OKU.wsgi.application' ...@@ -80,10 +80,10 @@ WSGI_APPLICATION = 'OKU.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'OKUPROJECT', 'NAME': 'oku_gis_new',
'USER': 'postgres', 'USER': 'postgres',
'PASSWORD' : 'owel1234', 'PASSWORD' : 'khansia215758',
'HOST': 'localhost', 'HOST': '30.10.20.102',
'PORT': '5432', 'PORT': '5432',
} }
} }
......
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[104.326502280857, -4.06486433012394],
[104.325779779015, -4.06586226283232],
[104.324770402433, -4.06642893194884],
[104.324191475557, -4.06824841872875],
[104.322454693131, -4.06899275521071],
[104.321987782211, -4.06970019610635],
[104.321379541933, -4.06940627158136],
[104.320469800342, -4.0698197924486],
[104.319902058334, -4.07081859839882],
[104.318898424823, -4.07130846181522],
[104.318337324309, -4.07239283915737],
[104.317492458911, -4.0726317260725],
[104.316251899906, -4.07197009484323],
[104.3150113427, -4.07238361391182],
[104.314657629447, -4.0737226738615],
[104.314184303664, -4.07428580414577],
[104.314056313949, -4.07482975189075],
[104.313357262828, -4.0747820266684],
[104.313026448113, -4.07503013882908],
[104.311868592563, -4.07436850670044],
[104.310958850072, -4.07445121195304],
[104.309056661637, -4.07560906480566],
[104.308229621701, -4.07651880909498],
[104.308561128894, -4.07742216999636],
[104.308806543088, -4.0780909202589],
[104.308643141669, -4.07924803656683],
[104.308395028609, -4.08048859557142],
[104.308064213893, -4.08181185892933],
[104.308312325155, -4.08280430577323],
[104.308560438215, -4.08371404916328],
[104.310303353118, -4.08477916392642],
[104.311391876335, -4.0854443717595],
[104.311537777847, -4.08553353504382],
[104.312695631599, -4.08611246191976],
[104.313357262828, -4.0869395009564],
[104.31410159931, -4.08751842783235],
[104.314184303664, -4.08842817212158],
[104.314184303664, -4.08885183824092],
[104.314184303664, -4.08917250680489],
[104.31410159931, -4.08991684058892],
[104.315094046154, -4.09157091866219],
[104.316251899906, -4.09190173607547],
[104.317161643296, -4.09330770198806],
[104.317905977979, -4.09421744627729],
[104.318981129177, -4.09504448441455],
[104.319394649145, -4.09545800168458],
[104.31972546386, -4.0963677459739],
[104.320221688181, -4.09686397119455],
[104.320123124284, -4.09698224823134],
[104.319808168213, -4.0973601928179],
[104.319494854305, -4.09790137065093],
[104.318662496678, -4.09933908083313],
[104.317492458911, -4.09942779085903],
[104.317327051104, -4.10050294205635],
[104.317078938943, -4.10207431487692],
[104.316003788645, -4.10290135391356],
[104.315755677384, -4.10339757823483],
[104.315838380838, -4.10405920856482],
[104.316426264961, -4.10548272744511],
[104.316334605159, -4.10596139879868],
[104.316598759426, -4.10670983618915],
[104.316830828581, -4.10736736561064],
[104.316830828581, -4.1081117020926],
[104.31658271732, -4.10885603587654],
[104.315342158315, -4.10960036966057],
[104.3150113427, -4.11084092866516],
[104.314349710572, -4.11158526514712],
[104.31410159931, -4.11266041724363],
[104.314018894957, -4.11365286228897],
[104.314432414026, -4.11439719787156],
[104.314721877913, -4.11567910770381],
[104.314956055079, -4.11574601456617],
[104.31530080389, -4.11584451641054],
[104.315098212713, -4.11656827640399],
[104.315383509143, -4.11749859358443],
[104.315335768632, -4.11819128379993],
[104.315466212597, -4.11873915168965],
[104.31554891695, -4.11981430288697],
[104.316089465258, -4.12054669367419],
[104.316293253432, -4.12130297405215],
[104.316098021408, -4.1216406469974],
[104.316210548179, -4.12213001308887],
[104.316082393888, -4.12286709114258],
[104.316148608273, -4.12320699260786],
[104.316293253432, -4.12394949896941],
[104.317037587216, -4.12510735272131],
[104.317474414913, -4.12489970195886],
[104.318526258381, -4.12510735272131],
[104.319125970388, -4.1248199024158],
[104.319932224294, -4.12527276142795],
[104.320267247836, -4.12511059477727],
[104.321090078945, -4.12568627959726],
[104.321172783298, -4.12651332043263],
[104.321300985253, -4.12696202457696],
[104.321503598014, -4.12767117418453],
[104.321586302367, -4.1283328054138],
[104.322165230142, -4.1293252522578],
[104.32324211793, -4.13028712125283],
[104.323308836834, -4.13100018021333],
[104.323277562011, -4.13140675022059],
[104.323285902324, -4.13191548321223],
[104.3234318506, -4.13206977090241],
[104.323711234887, -4.13216150984499],
[104.324232827284, -4.13221988843628],
[104.324593021052, -4.1322042168503],
[104.324712022943, -4.13219903855393],
[104.324891331571, -4.13228660823956],
[104.324894459413, -4.13263341020289],
[104.324532716113, -4.13317897582828],
[104.324755646357, -4.13352547561936],
[104.324803367083, -4.13381180267174],
[104.324720538623, -4.13398520814998],
[104.324326156228, -4.1340663162067],
[104.323944385026, -4.13393905943926],
[104.323578521932, -4.13398678106422],
[104.323551193334, -4.13417366917863],
[104.32368987329, -4.13449580723486],
[104.323620809854, -4.13482538358374],
[104.32319675163, -4.13495711178044],
[104.322687727258, -4.13517981179807],
[104.322640003834, -4.135370697399],
[104.322926332685, -4.13611832899687],
[104.323403545338, -4.13772494355053],
[104.32400801296, -4.13840894811366],
[104.324230712079, -4.13874299679109],
[104.324467657358, -4.13979310276873],
[104.32451704003, -4.13990421400743],
[104.324755646357, -4.1399519347332],
[104.325041974309, -4.14001556266723],
[104.325773699598, -4.14038142576136],
[104.32626681856, -4.14090635914035],
[104.327046264574, -4.14125631502613],
[104.327284870901, -4.14165399163759],
[104.327087440934, -4.14244371240655],
[104.326855379873, -4.14337195485106],
[104.326441796053, -4.14416730987264],
[104.325869141049, -4.14462861621687],
[104.325837328431, -4.14520127122082],
[104.326390487032, -4.14550027511677],
[104.326839473564, -4.14617160193704],
[104.3270939862, -4.14687151280923],
[104.327412127669, -4.14717374796933],
[104.327237150175, -4.14808045075134],
[104.326839473564, -4.14838268591144],
[104.326362260911, -4.14841449942877],
[104.326028356125, -4.14831727192379],
[104.325853233841, -4.14830314897032],
[104.325789605907, -4.14865310575547],
[104.325853233841, -4.1487167336895],
[104.326012305025, -4.14895534001611],
[104.325964584299, -4.14906668957529],
[104.325837328431, -4.14908259678364],
[104.325636767024, -4.14914690460519],
[104.325312394153, -4.14935301662766],
[104.325026066201, -4.14962343827025],
[104.324819274291, -4.14995748604832],
[104.324851088708, -4.15018018516666],
[104.325121508552, -4.1504187905939],
[104.325678257247, -4.15027562841668],
[104.325900954566, -4.15027562841668],
[104.325948677091, -4.15053014105235],
[104.325964584299, -4.15073693296226],
[104.325953790636, -4.15102497412243],
[104.325885048257, -4.15123005192455],
[104.325725977073, -4.15140502941775],
[104.324379969861, -4.151066679283],
[104.324711055272, -4.15338427356455],
[104.324379969861, -4.15503970062088],
[104.326035396018, -4.15470861610898],
[104.325373226095, -4.15603295595539],
[104.325704312405, -4.15768838301162],
[104.327028651352, -4.15752283940667],
[104.326863110445, -4.1583505520355],
[104.327514996621, -4.15928181890002],
[104.328021906687, -4.16000597819255],
[104.327690823074, -4.16133031893824],
[104.327844492031, -4.16154545565743],
[104.328518535703, -4.16248911697834],
[104.328518535703, -4.16397900042971],
[104.328513077717, -4.16474390620549],
[104.328510251148, -4.16514022843795],
[104.328849620215, -4.16629659561054],
[104.328849620215, -4.16745539365073],
[104.32973680591, -4.16776740174343],
[104.330008418255, -4.16861419169074],
[104.32983636086, -4.16939456040981],
[104.330212010377, -4.17065634970997],
[104.330836130884, -4.1727527557343],
[104.331498299908, -4.17358046926241],
[104.332187686014, -4.17417751927629],
[104.332657098847, -4.17556697993135],
[104.333981439593, -4.17639469166091],
[104.335305780339, -4.17722240608831],
[104.33563686485, -4.17854674503544],
[104.334643610415, -4.17970554397491],
[104.333981439593, -4.17920891675734],
[104.333793741189, -4.17930276640876],
[104.33331926967, -4.17954000216851],
[104.333153726964, -4.18053325660374],
[104.332657098847, -4.1818575982488],
[104.331332758101, -4.18467182064721],
[104.329799857379, -4.18582278469297],
[104.329346248332, -4.18831375657382],
[104.327690823074, -4.18947255641249],
[104.326030543276, -4.19096123657101],
[104.325538767901, -4.19294894963351],
[104.325869853312, -4.19427329217785],
[104.326697565941, -4.19493546120173],
[104.326863110445, -4.19659088556012],
[104.326578642292, -4.19697017643172],
[104.325869853312, -4.19791522720518],
[104.323617342967, -4.19788897779329],
[104.32322117272, -4.19940510975718],
[104.320241406717, -4.1990740252452],
[104.319662129105, -4.19965330195748],
[104.319082608676, -4.20023282328539],
[104.31742718162, -4.19990173787412],
[104.315384240291, -4.2017657527865],
[104.314944042834, -4.20288150387749],
[104.313288617577, -4.20155716403108],
[104.312626447654, -4.20072945140224],
[104.310143308868, -4.20039836599097],
[104.308156799098, -4.19957065426151],
[104.306666915647, -4.20039836599097],
[104.303521606038, -4.19940510975718],
[104.302068307907, -4.19976051913182],
[104.301204009958, -4.20106053591413],
[104.300904264122, -4.20101771469494],
[104.300045211918, -4.20089499410792],
[104.299051955684, -4.20155716403108],
[104.299051955684, -4.20255041756694],
[104.295741105169, -4.20404030281687],
[104.296237733286, -4.20569572807463],
[104.294251222617, -4.20470247274012],
[104.293423509089, -4.20685452611464],
[104.293589050895, -4.20884103678358],
[104.292164966341, -4.20905431010747],
[104.291328804582, -4.21020697926786],
[104.290278201279, -4.21165526098073],
[104.288622775122, -4.21281405902083],
[104.286622071353, -4.21247200907513],
[104.285974093631, -4.21331068713768],
[104.285146380102, -4.21529719780662],
[104.283325412139, -4.21860805012062],
[104.28365649845, -4.22274661416408],
[104.283957676007, -4.23012550388804],
[104.283987582062, -4.23085819864615],
[104.283950860945, -4.23107852805082],
[104.282994325829, -4.23681773065296],
[104.282166614099, -4.23913532763245],
[104.280345646136, -4.24029412477327],
[104.278359134567, -4.2407907537894],
[104.277774182234, -4.24089160826031],
[104.273558400601, -4.24161846641833],
[104.270413090992, -4.24128738190634],
[104.267597664402, -4.24078196381576],
[104.265115728909, -4.24112183920075],
[104.260969080859, -4.2398860645894],
[104.258659569684, -4.23996304116056],
[104.258531408199, -4.24006455123726],
[104.253315923992, -4.24419547643926],
[104.249554728069, -4.24492931783296],
[104.246409417562, -4.24658474399],
[104.244257365086, -4.24625365857865],
[104.241277598184, -4.24625365857865],
[104.241103162082, -4.24602689092741],
[104.240064928055, -4.24467718660204],
[104.239622172926, -4.24410160520412],
[104.239158825121, -4.24386993085179],
[104.23790463689, -4.24324283808564],
[104.237545586161, -4.24294739460582],
[104.237320681905, -4.24276233391381],
[104.235607351099, -4.24142013083357],
[104.233828181826, -4.23731435876982],
[104.231854327316, -4.23582108217641],
[104.229689618682, -4.23565893441151],
[104.228578616011, -4.23582713641237],
[104.227076985615, -4.23516411123397],
[104.225361149299, -4.23560345343579],
[104.225224288671, -4.23599461266044],
[104.225378213934, -4.23640227984054],
[104.224888884715, -4.23648664704026],
[104.224557799304, -4.23764544508045],
[104.225952274579, -4.23877430558899],
[104.228034193424, -4.24045966927751],
[104.227372022602, -4.24277726625699],
[104.228278758659, -4.24466638574423],
[104.227537565307, -4.24658474399],
[104.226047680957, -4.2475780002237],
[104.227035558345, -4.25043952786113],
[104.227080198893, -4.25056883778079],
[104.226709852679, -4.25188210607357],
[104.227278707148, -4.2529250066829],
[104.227703107114, -4.25370307493611],
[104.226544309074, -4.25519295658891],
[104.227996750151, -4.25934495200706],
[104.227703107114, -4.26214574572881],
[104.228861905154, -4.26264237384566],
[104.229192990565, -4.26495996992586],
[104.228199735231, -4.26446334180892],
[104.227360924968, -4.26616970017073],
[104.229122344322, -4.26697655392396],
[104.229087688047, -4.26802929041865],
[104.231345761599, -4.27042019293675],
[104.231016511704, -4.27079648007269],
[104.230598856653, -4.27127379974528],
[104.230415966924, -4.27148281657792],
[104.232674042274, -4.27400654716359],
[104.232275558072, -4.27692876195196],
[104.231080108162, -4.27825704082898],
[104.232142730004, -4.28064794424645],
[104.229267715234, -4.27864817667118],
[104.229751826587, -4.2811792538187],
[104.22784932159, -4.28101266430221],
[104.227414273651, -4.28097456991962],
[104.228450766591, -4.28330668015841],
[104.227095268833, -4.28476560894491],
[104.226563956562, -4.28782065090147],
[104.225102851416, -4.28755499566571],
[104.224704366314, -4.28821913510417],
[104.227095268833, -4.2891489297785],
[104.226979079122, -4.29018710265185],
[104.226952889066, -4.29042112063738],
[104.225600410332, -4.29159862457609],
[104.225055199039, -4.29498819904537],
[104.225368506652, -4.29738426187343],
[104.222231807153, -4.2949672286539],
[104.221454435875, -4.29574459903317],
[104.224447168303, -4.29941000456719],
[104.224304793932, -4.30092706643017],
[104.223907399708, -4.30203323974143],
[104.223268300093, -4.30300005320911],
[104.224321291995, -4.30380204882472],
[104.224045669573, -4.30688690240779],
[104.225859534691, -4.30895989008602],
[104.225600410332, -4.31051462904608],
[104.224428634175, -4.30974718718215],
[104.224304793932, -4.31129199942544],
[104.225341286872, -4.31362410786549],
[104.224897026278, -4.31395730488488],
[104.224384857876, -4.31434143141112],
[104.221195314213, -4.31673358758417],
[104.219640574354, -4.31906569782288],
[104.222490930613, -4.32062043858159],
[104.223268300093, -4.32269342715918],
[104.221713560234, -4.32528465905899],
[104.222231807153, -4.32761676929769],
[104.221429882584, -4.32828504022162],
[104.220930662621, -4.32870105670759],
[104.220677068193, -4.32891238569719],
[104.220158821274, -4.33046712465725],
[104.219076903577, -4.33000640916767],
[104.218863203975, -4.33176274195612],
[104.219381449995, -4.33435397475539],
[104.219899696915, -4.33772257883311],
[104.219122327434, -4.33824082575271],
[104.219640574354, -4.34238680020988],
[104.220677068193, -4.34549627902929],
[104.219122327434, -4.34627364940856],
[104.219430357826, -4.35098912944398],
[104.219393173557, -4.35132378696239],
[104.219341134287, -4.35179216107859],
[104.219234438719, -4.35275240769663],
[104.217623857256, -4.35350995881678],
[104.217471159567, -4.35490752686012],
[104.216491561338, -4.35490752686012],
[104.214797919389, -4.35631112575705],
[104.210656891204, -4.35974298724821],
[104.203257171382, -4.36587547597162],
[104.202911454001, -4.36616198828434],
[104.199208043118, -4.36923117567738],
[104.192237379952, -4.37500808595357],
[104.18935065421, -4.37740044987005],
[104.188355993236, -4.37822477205478],
[104.185486435552, -4.38060290599851],
[104.18327456557, -4.38243598423251],
[104.1796480746, -4.38544142588033],
[104.17494506996, -4.38933902197749],
[104.172951003187, -4.3909915972836],
[104.169355140428, -4.3939716546673],
[104.162034566343, -4.40003855313589],
[104.158708071222, -4.40279537180816],
[104.156749393671, -4.40358762776598],
[104.148819057654, -4.40679532694195],
[104.142280578987, -4.40944004062458],
[104.137579465621, -4.41170557315282],
[104.12561627817, -4.41747079673909],
[104.123390962424, -4.41854320680268],
[104.108874757065, -4.42553876679983],
[104.107654466981, -4.42694019563272],
[104.098573805438, -4.43736879343421],
[104.094448494703, -4.43840012066823],
[104.078294114882, -4.44243871607308],
[104.07800868985, -4.44251007188145],
[104.075049910426, -4.44322426218915],
[104.072362273901, -4.44387299983826],
[104.063098983432, -4.44610896805364],
[104.056551605973, -4.45059859684691],
[104.052492005103, -4.45338232413417],
[104.045104507068, -4.45844803614714],
[104.027110031604, -4.45536326889892],
[104.017780631972, -4.44854563167474],
[104.013742706562, -4.44559484002904],
[104.012407214223, -4.44587994040613],
[104.001504152995, -4.44717698223118],
[103.995846900215, -4.45018524595153],
[103.993111432348, -4.45320865875183],
[103.986118365271, -4.46093783711068],
[103.986049207406, -4.46101427588732],
[103.979940289914, -4.46456719242119],
[103.971361119121, -4.4659584085529],
[103.96992741362, -4.46516374421057],
[103.967030039006, -4.46355780414858],
[103.960463252378, -4.45714737005427],
[103.952347819697, -4.44416267686525],
[103.944860312554, -4.43797725314696],
[103.940897072243, -4.43470322267481],
[103.925736390223, -4.42154489468032],
[103.925145541934, -4.42080211672349],
[103.915724619197, -4.40895867040551],
[103.915110775243, -4.40808175227025],
[103.907715202196, -4.39751664457666],
[103.904539148364, -4.38692980026922],
[103.903424443185, -4.38321411723685],
[103.898828649424, -4.38178512957923],
[103.890266116089, -4.38235596525476],
[103.881398548006, -4.37949545924723],
[103.878969908136, -4.37955773190297],
[103.870242574936, -4.37978151110703],
[103.86450221041, -4.37952383105915],
[103.864318809866, -4.37951559776581],
[103.85498754504, -4.37764934444087],
[103.851293540166, -4.3769105441855],
[103.85118774392, -4.37688023973046],
[103.851052591105, -4.3768201901988],
[103.851189420257, -4.3767254610104],
[103.853521946881, -4.36056098270243],
[103.851535455098, -4.34168930671528],
[103.851330258586, -4.33973994973811],
[103.849768552578, -4.32490372872327],
[103.849690439263, -4.32404448856149],
[103.848267194676, -4.30838879000981],
[103.847218812699, -4.30052593192536],
[103.846015157375, -4.29149851114663],
[103.844955397175, -4.2879338620573],
[103.844527551007, -4.28649474803335],
[103.841886422022, -4.27761094898531],
[103.835505650267, -4.26184668787353],
[103.828503988369, -4.25134419457813],
[103.827248179561, -4.24946048541224],
[103.819640767608, -4.23931726587834],
[103.818240032153, -4.23744962040282],
[103.813941976942, -4.2322919527106],
[103.812609938899, -4.2306935075985],
[103.809877865972, -4.22568470828186],
[103.808105865195, -4.22243603869137],
[103.799097715988, -4.21004983443152],
[103.790840247081, -4.21643060708603],
[103.780415242071, -4.22015151967607],
[103.772535435363, -4.22352488656341],
[103.772448611215, -4.22356205824159],
[103.760062406056, -4.23031816924735],
[103.744298145844, -4.24120301470654],
[103.733568994614, -4.25055663398059],
[103.729659905182, -4.25396455911628],
[103.717273700922, -4.2640987260746],
[103.711564137276, -4.27037924590467],
[103.706229745607, -4.27624707674039],
[103.702260120109, -4.2806136638887],
[103.698994189831, -4.28530843973189],
[103.686780829872, -4.28568617297773],
[103.670783216273, -4.2861809439946],
[103.660969699893, -4.28655360866128],
[103.643940530632, -4.28720028596356],
[103.636974796651, -4.28746480805366],
[103.627131838265, -4.30672276893982],
[103.621570767078, -4.30592832942804],
[103.622009755847, -4.30529179557912],
[103.624176276615, -4.29373701904736],
[103.624215100348, -4.29307701559103],
[103.624832711561, -4.29126563709867],
[103.624843703075, -4.28511944720386],
[103.625296343552, -4.28390746415732],
[103.625820716654, -4.27770051696448],
[103.6257889517, -4.27175981496268],
[103.625927333081, -4.27041011513389],
[103.625976489125, -4.26993067485992],
[103.626980033603, -4.2657604852574],
[103.627296690291, -4.26444461072939],
[103.626768154228, -4.26228529622867],
[103.625998997357, -4.26081021921543],
[103.623668351214, -4.25753862680538],
[103.62354125003, -4.25732875561677],
[103.620882369327, -4.25293688942507],
[103.618344043644, -4.24768027472404],
[103.6174151366, -4.24453198386314],
[103.617164615156, -4.24167380979763],
[103.616925274982, -4.24172982317192],
[103.617027640314, -4.24011107676398],
[103.61701814887, -4.24000280918144],
[103.616384979384, -4.23277904891317],
[103.616643565949, -4.22490758521614],
[103.617485194687, -4.22186259318331],
[103.619150222006, -4.21895915983659],
[103.621596755687, -4.21617453322729],
[103.621902524283, -4.21398341869898],
[103.625065341893, -4.21419655262798],
[103.627171436314, -4.21335759397698],
[103.631608031187, -4.21229634270124],
[103.633423407166, -4.21293469857669],
[103.639264109952, -4.21145236673257],
[103.641984880199, -4.20996256691812],
[103.64530388127, -4.20679883110035],
[103.647447064631, -4.20393708582698],
[103.646480152238, -4.20112062771394],
[103.646752634228, -4.19891302591462],
[103.647483967412, -4.1979697971676],
[103.64805564935, -4.19757852642708],
[103.650268049932, -4.19738541410477],
[103.650709769941, -4.19734685567206],
[103.654233064605, -4.19674669670189],
[103.659792371322, -4.19561630284923],
[103.666449189979, -4.19363433825324],
[103.668457234915, -4.1927769309098],
[103.673676954929, -4.19054818694842],
[103.682208324056, -4.1868172001529],
[103.687789356595, -4.18500838472835],
[103.690740615888, -4.18405186130353],
[103.69527093091, -4.18368071828969],
[103.699619111634, -4.18420646285713],
[103.703257143603, -4.18395088902152],
[103.705665284326, -4.18333373106603],
[103.705956549556, -4.18325908373886],
[103.705793348685, -4.18033889242513],
[103.705075650122, -4.17229131179382],
[103.704968387082, -4.15718394698072],
[103.704913700208, -4.14865299244078],
[103.704996901887, -4.14145859863457],
[103.705047681207, -4.13706791415209],
[103.70508150291, -4.13414327299288],
[103.704904627847, -4.13053262897684],
[103.704783109654, -4.1280520847351],
[103.704616629855, -4.12465380302982],
[103.704496886923, -4.12220951225843],
[103.704384186582, -4.12144258570595],
[103.704079883881, -4.11937179327286],
[103.703713304027, -4.11687535261458],
[103.704004265286, -4.11075856785286],
[103.704223922897, -4.10215841497812],
[103.704354484673, -4.09585778990427],
[103.704273591554, -4.09239280098616],
[103.704210620125, -4.08969534116621],
[103.704869396906, -4.08527986777085],
[103.707294259623, -4.08493308289466],
[103.708203201717, -4.08509783959281],
[103.710452262263, -4.08550550767219],
[103.71797978564, -4.08561461702015],
[103.725461297002, -4.08547074707646],
[103.728151250181, -4.08542926404842],
[103.736466294585, -4.08530097575865],
[103.743604191182, -4.08474330166117],
[103.745601630412, -4.08447396460096],
[103.746692509853, -4.08432686609124],
[103.750054011984, -4.08269145524564],
[103.752912043057, -4.08096446104022],
[103.758813420404, -4.07605095568626],
[103.768070787938, -4.07020445497079],
[103.769801586275, -4.06973195116777],
[103.770726892433, -4.0685687617382],
[103.772731644951, -4.06604686127285],
[103.774467009146, -4.06305598414556],
[103.777617178691, -4.05882514606284],
[103.778647383571, -4.05744151211533],
[103.779669753557, -4.0564118477278],
[103.783492064708, -4.05256226823325],
[103.785754282335, -4.05016875858055],
[103.787033119184, -4.04848806327274],
[103.788059683609, -4.047138911131],
[103.788678260694, -4.04632594558509],
[103.789621388717, -4.04369241767015],
[103.79025168307, -4.04193242643953],
[103.791278938173, -4.04053486559079],
[103.792467347291, -4.03891804912786],
[103.795759517988, -4.03691449180949],
[103.798174794832, -4.0354364065641],
[103.800011870552, -4.03431216767163],
[103.80298543663, -4.03373458168477],
[103.807446413922, -4.033385580879],
[103.810328295016, -4.03267007666188],
[103.812673250271, -4.03195146528712],
[103.814467841119, -4.03140150377559],
[103.816822735682, -4.03006557796321],
[103.818104811889, -4.0289434129074],
[103.820136605221, -4.0271650440308],
[103.821003784598, -4.02537057099423],
[103.822289244954, -4.02323607958057],
[103.82301298786, -4.02203431373178],
[103.824812833447, -4.01971833013603],
[103.825108996384, -4.01927742221439],
[103.825479862407, -4.01878960205768],
[103.82815080032, -4.01640019421276],
[103.82874786832, -4.01586605357473],
[103.830439506579, -4.01476065368045],
[103.832406927339, -4.01464380476697],
[103.833367829563, -4.01464288925708],
[103.83508344015, -4.01441129314581],
[103.835267228301, -4.01420814798681],
[103.836728414386, -4.01259305012833],
[103.838350502675, -4.01077482419798],
[103.839631389078, -4.00933410128696],
[103.840039859353, -4.00887466103596],
[103.840160273179, -4.0087392186392],
[103.840703647157, -4.00812803577941],
[103.842920761985, -4.00647019224478],
[103.843569109328, -4.00664665541801],
[103.845278070328, -4.00711179197484],
[103.846783110054, -4.0075867401351],
[103.84694887759, -4.00763907528225],
[103.848892706434, -4.00697029893933],
[103.848946945446, -4.00688340104733],
[103.850003652448, -4.00519039941653],
[103.850673584419, -4.00411706484989],
[103.851538806871, -4.00087379029235],
[103.851762203864, -4.00049949785273],
[103.853296661313, -3.99792858163788],
[103.855032572296, -3.99571925943545],
[103.856724141307, -3.9946137813001],
[103.858210606435, -3.99412939295636],
[103.860914893009, -3.99363237183574],
[103.861481426328, -3.99352824922849],
[103.863973576321, -3.9923069752859],
[103.866305271972, -3.99085588858763],
[103.868841630838, -3.98846175120799],
[103.870164800666, -3.98558590726297],
[103.871556895435, -3.98293994801935],
[103.87365850044, -3.98052322686459],
[103.87500545284, -3.97836021974753],
[103.875489994968, -3.97613725393033],
[103.875642180044, -3.97543906166251],
[103.876119636413, -3.97318495322216],
[103.877842456865, -3.97165672807476],
[103.878221931198, -3.9713201172288],
[103.881423113887, -3.97002904690216],
[103.882430044312, -3.97025797292625],
[103.884399188173, -3.96940894906295],
[103.8860655312, -3.96869047978101],
[103.887848646699, -3.96767680084289],
[103.890453196659, -3.96505252155585],
[103.890772393033, -3.96448497380173],
[103.891708473968, -3.96282057600801],
[103.891829395911, -3.96236549117366],
[103.892368584444, -3.96033628878789],
[103.892064052415, -3.95504746127053],
[103.891192601259, -3.95348462391545],
[103.891081373108, -3.95296625468808],
[103.890501941712, -3.95026586577622],
[103.890865435992, -3.94837979319207],
[103.891661951139, -3.94527445844868],
[103.892459138979, -3.94267504091963],
[103.89302945035, -3.94147863413088],
[103.894422928277, -3.93998240686177],
[103.89435042943, -3.93713093994008],
[103.894028342635, -3.93579749265931],
[103.893591092256, -3.93388925988067],
[103.892763936308, -3.93124555703603],
[103.891891467119, -3.92892385105408],
[103.892983930265, -3.92478336066273],
[103.893504033385, -3.92462048714495],
[103.894310214446, -3.92436802496356],
[103.896757326391, -3.92385951140652],
[103.901125701391, -3.92307298323078],
[103.905654463284, -3.92247022971648],
[103.908970285251, -3.92152381107427],
[103.915211958866, -3.91887246669014],
[103.918558657257, -3.91792260094648],
[103.922369538924, -3.91684096923455],
[103.927833807985, -3.91451231329181],
[103.931534999342, -3.91108172883796],
[103.934433172554, -3.90601925258562],
[103.93646383364, -3.90224553899965],
[103.940071724831, -3.89761916828921],
[103.942594494941, -3.89655054527069],
[103.944644221655, -3.89568230019717],
[103.949419304259, -3.8948542224436],
[103.951985689689, -3.89440915875485],
[103.957680722988, -3.89359777061977],
[103.961773146415, -3.89191430719866],
[103.965611473592, -3.8885523392183],
[103.969260810039, -3.89107146797305],
[103.97119892729, -3.89240934441486],
[103.973875760259, -3.89590589144295],
[103.974980775244, -3.89734928803844],
[103.975067398842, -3.8974499986177],
[103.976742949129, -3.89939801470578],
[103.980434724584, -3.90369008672731],
[103.986552321433, -3.91012208206764],
[103.988782999837, -3.91318334643347],
[103.989967922283, -3.91480946188634],
[103.994733657333, -3.91972521374684],
[103.999329732582, -3.91820196544752],
[104.002616055887, -3.91720654904222],
[104.003674458111, -3.9168859632158],
[104.004193812096, -3.91674899287086],
[104.006014456303, -3.91626883673663],
[104.008842687441, -3.91552294982351],
[104.011907443874, -3.91499033443554],
[104.015107800086, -3.9133536762304],
[104.015648709022, -3.91343296765654],
[104.016663798996, -3.91358176678431],
[104.019089240877, -3.91387779572292],
[104.02236078922, -3.9137990789635],
[104.023115503878, -3.91378091895338],
[104.025262720699, -3.91163955582008],
[104.02571767693, -3.90993720124002],
[104.025966614669, -3.9095631318323],
[104.026881753091, -3.90818798388754],
[104.029078034225, -3.90823128984139],
[104.030176841189, -3.90868989012554],
[104.033107835159, -3.91045708492572],
[104.035326473439, -3.91015538756032],
[104.035412968435, -3.9101262837002],
[104.038756300664, -3.90900128577987],
[104.040312804094, -3.90955129675414],
[104.041103476345, -3.90992024092553],
[104.041984052023, -3.91033113667176],
[104.04408710134, -3.90924764785985],
[104.044391082084, -3.90905609676069],
[104.044956644135, -3.90869971611818],
[104.045549827064, -3.9083259308962],
[104.045799272919, -3.90689977970031],
[104.04623224972, -3.90650160486436],
[104.04710142739, -3.90570228922846],
[104.049503253074, -3.90551531118182],
[104.050899980251, -3.90629547575476],
[104.051113070113, -3.90630395186506],
[104.053142097131, -3.90638465522683],
[104.056252694707, -3.9059207966067],
[104.062747800871, -3.90460173667999],
[104.0647850387, -3.90533507625199],
[104.06662947717, -3.90541764840493],
[104.067782188598, -3.90546925330262],
[104.071717171311, -3.90551023181094],
[104.073190454177, -3.90642723722645],
[104.073892668213, -3.90686431043874],
[104.075424075162, -3.90598844001366],
[104.076679204083, -3.9040090330896],
[104.076954610668, -3.90343462440756],
[104.077021235143, -3.90329566656091],
[104.079970992568, -3.90239496585418],
[104.081510701159, -3.90104028378126],
[104.082483992443, -3.90018394842966],
[104.083121627962, -3.89834330959524],
[104.084696713184, -3.89617948859171],
[104.088287078387, -3.8953239149659],
[104.092954811616, -3.89580078767539],
[104.097142909419, -3.89676121775513],
[104.101765430132, -3.8975600729382],
[104.105358744212, -3.89852124765659],
[104.10569024421, -3.89878527871681],
[104.106560177311, -3.89864452582338],
[104.113581689045, -3.89638824821827],
[104.122651344685, -3.89243318094574],
[104.122914773199, -3.89559429973629],
[104.1269009759, -3.89341000296848],
[104.132037017595, -3.89077335980192],
[104.13332409763, -3.89011261620342],
[104.137232351593, -3.88783050916985],
[104.142491113875, -3.8860064907062],
[104.147156397351, -3.88498818565543],
[104.148672883648, -3.88390651886996],
[104.149030103358, -3.88365172294782],
[104.151200207025, -3.88171689361898],
[104.153003452948, -3.87929960319329],
[104.155058375944, -3.87690495589816],
[104.156541632292, -3.87467207955203],
[104.159148105901, -3.87377153442796],
[104.162324828829, -3.87188126200981],
[104.165501697446, -3.87008296685462],
[104.168340854448, -3.86879917384202],
[104.171584473446, -3.86733249379873],
[104.172542410605, -3.86689933443596],
[104.176061964089, -3.86484752759055],
[104.179239178946, -3.86327915221032],
[104.182209621678, -3.86120509164081],
[104.184996323023, -3.85871730965523],
[104.186511400981, -3.85723068714569],
[104.186686353294, -3.85705902095625],
[104.188213734877, -3.85395206383587],
[104.188873463141, -3.85181227271736],
[104.190928181092, -3.84939450385251],
[104.191403176017, -3.84901395572865],
[104.193372586976, -3.84743613386971],
[104.197006763552, -3.84559103080062],
[104.198996661967, -3.84538117579978],
[104.200622700978, -3.8464137548901],
[104.202614972704, -3.84756079519373],
[104.205520142641, -3.84746459021783],
[104.208240004574, -3.84605773307709],
[104.209997509179, -3.84377832490892],
[104.209993512592, -3.84150148070792],
[104.20937290034, -3.83982349685605],
[104.209368336281, -3.83722467557752],
[104.209685051425, -3.83520034841651],
[104.209717510656, -3.83505737329837],
[104.210275265692, -3.83260065659416],
[104.210315154222, -3.82926581666329],
[104.209786655031, -3.82793267785],
[104.210216283656, -3.82508023786188],
[104.212132563568, -3.8220646302777],
[104.214552058232, -3.81902527699416],
[104.216151421552, -3.8179189975629],
[104.218506784661, -3.81743256326135],
[104.220061431891, -3.81706943320696],
[104.220587636012, -3.81694652286293],
[104.223327022225, -3.81372267456092],
[104.223434153964, -3.81353042558792],
[104.224558389259, -3.81151298903242],
[104.225743341383, -3.80893538995548],
[104.226770779949, -3.80782993430322],
[104.229190468866, -3.80495151020326],
[104.230405676882, -3.80433827868782],
[104.231430266395, -3.80382123865845],
[104.234331676267, -3.80170103117687],
[104.235723412207, -3.79965206798771],
[104.235991474028, -3.79818440228754],
[104.23624442724, -3.79679945622908],
[104.2365811514, -3.79323416142658],
[104.236344374294, -3.78877277584215],
[104.236704627418, -3.78557542156765],
[104.237823025213, -3.78419382188659],
[104.238918915676, -3.78301924164392],
[104.241341893415, -3.78202664821043],
[104.242178787222, -3.78180270892705],
[104.244885826621, -3.78107834728705],
[104.247697378932, -3.7799241528766],
[104.250509886323, -3.7792989181098],
[104.254122809221, -3.77855745855906],
[104.256135102554, -3.778163410712],
[104.258761997969, -3.77611250588656],
[104.262235003444, -3.77392229877427],
[104.265001064449, -3.77292910189575],
[104.266284698281, -3.77216406841616],
[104.266962081136, -3.77176035555515],
[104.268405714253, -3.77089996066382],
[104.271100762991, -3.76861891483027],
[104.273162597277, -3.7674051610185],
[104.273842778822, -3.76700474956872],
[104.276311566227, -3.7660809668623],
[104.279760938418, -3.76352272659175],
[104.282957557946, -3.76036689401613],
[104.286084632001, -3.75672817496455],
[104.288117391206, -3.75506906608369],
[104.290545323309, -3.75679017602501],
[104.292930097847, -3.75989128485412],
[104.296621427238, -3.76441627229229],
[104.298708479414, -3.76731085091424],
[104.302467888383, -3.77151372907449],
[104.306726430981, -3.77350789657131],
[104.307768679582, -3.77336563641415],
[104.3104154689, -3.7717385865657],
[104.312952685719, -3.77234435280882],
[104.316718853993, -3.77135307868079],
[104.317435238646, -3.77139856369193],
[104.31892064887, -3.77149287379628],
[104.320525775945, -3.77025890142639],
[104.322138165945, -3.76683205275623],
[104.329355519443, -3.76404998202022],
[104.329721309692, -3.76383225255554],
[104.330512282317, -3.7622461704236],
[104.332122990585, -3.7609537798922],
[104.332264296561, -3.76100713397123],
[104.33319985589, -3.76136037957706],
[104.334700599554, -3.7603305587075],
[104.336876153113, -3.76159198378221],
[104.34022077407, -3.76411645990591],
[104.34319790596, -3.76585955197597],
[104.343559681635, -3.76603593960616],
[104.346724013703, -3.76757874006599],
[104.346851380188, -3.76758156213852],
[104.347507350185, -3.76717489770253],
[104.349246012195, -3.76698215859892],
[104.350455427677, -3.7676614300302],
[104.350590107449, -3.76766441398071],
[104.354005734378, -3.76684789791137],
[104.354271330259, -3.76678440487557],
[104.357086192075, -3.76740075793784],
[104.358712571029, -3.76854804465574],
[104.360245889038, -3.76889050559161],
[104.362211466187, -3.76801329068006],
[104.362441730403, -3.7679500962192],
[104.363992050094, -3.76589349598721],
[104.367404800092, -3.76576662502894],
[104.369982061924, -3.76343995029269],
[104.372645843932, -3.76470860321869],
[104.374407951267, -3.76370317825825],
[104.374666929936, -3.76354904075477],
[104.378466209449, -3.76308743673506],
[104.380800075164, -3.76338252678132],
[104.381076164335, -3.76418704319667],
[104.379622278946, -3.76934133303526],
[104.384663818082, -3.77254122519654],
[104.385187997829, -3.77287392129362],
[104.391530718369, -3.77599118374534],
[104.393038986661, -3.77677326567292],
[104.395787052232, -3.77819821087795],
[104.395996081655, -3.77830659807023],
[104.401835621618, -3.78142464742868],
[104.406484419621, -3.78392369971814],
[104.410366715553, -3.78473848729057],
[104.414626915601, -3.7832428409835],
[104.416282286899, -3.78261289017199],
[104.42027297362, -3.78109421942194],
[104.421450226648, -3.78058809896076],
[104.424569935255, -3.77924687164497],
[104.430443210587, -3.77676553510056],
[104.43054390318, -3.77672299357052],
[104.43364392293, -3.77541327670054],
[104.436774078062, -3.77352188192854],
[104.438420821265, -3.77368656398293],
[104.440348123268, -3.77387929769059],
[104.442425567987, -3.77408704288187],
[104.447184845905, -3.77226771528201],
[104.448711526017, -3.77168410293822],
[104.450102001108, -3.77122957388489],
[104.452460653937, -3.77045855092057],
[104.454544613344, -3.77155887683993],
[104.456972281946, -3.77293458865959],
[104.462926069084, -3.77586805576535],
[104.464059638443, -3.77552876673834],
[104.45911637722, -3.76037064868568],
[104.460370068125, -3.76029946644638],
[104.461093553825, -3.76105408667588],
[104.464827815053, -3.76117007044159],
[104.471219427236, -3.76452741590669],
[104.472294468716, -3.76452806881455],
[104.472633577878, -3.76515349243891],
[104.474727046717, -3.76521159673699],
[104.4747266717, -3.76583681621523],
[104.476989987399, -3.7657245052809],
[104.478404212685, -3.76623689671462],
[104.480892812155, -3.76788669041761],
[104.485249478881, -3.76805979822028],
[104.486096231957, -3.77141374244947],
[104.48977278099, -3.77357575941297],
[104.492432984596, -3.77209953126756],
[104.493791505874, -3.77113407667546],
[104.495715678237, -3.77045314329716],
[104.496367625567, -3.77044771858652],
[104.499534938887, -3.78656655899871],
[104.50030520732, -3.78656516864679],
[104.500635262109, -3.78655595329378],
[104.505589352967, -3.78641760428819],
[104.508522093421, -3.78857426668824],
[104.510813915831, -3.79054808972179],
[104.513721373644, -3.79155478992081],
[104.518457840258, -3.7920291472266],
[104.529876436949, -3.79350319811329],
[104.532966929281, -3.79426041918216],
[104.535182765273, -3.7948033282102],
[104.537795946027, -3.79544358165513],
[104.539701133701, -3.79612086918191],
[104.544618452181, -3.79786893540221],
[104.54869429031, -3.79960935558645],
[104.55160262856, -3.80098393695829],
[104.553986599103, -3.8031874891105],
[104.555675703072, -3.80524335189833],
[104.556326222278, -3.806035118625],
[104.556008282257, -3.80711671256537],
[104.555898172863, -3.80909492069325],
[104.556010166337, -3.80984918569056],
[104.556362482943, -3.81222205500298],
[104.557124050436, -3.81527963304777],
[104.557702402645, -3.81824555398835],
[104.558146677628, -3.82268372357415],
[104.557975032123, -3.82391068123211],
[104.557831269199, -3.82493831584978],
[104.554956249033, -3.82843968324393],
[104.55413009313, -3.82928705685139],
[104.553209461648, -3.83023133240923],
[104.552125671564, -3.83134295471277],
[104.548055443405, -3.834883174618],
[104.547832676838, -3.83507692995555],
[104.545344134925, -3.83747353867201],
[104.543289321646, -3.83943234122879],
[104.540251044851, -3.8415309487934],
[104.53994024185, -3.84171242119051],
[104.536892166042, -3.84349213725152],
[104.535182406444, -3.84634727520576],
[104.533085173943, -3.8498931149745],
[104.531030548622, -3.85196687696898],
[104.528834879028, -3.8522698990358],
[104.5250508736, -3.85434346677678],
[104.524923870441, -3.85441306441056],
[104.522939132336, -3.85550065503035],
[104.520496803885, -3.85817309121434],
[104.517673191666, -3.8616909422823],
[104.51543110896, -3.86448425274524],
[104.513079422279, -3.86676549822833],
[104.510235312711, -3.86894386486669],
[104.509858724302, -3.86923230172855],
[104.508902120837, -3.87128101400678],
[104.508974759978, -3.87163064883462],
[104.509618604416, -3.87472969282023],
[104.510381573052, -3.87852328681943],
[104.509837020063, -3.88068625166835],
[104.509732556613, -3.88113011206426],
[104.5091113634, -3.88376953683385],
[104.509177570589, -3.88475043458407],
[104.509238790139, -3.88573355276045],
[104.509418729192, -3.88850694503868],
[104.510110990431, -3.89131167419365],
[104.509611121157, -3.8929685617489],
[104.509848306555, -3.89697010328684],
[104.510038809944, -3.89850169010013],
[104.510383551561, -3.90127010193279],
[104.511080161022, -3.90614480603717],
[104.51217374922, -3.9102793725942],
[104.512068372958, -3.91026194013562],
[104.512320180433, -3.92096372319641],
[104.512233663854, -3.92113006629873],
[104.511594625393, -3.92235874256115],
[104.510986788011, -3.92382123086432],
[104.50979615397, -3.92668594030314],
[104.507130280139, -3.93200367472901],
[104.505169628577, -3.93538815543821],
[104.502246453312, -3.9380383558846],
[104.498669779388, -3.94007839420172],
[104.498201398077, -3.94034554590941],
[104.494864905192, -3.94230646007423],
[104.492717945578, -3.94415025013317],
[104.491438395567, -3.94500350710536],
[104.490476984326, -3.94479821166729],
[104.488050650318, -3.94431951243477],
[104.485900874926, -3.94480630376708],
[104.485054724397, -3.94627109163674],
[104.484943302892, -3.94646397193399],
[104.484819698271, -3.94708589629622],
[104.484467738696, -3.94885677921617],
[104.482846902264, -3.95065361027504],
[104.480561149379, -3.95178461476733],
[104.478435319336, -3.95280033606586],
[104.4773843617, -3.95356116881209],
[104.476917675611, -3.95347441481157],
[104.473584699975, -3.95285483498182],
[104.47136423787, -3.95235272369843],
[104.468390077341, -3.95251891211727],
[104.465301139037, -3.95250128990185],
[104.464273300274, -3.95212765306794],
[104.46404286159, -3.95204388481667],
[104.461086929419, -3.95473109776119],
[104.458301734439, -3.95270550075746],
[104.456855121867, -3.95406496812298],
[104.454460050992, -3.95374618543731],
[104.45425054223, -3.9537183001586],
[104.45374414208, -3.95625029461466],
[104.450958947099, -3.95751629274188],
[104.449499121688, -3.95911128715531],
[104.447246378419, -3.95905126010674],
[104.445502235041, -3.96035533373085],
[104.443309463062, -3.96224504856932],
[104.441996192072, -3.96328695542789],
[104.441685818047, -3.96468364393425],
[104.441590564554, -3.96511227790843],
[104.438148385141, -3.97098423213582],
[104.437286173619, -3.97245506255026],
[104.435034315282, -3.97394576168675],
[104.433326523401, -3.97623902301167],
[104.431562839554, -3.97778224615295],
[104.430019616413, -3.97910500768916],
[104.426712709425, -3.9793254701935],
[104.42425392428, -3.9793254701935],
[104.423846722949, -3.9793254701935],
[104.423120804583, -3.97907892375255],
[104.418035384826, -3.97735174698472],
[104.414775703937, -3.97826410200586],
[104.413053245912, -3.97801392859915],
[104.404592014011, -3.98208298494098],
[104.403828238683, -3.98411972184687],
[104.402555277105, -3.98564727699946],
[104.403064460657, -3.98870238370725],
[104.403573645109, -3.99506718979814],
[104.403759088012, -3.99630347342579],
[104.404337423135, -4.00015903610984],
[104.401791499979, -4.0006682187625],
[104.40073394042, -4.00336720563117],
[104.400040492076, -4.00405269857233],
[104.400008674961, -4.00407656118351],
[104.398749044934, -4.00502128370452],
[104.39643333743, -4.00584832274107],
[104.395440889686, -4.00543480277311],
[104.395192778425, -4.00435965157588],
[104.39502736792, -4.00419424376852],
[104.394696554104, -4.00452506118181],
[104.394034922874, -4.00427694902121],
[104.393538698553, -4.00460776373648],
[104.392463548255, -4.00452506118181],
[104.392050029186, -4.00485587589716],
[104.391260401048, -4.00502774983002],
[104.390644062375, -4.00551750712643],
[104.38965161643, -4.00543480277311],
[104.389072688655, -4.00601373144771],
[104.388080240911, -4.0056829149337],
[104.387087794967, -4.00634454616306],
[104.38626075593, -4.00675806613102],
[104.38401787013, -4.00720467305642],
[104.383910717706, -4.00745018167972],
[104.383779637921, -4.00775051297502],
[104.383204900986, -4.00785604302114],
[104.383200711045, -4.00857755201165],
[104.382539080715, -4.00940459104819],
[104.381635050718, -4.00952885756998],
[104.381050411348, -4.01072785170817],
[104.380057963605, -4.01047974224551],
[104.379644441839, -4.01130678128214],
[104.378817404601, -4.0118030029054],
[104.378143753932, -4.01159248780227],
[104.377494142142, -4.01138948383681],
[104.376915214367, -4.01097596476814],
[104.37616181092, -4.01105573463369],
[104.375922768422, -4.01006622317683],
[104.374930321578, -4.01047974224551],
[104.374764912871, -4.01130678128214],
[104.374351392904, -4.0118030029054],
[104.373633732112, -4.01151593840896],
[104.37269731483, -4.0111413725755],
[104.372614611376, -4.0106451491535],
[104.370629717688, -4.01023163008482],
[104.370298902074, -4.00948729630088],
[104.369099624649, -4.00975495792415],
[104.368727528354, -4.00907377543356],
[104.367900489317, -4.00956999885555],
[104.367156154634, -4.0091564788876],
[104.366403137896, -4.00937462743624],
[104.365832892175, -4.00882566327296],
[104.365189410164, -4.00904445213892],
[104.365336667854, -4.00808132769028],
[104.364261517556, -4.00824673729629],
[104.363742361422, -4.00846903082033],
[104.36368259068, -4.00907377543356],
[104.362938254198, -4.00882566327296],
[104.362019490608, -4.009218060864],
[104.361201472671, -4.00899107108024],
[104.360870657056, -4.00849484765824],
[104.359960914566, -4.0081640320436],
[104.359405374559, -4.00853031871846],
[104.359216578983, -4.00808132769028],
[104.357203246034, -4.00956112344635],
[104.356652759318, -4.00907377543356],
[104.356085948109, -4.00959117069512],
[104.356487349712, -4.00990081267154],
[104.356487349712, -4.01056244480018],
[104.354588239657, -4.01177225508467],
[104.354502456025, -4.01287815500208],
[104.351636829277, -4.01365242361966],
[104.351690524199, -4.01486304779062],
[104.351607818947, -4.01560738427249],
[104.350863484263, -4.01610360679521],
[104.350946188617, -4.01701335018516],
[104.350284558287, -4.01891554041902],
[104.351028892071, -4.0208177297536],
[104.351028892071, -4.02156206623556],
[104.351194299878, -4.0223064000195],
[104.350201853034, -4.0228026234415],
[104.349622926158, -4.02296803124877],
[104.349126701837, -4.0244567006154],
[104.348878590575, -4.02536644400535],
[104.348713181869, -4.02569725961999],
[104.349126701837, -4.02693781682601],
[104.348878590575, -4.02801296892252],
[104.348465070608, -4.02875730360583],
[104.3482996637, -4.02966704699579],
[104.347555328117, -4.03132112506905],
[104.346645585626, -4.03206546065164],
[104.346149362204, -4.032892498789],
[104.345487730975, -4.03388494473362],
[104.345322323168, -4.03479468902286],
[104.34540502842, -4.03562172805949],
[104.34540502842, -4.03614899158193],
[104.34540502842, -4.03653147144944],
[104.345074211007, -4.03719310267871],
[104.344329876324, -4.03802014171535],
[104.343502837287, -4.03876447729803],
[104.343006612966, -4.03983962759597],
[104.343006612966, -4.04050125792588],
[104.342813790225, -4.04103152698254],
[104.34267579915, -4.0414110022152],
[104.342510391342, -4.04190722473783],
[104.342758502604, -4.04265156121979],
[104.343089317319, -4.0434785975584],
[104.342758502604, -4.04463645400832],
[104.34255174217, -4.04492591699665],
[104.343130669046, -4.04641458816193],
[104.343213374299, -4.04707621759255],
[104.343378781207, -4.04765514716652],
[104.343047964693, -4.04823407404247],
[104.342931690446, -4.04848988170188],
[104.342634445624, -4.04914381743242],
[104.341972816194, -4.05021896773037],
[104.340814960643, -4.05162493364295],
[104.340236032868, -4.05236926922563],
[104.339491698184, -4.05286549264763],
[104.339408993831, -4.05352712387681],
[104.339491698184, -4.05394064294548],
[104.339078178216, -4.0546849776288],
[104.338085732272, -4.05526390720276],
[104.336514355854, -4.05542931411076],
[104.335604615162, -4.05584283317934],
[104.334942983033, -4.05617364879407],
[104.334860279579, -4.05832395028924],
[104.334529463065, -4.05898558241788],
[104.333537016221, -4.05989532400919],
[104.332792680639, -4.05989532400919],
[104.332296458116, -4.06022613962382],
[104.332651055403, -4.06133501090129],
[104.332213754662, -4.06204562640373],
[104.330973195657, -4.06278996108704],
[104.329319117584, -4.06336888796299],
[104.329100231591, -4.06345843255979],
[104.327499629905, -4.06411322444495],
[104.327104143143, -4.06464395665247],
[104.326502280857, -4.06486433012394]
]
]
}
}
\ No newline at end of file
'use strict';
(function(factory, window) {
/*globals define, module, require*/
// define an AMD module that relies on 'leaflet'
if (typeof define === 'function' && define.amd) {
define(['leaflet'], factory);
// define a Common JS module that relies on 'leaflet'
} else if (typeof exports === 'object') {
module.exports = factory(require('leaflet'));
}
// attach your plugin to the global 'L' variable
if (typeof window !== 'undefined' && window.L) {
factory(window.L);
}
}(function(L) {
// 🍂miniclass CancelableEvent (Event objects)
// 🍂method cancel()
// Cancel any subsequent action.
// 🍂miniclass VertexEvent (Event objects)
// 🍂property vertex: VertexMarker
// The vertex that fires the event.
// 🍂miniclass ShapeEvent (Event objects)
// 🍂property shape: Array
// The shape (LatLngs array) subject of the action.
// 🍂miniclass CancelableVertexEvent (Event objects)
// 🍂inherits VertexEvent
// 🍂inherits CancelableEvent
// 🍂miniclass CancelableShapeEvent (Event objects)
// 🍂inherits ShapeEvent
// 🍂inherits CancelableEvent
// 🍂miniclass LayerEvent (Event objects)
// 🍂property layer: object
// The Layer (Marker, Polyline…) subject of the action.
// 🍂namespace Editable; 🍂class Editable; 🍂aka L.Editable
// Main edition handler. By default, it is attached to the map
// as `map.editTools` property.
// Leaflet.Editable is made to be fully extendable. You have three ways to customize
// the behaviour: using options, listening to events, or extending.
L.Editable = L.Evented.extend({
statics: {
FORWARD: 1,
BACKWARD: -1
},
options: {
// You can pass them when creating a map using the `editOptions` key.
// 🍂option zIndex: int = 1000
// The default zIndex of the editing tools.
zIndex: 1000,
// 🍂option polygonClass: class = L.Polygon
// Class to be used when creating a new Polygon.
polygonClass: L.Polygon,
// 🍂option polylineClass: class = L.Polyline
// Class to be used when creating a new Polyline.
polylineClass: L.Polyline,
// 🍂option markerClass: class = L.Marker
// Class to be used when creating a new Marker.
markerClass: L.Marker,
// 🍂option rectangleClass: class = L.Rectangle
// Class to be used when creating a new Rectangle.
rectangleClass: L.Rectangle,
// 🍂option circleClass: class = L.Circle
// Class to be used when creating a new Circle.
circleClass: L.Circle,
// 🍂option drawingCSSClass: string = 'leaflet-editable-drawing'
// CSS class to be added to the map container while drawing.
drawingCSSClass: 'leaflet-editable-drawing',
// 🍂option drawingCursor: const = 'crosshair'
// Cursor mode set to the map while drawing.
drawingCursor: 'crosshair',
// 🍂option editLayer: Layer = new L.LayerGroup()
// Layer used to store edit tools (vertex, line guide…).
editLayer: undefined,
// 🍂option featuresLayer: Layer = new L.LayerGroup()
// Default layer used to store drawn features (Marker, Polyline…).
featuresLayer: undefined,
// 🍂option polylineEditorClass: class = PolylineEditor
// Class to be used as Polyline editor.
polylineEditorClass: undefined,
// 🍂option polygonEditorClass: class = PolygonEditor
// Class to be used as Polygon editor.
polygonEditorClass: undefined,
// 🍂option markerEditorClass: class = MarkerEditor
// Class to be used as Marker editor.
markerEditorClass: undefined,
// 🍂option rectangleEditorClass: class = RectangleEditor
// Class to be used as Rectangle editor.
rectangleEditorClass: undefined,
// 🍂option circleEditorClass: class = CircleEditor
// Class to be used as Circle editor.
circleEditorClass: undefined,
// 🍂option lineGuideOptions: hash = {}
// Options to be passed to the line guides.
lineGuideOptions: {},
// 🍂option skipMiddleMarkers: boolean = false
// Set this to true if you don't want middle markers.
skipMiddleMarkers: false
},
initialize: function(map, options) {
L.setOptions(this, options);
this._lastZIndex = this.options.zIndex;
this.map = map;
this.editLayer = this.createEditLayer();
this.featuresLayer = this.createFeaturesLayer();
this.forwardLineGuide = this.createLineGuide();
this.backwardLineGuide = this.createLineGuide();
},
fireAndForward: function(type, e) {
e = e || {};
e.editTools = this;
this.fire(type, e);
this.map.fire(type, e);
},
createLineGuide: function() {
var options = L.extend({ dashArray: '5,10', weight: 1, interactive: false }, this.options.lineGuideOptions);
return L.polyline([], options);
},
createVertexIcon: function(options) {
return L.Browser.mobile && L.Browser.touch ? new L.Editable.TouchVertexIcon(options) : new L.Editable.VertexIcon(options);
},
createEditLayer: function() {
return this.options.editLayer || new L.LayerGroup().addTo(this.map);
},
createFeaturesLayer: function() {
return this.options.featuresLayer || new L.LayerGroup().addTo(this.map);
},
moveForwardLineGuide: function(latlng) {
if (this.forwardLineGuide._latlngs.length) {
this.forwardLineGuide._latlngs[1] = latlng;
this.forwardLineGuide._bounds.extend(latlng);
this.forwardLineGuide.redraw();
}
},
moveBackwardLineGuide: function(latlng) {
if (this.backwardLineGuide._latlngs.length) {
this.backwardLineGuide._latlngs[1] = latlng;
this.backwardLineGuide._bounds.extend(latlng);
this.backwardLineGuide.redraw();
}
},
anchorForwardLineGuide: function(latlng) {
this.forwardLineGuide._latlngs[0] = latlng;
this.forwardLineGuide._bounds.extend(latlng);
this.forwardLineGuide.redraw();
},
anchorBackwardLineGuide: function(latlng) {
this.backwardLineGuide._latlngs[0] = latlng;
this.backwardLineGuide._bounds.extend(latlng);
this.backwardLineGuide.redraw();
},
attachForwardLineGuide: function() {
this.editLayer.addLayer(this.forwardLineGuide);
},
attachBackwardLineGuide: function() {
this.editLayer.addLayer(this.backwardLineGuide);
},
detachForwardLineGuide: function() {
this.forwardLineGuide.setLatLngs([]);
this.editLayer.removeLayer(this.forwardLineGuide);
},
detachBackwardLineGuide: function() {
this.backwardLineGuide.setLatLngs([]);
this.editLayer.removeLayer(this.backwardLineGuide);
},
blockEvents: function() {
// Hack: force map not to listen to other layers events while drawing.
if (!this._oldTargets) {
this._oldTargets = this.map._targets;
this.map._targets = {};
}
},
unblockEvents: function() {
if (this._oldTargets) {
// Reset, but keep targets created while drawing.
this.map._targets = L.extend(this.map._targets, this._oldTargets);
delete this._oldTargets;
}
},
registerForDrawing: function(editor) {
if (this._drawingEditor) this.unregisterForDrawing(this._drawingEditor);
this.blockEvents();
editor.reset(); // Make sure editor tools still receive events.
this._drawingEditor = editor;
this.map.on('mousemove touchmove', editor.onDrawingMouseMove, editor);
this.map.on('mousedown', this.onMousedown, this);
this.map.on('mouseup', this.onMouseup, this);
L.DomUtil.addClass(this.map._container, this.options.drawingCSSClass);
this.defaultMapCursor = this.map._container.style.cursor;
this.map._container.style.cursor = this.options.drawingCursor;
},
unregisterForDrawing: function(editor) {
this.unblockEvents();
L.DomUtil.removeClass(this.map._container, this.options.drawingCSSClass);
this.map._container.style.cursor = this.defaultMapCursor;
editor = editor || this._drawingEditor;
if (!editor) return;
this.map.off('mousemove touchmove', editor.onDrawingMouseMove, editor);
this.map.off('mousedown', this.onMousedown, this);
this.map.off('mouseup', this.onMouseup, this);
if (editor !== this._drawingEditor) return;
delete this._drawingEditor;
if (editor._drawing) editor.cancelDrawing();
},
onMousedown: function(e) {
if (e.originalEvent.which != 1) return;
this._mouseDown = e;
this._drawingEditor.onDrawingMouseDown(e);
},
onMouseup: function(e) {
if (this._mouseDown) {
var editor = this._drawingEditor,
mouseDown = this._mouseDown;
this._mouseDown = null;
editor.onDrawingMouseUp(e);
if (this._drawingEditor !== editor) return; // onDrawingMouseUp may call unregisterFromDrawing.
var origin = L.point(mouseDown.originalEvent.clientX, mouseDown.originalEvent.clientY);
var distance = L.point(e.originalEvent.clientX, e.originalEvent.clientY).distanceTo(origin);
if (Math.abs(distance) < 9 * (window.devicePixelRatio || 1)) this._drawingEditor.onDrawingClick(e);
}
},
// 🍂section Public methods
// You will generally access them by the `map.editTools`
// instance:
//
// `map.editTools.startPolyline();`
// 🍂method drawing(): boolean
// Return true if any drawing action is ongoing.
drawing: function() {
return this._drawingEditor && this._drawingEditor.drawing();
},
// 🍂method stopDrawing()
// When you need to stop any ongoing drawing, without needing to know which editor is active.
stopDrawing: function() {
this.unregisterForDrawing();
},
// 🍂method commitDrawing()
// When you need to commit any ongoing drawing, without needing to know which editor is active.
commitDrawing: function(e) {
if (!this._drawingEditor) return;
this._drawingEditor.commitDrawing(e);
},
connectCreatedToMap: function(layer) {
return this.featuresLayer.addLayer(layer);
},
// 🍂method startPolyline(latlng: L.LatLng, options: hash): L.Polyline
// Start drawing a Polyline. If `latlng` is given, a first point will be added. In any case, continuing on user click.
// If `options` is given, it will be passed to the Polyline class constructor.
startPolyline: function(latlng, options) {
var line = this.createPolyline([], options);
line.enableEdit(this.map).newShape(latlng);
return line;
},
// 🍂method startPolygon(latlng: L.LatLng, options: hash): L.Polygon
// Start drawing a Polygon. If `latlng` is given, a first point will be added. In any case, continuing on user click.
// If `options` is given, it will be passed to the Polygon class constructor.
startPolygon: function(latlng, options) {
var polygon = this.createPolygon([], options);
polygon.enableEdit(this.map).newShape(latlng);
return polygon;
},
// 🍂method startMarker(latlng: L.LatLng, options: hash): L.Marker
// Start adding a Marker. If `latlng` is given, the Marker will be shown first at this point.
// In any case, it will follow the user mouse, and will have a final `latlng` on next click (or touch).
// If `options` is given, it will be passed to the Marker class constructor.
startMarker: function(latlng, options) {
latlng = latlng || this.map.getCenter().clone();
var marker = this.createMarker(latlng, options);
marker.enableEdit(this.map).startDrawing();
return marker;
},
// 🍂method startRectangle(latlng: L.LatLng, options: hash): L.Rectangle
// Start drawing a Rectangle. If `latlng` is given, the Rectangle anchor will be added. In any case, continuing on user drag.
// If `options` is given, it will be passed to the Rectangle class constructor.
startRectangle: function(latlng, options) {
var corner = latlng || L.latLng([0, 0]);
var bounds = new L.LatLngBounds(corner, corner);
var rectangle = this.createRectangle(bounds, options);
rectangle.enableEdit(this.map).startDrawing();
return rectangle;
},
// 🍂method startCircle(latlng: L.LatLng, options: hash): L.Circle
// Start drawing a Circle. If `latlng` is given, the Circle anchor will be added. In any case, continuing on user drag.
// If `options` is given, it will be passed to the Circle class constructor.
startCircle: function(latlng, options) {
latlng = latlng || this.map.getCenter().clone();
var circle = this.createCircle(latlng, options);
circle.enableEdit(this.map).startDrawing();
return circle;
},
startHole: function(editor, latlng) {
editor.newHole(latlng);
},
createLayer: function(klass, latlngs, options) {
options = L.Util.extend({ editOptions: { editTools: this } }, options);
var layer = new klass(latlngs, options);
// 🍂namespace Editable
// 🍂event editable:created: LayerEvent
// Fired when a new feature (Marker, Polyline…) is created.
this.fireAndForward('editable:created', { layer: layer });
return layer;
},
createPolyline: function(latlngs, options) {
return this.createLayer(options && options.polylineClass || this.options.polylineClass, latlngs, options);
},
createPolygon: function(latlngs, options) {
return this.createLayer(options && options.polygonClass || this.options.polygonClass, latlngs, options);
},
createMarker: function(latlng, options) {
return this.createLayer(options && options.markerClass || this.options.markerClass, latlng, options);
},
createRectangle: function(bounds, options) {
return this.createLayer(options && options.rectangleClass || this.options.rectangleClass, bounds, options);
},
createCircle: function(latlng, options) {
return this.createLayer(options && options.circleClass || this.options.circleClass, latlng, options);
}
});
L.extend(L.Editable, {
makeCancellable: function(e) {
e.cancel = function() {
e._cancelled = true;
};
}
});
// 🍂namespace Map; 🍂class Map
// Leaflet.Editable add options and events to the `L.Map` object.
// See `Editable` events for the list of events fired on the Map.
// 🍂example
//
// ```js
// var map = L.map('map', {
// editable: true,
// editOptions: {
// …
// }
// });
// ```
// 🍂section Editable Map Options
L.Map.mergeOptions({
// 🍂namespace Map
// 🍂section Map Options
// 🍂option editToolsClass: class = L.Editable
// Class to be used as vertex, for path editing.
editToolsClass: L.Editable,
// 🍂option editable: boolean = false
// Whether to create a L.Editable instance at map init.
editable: false,
// 🍂option editOptions: hash = {}
// Options to pass to L.Editable when instantiating.
editOptions: {}
});
L.Map.addInitHook(function() {
this.whenReady(function() {
if (this.options.editable) {
this.editTools = new this.options.editToolsClass(this, this.options.editOptions);
}
});
});
L.Editable.VertexIcon = L.DivIcon.extend({
options: {
iconSize: new L.Point(8, 8)
}
});
L.Editable.TouchVertexIcon = L.Editable.VertexIcon.extend({
options: {
iconSize: new L.Point(20, 20)
}
});
// 🍂namespace Editable; 🍂class VertexMarker; Handler for dragging path vertices.
L.Editable.VertexMarker = L.Marker.extend({
options: {
draggable: true,
className: 'leaflet-div-icon leaflet-vertex-icon'
},
// 🍂section Public methods
// The marker used to handle path vertex. You will usually interact with a `VertexMarker`
// instance when listening for events like `editable:vertex:ctrlclick`.
initialize: function(latlng, latlngs, editor, options) {
// We don't use this._latlng, because on drag Leaflet replace it while
// we want to keep reference.
this.latlng = latlng;
this.latlngs = latlngs;
this.editor = editor;
L.Marker.prototype.initialize.call(this, latlng, options);
this.options.icon = this.editor.tools.createVertexIcon({ className: this.options.className });
this.latlng.__vertex = this;
this.editor.editLayer.addLayer(this);
this.setZIndexOffset(editor.tools._lastZIndex + 1);
},
onAdd: function(map) {
L.Marker.prototype.onAdd.call(this, map);
this.on('drag', this.onDrag);
this.on('dragstart', this.onDragStart);
this.on('dragend', this.onDragEnd);
this.on('mouseup', this.onMouseup);
this.on('click', this.onClick);
this.on('contextmenu', this.onContextMenu);
this.on('mousedown touchstart', this.onMouseDown);
this.on('mouseover', this.onMouseOver);
this.on('mouseout', this.onMouseOut);
this.addMiddleMarkers();
},
onRemove: function(map) {
if (this.middleMarker) this.middleMarker.delete();
delete this.latlng.__vertex;
this.off('drag', this.onDrag);
this.off('dragstart', this.onDragStart);
this.off('dragend', this.onDragEnd);
this.off('mouseup', this.onMouseup);
this.off('click', this.onClick);
this.off('contextmenu', this.onContextMenu);
this.off('mousedown touchstart', this.onMouseDown);
this.off('mouseover', this.onMouseOver);
this.off('mouseout', this.onMouseOut);
L.Marker.prototype.onRemove.call(this, map);
},
onDrag: function(e) {
e.vertex = this;
this.editor.onVertexMarkerDrag(e);
var iconPos = L.DomUtil.getPosition(this._icon),
latlng = this._map.layerPointToLatLng(iconPos);
this.latlng.update(latlng);
this._latlng = this.latlng; // Push back to Leaflet our reference.
this.editor.refresh();
if (this.middleMarker) this.middleMarker.updateLatLng();
var next = this.getNext();
if (next && next.middleMarker) next.middleMarker.updateLatLng();
},
onDragStart: function(e) {
e.vertex = this;
this.editor.onVertexMarkerDragStart(e);
},
onDragEnd: function(e) {
e.vertex = this;
this.editor.onVertexMarkerDragEnd(e);
},
onClick: function(e) {
e.vertex = this;
this.editor.onVertexMarkerClick(e);
},
onMouseup: function(e) {
L.DomEvent.stop(e);
e.vertex = this;
this.editor.map.fire('mouseup', e);
},
onContextMenu: function(e) {
e.vertex = this;
this.editor.onVertexMarkerContextMenu(e);
},
onMouseDown: function(e) {
e.vertex = this;
this.editor.onVertexMarkerMouseDown(e);
},
onMouseOver: function(e) {
e.vertex = this;
this.editor.onVertexMarkerMouseOver(e);
},
onMouseOut: function(e) {
e.vertex = this;
this.editor.onVertexMarkerMouseOut(e);
},
// 🍂method delete()
// Delete a vertex and the related LatLng.
delete: function() {
var next = this.getNext(); // Compute before changing latlng
this.latlngs.splice(this.getIndex(), 1);
this.editor.editLayer.removeLayer(this);
this.editor.onVertexDeleted({ latlng: this.latlng, vertex: this });
if (!this.latlngs.length) this.editor.deleteShape(this.latlngs);
if (next) next.resetMiddleMarker();
this.editor.refresh();
},
// 🍂method getIndex(): int
// Get the index of the current vertex among others of the same LatLngs group.
getIndex: function() {
return this.latlngs.indexOf(this.latlng);
},
// 🍂method getLastIndex(): int
// Get last vertex index of the LatLngs group of the current vertex.
getLastIndex: function() {
return this.latlngs.length - 1;
},
// 🍂method getPrevious(): VertexMarker
// Get the previous VertexMarker in the same LatLngs group.
getPrevious: function() {
if (this.latlngs.length < 2) return;
var index = this.getIndex(),
previousIndex = index - 1;
if (index === 0 && this.editor.CLOSED) previousIndex = this.getLastIndex();
var previous = this.latlngs[previousIndex];
if (previous) return previous.__vertex;
},
// 🍂method getNext(): VertexMarker
// Get the next VertexMarker in the same LatLngs group.
getNext: function() {
if (this.latlngs.length < 2) return;
var index = this.getIndex(),
nextIndex = index + 1;
if (index === this.getLastIndex() && this.editor.CLOSED) nextIndex = 0;
var next = this.latlngs[nextIndex];
if (next) return next.__vertex;
},
addMiddleMarker: function(previous) {
if (!this.editor.hasMiddleMarkers()) return;
previous = previous || this.getPrevious();
if (previous && !this.middleMarker) this.middleMarker = this.editor.addMiddleMarker(previous, this, this.latlngs, this.editor);
},
addMiddleMarkers: function() {
if (!this.editor.hasMiddleMarkers()) return;
var previous = this.getPrevious();
if (previous) this.addMiddleMarker(previous);
var next = this.getNext();
if (next) next.resetMiddleMarker();
},
resetMiddleMarker: function() {
if (this.middleMarker) this.middleMarker.delete();
this.addMiddleMarker();
},
// 🍂method split()
// Split the vertex LatLngs group at its index, if possible.
split: function() {
if (!this.editor.splitShape) return; // Only for PolylineEditor
this.editor.splitShape(this.latlngs, this.getIndex());
},
// 🍂method continue()
// Continue the vertex LatLngs from this vertex. Only active for first and last vertices of a Polyline.
continue: function() {
if (!this.editor.continueBackward) return; // Only for PolylineEditor
var index = this.getIndex();
if (index === 0) this.editor.continueBackward(this.latlngs);
else if (index === this.getLastIndex()) this.editor.continueForward(this.latlngs);
}
});
L.Editable.mergeOptions({
// 🍂namespace Editable
// 🍂option vertexMarkerClass: class = VertexMarker
// Class to be used as vertex, for path editing.
vertexMarkerClass: L.Editable.VertexMarker
});
L.Editable.MiddleMarker = L.Marker.extend({
options: {
opacity: 0.5,
className: 'leaflet-div-icon leaflet-middle-icon',
draggable: true
},
initialize: function(left, right, latlngs, editor, options) {
this.left = left;
this.right = right;
this.editor = editor;
this.latlngs = latlngs;
L.Marker.prototype.initialize.call(this, this.computeLatLng(), options);
this._opacity = this.options.opacity;
this.options.icon = this.editor.tools.createVertexIcon({ className: this.options.className });
this.editor.editLayer.addLayer(this);
this.setVisibility();
},
setVisibility: function() {
var leftPoint = this._map.latLngToContainerPoint(this.left.latlng),
rightPoint = this._map.latLngToContainerPoint(this.right.latlng),
size = L.point(this.options.icon.options.iconSize);
if (leftPoint.distanceTo(rightPoint) < size.x * 3) this.hide();
else this.show();
},
show: function() {
this.setOpacity(this._opacity);
},
hide: function() {
this.setOpacity(0);
},
updateLatLng: function() {
this.setLatLng(this.computeLatLng());
this.setVisibility();
},
computeLatLng: function() {
var leftPoint = this.editor.map.latLngToContainerPoint(this.left.latlng),
rightPoint = this.editor.map.latLngToContainerPoint(this.right.latlng),
y = (leftPoint.y + rightPoint.y) / 2,
x = (leftPoint.x + rightPoint.x) / 2;
return this.editor.map.containerPointToLatLng([x, y]);
},
onAdd: function(map) {
L.Marker.prototype.onAdd.call(this, map);
L.DomEvent.on(this._icon, 'mousedown touchstart', this.onMouseDown, this);
map.on('zoomend', this.setVisibility, this);
},
onRemove: function(map) {
delete this.right.middleMarker;
L.DomEvent.off(this._icon, 'mousedown touchstart', this.onMouseDown, this);
map.off('zoomend', this.setVisibility, this);
L.Marker.prototype.onRemove.call(this, map);
},
onMouseDown: function(e) {
var iconPos = L.DomUtil.getPosition(this._icon),
latlng = this.editor.map.layerPointToLatLng(iconPos);
e = {
originalEvent: e,
latlng: latlng
};
if (this.options.opacity === 0) return;
L.Editable.makeCancellable(e);
this.editor.onMiddleMarkerMouseDown(e);
if (e._cancelled) return;
this.latlngs.splice(this.index(), 0, e.latlng);
this.editor.refresh();
var icon = this._icon;
var marker = this.editor.addVertexMarker(e.latlng, this.latlngs);
this.editor.onNewVertex(marker);
/* Hack to workaround browser not firing touchend when element is no more on DOM */
var parent = marker._icon.parentNode;
parent.removeChild(marker._icon);
marker._icon = icon;
parent.appendChild(marker._icon);
marker._initIcon();
marker._initInteraction();
marker.setOpacity(1);
/* End hack */
// Transfer ongoing dragging to real marker
L.Draggable._dragging = false;
marker.dragging._draggable._onDown(e.originalEvent);
this.delete();
},
delete: function() {
this.editor.editLayer.removeLayer(this);
},
index: function() {
return this.latlngs.indexOf(this.right.latlng);
}
});
L.Editable.mergeOptions({
// 🍂namespace Editable
// 🍂option middleMarkerClass: class = VertexMarker
// Class to be used as middle vertex, pulled by the user to create a new point in the middle of a path.
middleMarkerClass: L.Editable.MiddleMarker
});
// 🍂namespace Editable; 🍂class BaseEditor; 🍂aka L.Editable.BaseEditor
// When editing a feature (Marker, Polyline…), an editor is attached to it. This
// editor basically knows how to handle the edition.
L.Editable.BaseEditor = L.Handler.extend({
initialize: function(map, feature, options) {
L.setOptions(this, options);
this.map = map;
this.feature = feature;
this.feature.editor = this;
this.editLayer = new L.LayerGroup();
this.tools = this.options.editTools || map.editTools;
},
// 🍂method enable(): this
// Set up the drawing tools for the feature to be editable.
addHooks: function() {
if (this.isConnected()) this.onFeatureAdd();
else this.feature.once('add', this.onFeatureAdd, this);
this.onEnable();
this.feature.on(this._getEvents(), this);
},
// 🍂method disable(): this
// Remove the drawing tools for the feature.
removeHooks: function() {
this.feature.off(this._getEvents(), this);
if (this.feature.dragging) this.feature.dragging.disable();
this.editLayer.clearLayers();
this.tools.editLayer.removeLayer(this.editLayer);
this.onDisable();
if (this._drawing) this.cancelDrawing();
},
// 🍂method drawing(): boolean
// Return true if any drawing action is ongoing with this editor.
drawing: function() {
return !!this._drawing;
},
reset: function() {},
onFeatureAdd: function() {
this.tools.editLayer.addLayer(this.editLayer);
if (this.feature.dragging) this.feature.dragging.enable();
},
hasMiddleMarkers: function() {
return !this.options.skipMiddleMarkers && !this.tools.options.skipMiddleMarkers;
},
fireAndForward: function(type, e) {
e = e || {};
e.layer = this.feature;
this.feature.fire(type, e);
this.tools.fireAndForward(type, e);
},
onEnable: function() {
// 🍂namespace Editable
// 🍂event editable:enable: Event
// Fired when an existing feature is ready to be edited.
this.fireAndForward('editable:enable');
},
onDisable: function() {
// 🍂namespace Editable
// 🍂event editable:disable: Event
// Fired when an existing feature is not ready anymore to be edited.
this.fireAndForward('editable:disable');
},
onEditing: function() {
// 🍂namespace Editable
// 🍂event editable:editing: Event
// Fired as soon as any change is made to the feature geometry.
this.fireAndForward('editable:editing');
},
onStartDrawing: function() {
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:start: Event
// Fired when a feature is to be drawn.
this.fireAndForward('editable:drawing:start');
},
onEndDrawing: function() {
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:end: Event
// Fired when a feature is not drawn anymore.
this.fireAndForward('editable:drawing:end');
},
onCancelDrawing: function() {
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:cancel: Event
// Fired when user cancel drawing while a feature is being drawn.
this.fireAndForward('editable:drawing:cancel');
},
onCommitDrawing: function(e) {
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:commit: Event
// Fired when user finish drawing a feature.
this.fireAndForward('editable:drawing:commit', e);
},
onDrawingMouseDown: function(e) {
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:mousedown: Event
// Fired when user `mousedown` while drawing.
this.fireAndForward('editable:drawing:mousedown', e);
},
onDrawingMouseUp: function(e) {
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:mouseup: Event
// Fired when user `mouseup` while drawing.
this.fireAndForward('editable:drawing:mouseup', e);
},
startDrawing: function() {
if (!this._drawing) this._drawing = L.Editable.FORWARD;
this.tools.registerForDrawing(this);
this.onStartDrawing();
},
commitDrawing: function(e) {
this.onCommitDrawing(e);
this.endDrawing();
},
cancelDrawing: function() {
// If called during a vertex drag, the vertex will be removed before
// the mouseup fires on it. This is a workaround. Maybe better fix is
// To have L.Draggable reset it's status on disable (Leaflet side).
L.Draggable._dragging = false;
this.onCancelDrawing();
this.endDrawing();
},
endDrawing: function() {
this._drawing = false;
this.tools.unregisterForDrawing(this);
this.onEndDrawing();
},
onDrawingClick: function(e) {
if (!this.drawing()) return;
L.Editable.makeCancellable(e);
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:click: CancelableEvent
// Fired when user `click` while drawing, before any internal action is being processed.
this.fireAndForward('editable:drawing:click', e);
if (e._cancelled) return;
if (!this.isConnected()) this.connect(e);
this.processDrawingClick(e);
},
isConnected: function() {
return this.map.hasLayer(this.feature);
},
connect: function() {
this.tools.connectCreatedToMap(this.feature);
this.tools.editLayer.addLayer(this.editLayer);
},
onMove: function(e) {
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:move: Event
// Fired when `move` mouse while drawing, while dragging a marker, and while dragging a vertex.
this.fireAndForward('editable:drawing:move', e);
},
onDrawingMouseMove: function(e) {
this.onMove(e);
},
_getEvents: function() {
return {
dragstart: this.onDragStart,
drag: this.onDrag,
dragend: this.onDragEnd,
remove: this.disable
};
},
onDragStart: function(e) {
this.onEditing();
// 🍂namespace Editable
// 🍂event editable:dragstart: Event
// Fired before a path feature is dragged.
this.fireAndForward('editable:dragstart', e);
},
onDrag: function(e) {
this.onMove(e);
// 🍂namespace Editable
// 🍂event editable:drag: Event
// Fired when a path feature is being dragged.
this.fireAndForward('editable:drag', e);
},
onDragEnd: function(e) {
// 🍂namespace Editable
// 🍂event editable:dragend: Event
// Fired after a path feature has been dragged.
this.fireAndForward('editable:dragend', e);
}
});
// 🍂namespace Editable; 🍂class MarkerEditor; 🍂aka L.Editable.MarkerEditor
// 🍂inherits BaseEditor
// Editor for Marker.
L.Editable.MarkerEditor = L.Editable.BaseEditor.extend({
onDrawingMouseMove: function(e) {
L.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this, e);
if (this._drawing) this.feature.setLatLng(e.latlng);
},
processDrawingClick: function(e) {
// 🍂namespace Editable
// 🍂section Drawing events
// 🍂event editable:drawing:clicked: Event
// Fired when user `click` while drawing, after all internal actions.
this.fireAndForward('editable:drawing:clicked', e);
this.commitDrawing(e);
},
connect: function(e) {
// On touch, the latlng has not been updated because there is
// no mousemove.
if (e) this.feature._latlng = e.latlng;
L.Editable.BaseEditor.prototype.connect.call(this, e);
}
});
// 🍂namespace Editable; 🍂class PathEditor; 🍂aka L.Editable.PathEditor
// 🍂inherits BaseEditor
// Base class for all path editors.
L.Editable.PathEditor = L.Editable.BaseEditor.extend({
CLOSED: false,
MIN_VERTEX: 2,
addHooks: function() {
L.Editable.BaseEditor.prototype.addHooks.call(this);
if (this.feature) this.initVertexMarkers();
return this;
},
initVertexMarkers: function(latlngs) {
if (!this.enabled()) return;
latlngs = latlngs || this.getLatLngs();
if (isFlat(latlngs)) this.addVertexMarkers(latlngs);
else
for (var i = 0; i < latlngs.length; i++) this.initVertexMarkers(latlngs[i]);
},
getLatLngs: function() {
return this.feature.getLatLngs();
},
// 🍂method reset()
// Rebuild edit elements (Vertex, MiddleMarker, etc.).
reset: function() {
this.editLayer.clearLayers();
this.initVertexMarkers();
},
addVertexMarker: function(latlng, latlngs) {
return new this.tools.options.vertexMarkerClass(latlng, latlngs, this);
},
onNewVertex: function(vertex) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:new: VertexEvent
// Fired when a new vertex is created.
this.fireAndForward('editable:vertex:new', { latlng: vertex.latlng, vertex: vertex });
},
addVertexMarkers: function(latlngs) {
for (var i = 0; i < latlngs.length; i++) {
this.addVertexMarker(latlngs[i], latlngs);
}
},
refreshVertexMarkers: function(latlngs) {
latlngs = latlngs || this.getDefaultLatLngs();
for (var i = 0; i < latlngs.length; i++) {
latlngs[i].__vertex.update();
}
},
addMiddleMarker: function(left, right, latlngs) {
return new this.tools.options.middleMarkerClass(left, right, latlngs, this);
},
onVertexMarkerClick: function(e) {
L.Editable.makeCancellable(e);
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:click: CancelableVertexEvent
// Fired when a `click` is issued on a vertex, before any internal action is being processed.
this.fireAndForward('editable:vertex:click', e);
if (e._cancelled) return;
if (this.tools.drawing() && this.tools._drawingEditor !== this) return;
var index = e.vertex.getIndex(),
commit;
if (e.originalEvent.ctrlKey) {
this.onVertexMarkerCtrlClick(e);
} else if (e.originalEvent.altKey) {
this.onVertexMarkerAltClick(e);
} else if (e.originalEvent.shiftKey) {
this.onVertexMarkerShiftClick(e);
} else if (e.originalEvent.metaKey) {
this.onVertexMarkerMetaKeyClick(e);
} else if (index === e.vertex.getLastIndex() && this._drawing === L.Editable.FORWARD) {
if (index >= this.MIN_VERTEX - 1) commit = true;
} else if (index === 0 && this._drawing === L.Editable.BACKWARD && this._drawnLatLngs.length >= this.MIN_VERTEX) {
commit = true;
} else if (index === 0 && this._drawing === L.Editable.FORWARD && this._drawnLatLngs.length >= this.MIN_VERTEX && this.CLOSED) {
commit = true; // Allow to close on first point also for polygons
} else {
this.onVertexRawMarkerClick(e);
}
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:clicked: VertexEvent
// Fired when a `click` is issued on a vertex, after all internal actions.
this.fireAndForward('editable:vertex:clicked', e);
if (commit) this.commitDrawing(e);
},
onVertexRawMarkerClick: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:rawclick: CancelableVertexEvent
// Fired when a `click` is issued on a vertex without any special key and without being in drawing mode.
this.fireAndForward('editable:vertex:rawclick', e);
if (e._cancelled) return;
if (!this.vertexCanBeDeleted(e.vertex)) return;
e.vertex.delete();
},
vertexCanBeDeleted: function(vertex) {
return vertex.latlngs.length > this.MIN_VERTEX;
},
onVertexDeleted: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:deleted: VertexEvent
// Fired after a vertex has been deleted by user.
this.fireAndForward('editable:vertex:deleted', e);
},
onVertexMarkerCtrlClick: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:ctrlclick: VertexEvent
// Fired when a `click` with `ctrlKey` is issued on a vertex.
this.fireAndForward('editable:vertex:ctrlclick', e);
},
onVertexMarkerShiftClick: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:shiftclick: VertexEvent
// Fired when a `click` with `shiftKey` is issued on a vertex.
this.fireAndForward('editable:vertex:shiftclick', e);
},
onVertexMarkerMetaKeyClick: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:metakeyclick: VertexEvent
// Fired when a `click` with `metaKey` is issued on a vertex.
this.fireAndForward('editable:vertex:metakeyclick', e);
},
onVertexMarkerAltClick: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:altclick: VertexEvent
// Fired when a `click` with `altKey` is issued on a vertex.
this.fireAndForward('editable:vertex:altclick', e);
},
onVertexMarkerContextMenu: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:contextmenu: VertexEvent
// Fired when a `contextmenu` is issued on a vertex.
this.fireAndForward('editable:vertex:contextmenu', e);
},
onVertexMarkerMouseDown: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:mousedown: VertexEvent
// Fired when user `mousedown` a vertex.
this.fireAndForward('editable:vertex:mousedown', e);
},
onVertexMarkerMouseOver: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:mouseover: VertexEvent
// Fired when a user's mouse enters the vertex
this.fireAndForward('editable:vertex:mouseover', e);
},
onVertexMarkerMouseOut: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:mouseout: VertexEvent
// Fired when a user's mouse leaves the vertex
this.fireAndForward('editable:vertex:mouseout', e);
},
onMiddleMarkerMouseDown: function(e) {
// 🍂namespace Editable
// 🍂section MiddleMarker events
// 🍂event editable:middlemarker:mousedown: VertexEvent
// Fired when user `mousedown` a middle marker.
this.fireAndForward('editable:middlemarker:mousedown', e);
},
onVertexMarkerDrag: function(e) {
this.onMove(e);
if (this.feature._bounds) this.extendBounds(e);
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:drag: VertexEvent
// Fired when a vertex is dragged by user.
this.fireAndForward('editable:vertex:drag', e);
},
onVertexMarkerDragStart: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:dragstart: VertexEvent
// Fired before a vertex is dragged by user.
this.fireAndForward('editable:vertex:dragstart', e);
},
onVertexMarkerDragEnd: function(e) {
// 🍂namespace Editable
// 🍂section Vertex events
// 🍂event editable:vertex:dragend: VertexEvent
// Fired after a vertex is dragged by user.
this.fireAndForward('editable:vertex:dragend', e);
},
setDrawnLatLngs: function(latlngs) {
this._drawnLatLngs = latlngs || this.getDefaultLatLngs();
},
startDrawing: function() {
if (!this._drawnLatLngs) this.setDrawnLatLngs();
L.Editable.BaseEditor.prototype.startDrawing.call(this);
},
startDrawingForward: function() {
this.startDrawing();
},
endDrawing: function() {
this.tools.detachForwardLineGuide();
this.tools.detachBackwardLineGuide();
if (this._drawnLatLngs && this._drawnLatLngs.length < this.MIN_VERTEX) this.deleteShape(this._drawnLatLngs);
L.Editable.BaseEditor.prototype.endDrawing.call(this);
delete this._drawnLatLngs;
},
addLatLng: function(latlng) {
if (this._drawing === L.Editable.FORWARD) this._drawnLatLngs.push(latlng);
else this._drawnLatLngs.unshift(latlng);
this.feature._bounds.extend(latlng);
var vertex = this.addVertexMarker(latlng, this._drawnLatLngs);
this.onNewVertex(vertex);
this.refresh();
},
newPointForward: function(latlng) {
this.addLatLng(latlng);
this.tools.attachForwardLineGuide();
this.tools.anchorForwardLineGuide(latlng);
},
newPointBackward: function(latlng) {
this.addLatLng(latlng);
this.tools.anchorBackwardLineGuide(latlng);
},
// 🍂namespace PathEditor
// 🍂method push()
// Programmatically add a point while drawing.
push: function(latlng) {
if (!latlng) return console.error('L.Editable.PathEditor.push expect a valid latlng as parameter');
if (this._drawing === L.Editable.FORWARD) this.newPointForward(latlng);
else this.newPointBackward(latlng);
},
removeLatLng: function(latlng) {
latlng.__vertex.delete();
this.refresh();
},
// 🍂method pop(): L.LatLng or null
// Programmatically remove last point (if any) while drawing.
pop: function() {
if (this._drawnLatLngs.length <= 1) return;
var latlng;
if (this._drawing === L.Editable.FORWARD) latlng = this._drawnLatLngs[this._drawnLatLngs.length - 1];
else latlng = this._drawnLatLngs[0];
this.removeLatLng(latlng);
if (this._drawing === L.Editable.FORWARD) this.tools.anchorForwardLineGuide(this._drawnLatLngs[this._drawnLatLngs.length - 1]);
else this.tools.anchorForwardLineGuide(this._drawnLatLngs[0]);
return latlng;
},
processDrawingClick: function(e) {
if (e.vertex && e.vertex.editor === this) return;
if (this._drawing === L.Editable.FORWARD) this.newPointForward(e.latlng);
else this.newPointBackward(e.latlng);
this.fireAndForward('editable:drawing:clicked', e);
},
onDrawingMouseMove: function(e) {
L.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this, e);
if (this._drawing) {
this.tools.moveForwardLineGuide(e.latlng);
this.tools.moveBackwardLineGuide(e.latlng);
}
},
refresh: function() {
this.feature.redraw();
this.onEditing();
},
// 🍂namespace PathEditor
// 🍂method newShape(latlng?: L.LatLng)
// Add a new shape (Polyline, Polygon) in a multi, and setup up drawing tools to draw it;
// if optional `latlng` is given, start a path at this point.
newShape: function(latlng) {
var shape = this.addNewEmptyShape();
if (!shape) return;
this.setDrawnLatLngs(shape[0] || shape); // Polygon or polyline
this.startDrawingForward();
// 🍂namespace Editable
// 🍂section Shape events
// 🍂event editable:shape:new: ShapeEvent
// Fired when a new shape is created in a multi (Polygon or Polyline).
this.fireAndForward('editable:shape:new', { shape: shape });
if (latlng) this.newPointForward(latlng);
},
deleteShape: function(shape, latlngs) {
var e = { shape: shape };
L.Editable.makeCancellable(e);
// 🍂namespace Editable
// 🍂section Shape events
// 🍂event editable:shape:delete: CancelableShapeEvent
// Fired before a new shape is deleted in a multi (Polygon or Polyline).
this.fireAndForward('editable:shape:delete', e);
if (e._cancelled) return;
shape = this._deleteShape(shape, latlngs);
if (this.ensureNotFlat) this.ensureNotFlat(); // Polygon.
this.feature.setLatLngs(this.getLatLngs()); // Force bounds reset.
this.refresh();
this.reset();
// 🍂namespace Editable
// 🍂section Shape events
// 🍂event editable:shape:deleted: ShapeEvent
// Fired after a new shape is deleted in a multi (Polygon or Polyline).
this.fireAndForward('editable:shape:deleted', { shape: shape });
return shape;
},
_deleteShape: function(shape, latlngs) {
latlngs = latlngs || this.getLatLngs();
if (!latlngs.length) return;
var self = this,
inplaceDelete = function(latlngs, shape) {
// Called when deleting a flat latlngs
shape = latlngs.splice(0, Number.MAX_VALUE);
return shape;
},
spliceDelete = function(latlngs, shape) {
// Called when removing a latlngs inside an array
latlngs.splice(latlngs.indexOf(shape), 1);
if (!latlngs.length) self._deleteShape(latlngs);
return shape;
};
if (latlngs === shape) return inplaceDelete(latlngs, shape);
for (var i = 0; i < latlngs.length; i++) {
if (latlngs[i] === shape) return spliceDelete(latlngs, shape);
else if (latlngs[i].indexOf(shape) !== -1) return spliceDelete(latlngs[i], shape);
}
},
// 🍂namespace PathEditor
// 🍂method deleteShapeAt(latlng: L.LatLng): Array
// Remove a path shape at the given `latlng`.
deleteShapeAt: function(latlng) {
var shape = this.feature.shapeAt(latlng);
if (shape) return this.deleteShape(shape);
},
// 🍂method appendShape(shape: Array)
// Append a new shape to the Polygon or Polyline.
appendShape: function(shape) {
this.insertShape(shape);
},
// 🍂method prependShape(shape: Array)
// Prepend a new shape to the Polygon or Polyline.
prependShape: function(shape) {
this.insertShape(shape, 0);
},
// 🍂method insertShape(shape: Array, index: int)
// Insert a new shape to the Polygon or Polyline at given index (default is to append).
insertShape: function(shape, index) {
this.ensureMulti();
shape = this.formatShape(shape);
if (typeof index === 'undefined') index = this.feature._latlngs.length;
this.feature._latlngs.splice(index, 0, shape);
this.feature.redraw();
if (this._enabled) this.reset();
},
extendBounds: function(e) {
this.feature._bounds.extend(e.vertex.latlng);
},
onDragStart: function(e) {
this.editLayer.clearLayers();
L.Editable.BaseEditor.prototype.onDragStart.call(this, e);
},
onDragEnd: function(e) {
this.initVertexMarkers();
L.Editable.BaseEditor.prototype.onDragEnd.call(this, e);
}
});
// 🍂namespace Editable; 🍂class PolylineEditor; 🍂aka L.Editable.PolylineEditor
// 🍂inherits PathEditor
L.Editable.PolylineEditor = L.Editable.PathEditor.extend({
startDrawingBackward: function() {
this._drawing = L.Editable.BACKWARD;
this.startDrawing();
},
// 🍂method continueBackward(latlngs?: Array)
// Set up drawing tools to continue the line backward.
continueBackward: function(latlngs) {
if (this.drawing()) return;
latlngs = latlngs || this.getDefaultLatLngs();
this.setDrawnLatLngs(latlngs);
if (latlngs.length > 0) {
this.tools.attachBackwardLineGuide();
this.tools.anchorBackwardLineGuide(latlngs[0]);
}
this.startDrawingBackward();
},
// 🍂method continueForward(latlngs?: Array)
// Set up drawing tools to continue the line forward.
continueForward: function(latlngs) {
if (this.drawing()) return;
latlngs = latlngs || this.getDefaultLatLngs();
this.setDrawnLatLngs(latlngs);
if (latlngs.length > 0) {
this.tools.attachForwardLineGuide();
this.tools.anchorForwardLineGuide(latlngs[latlngs.length - 1]);
}
this.startDrawingForward();
},
getDefaultLatLngs: function(latlngs) {
latlngs = latlngs || this.feature._latlngs;
if (!latlngs.length || latlngs[0] instanceof L.LatLng) return latlngs;
else return this.getDefaultLatLngs(latlngs[0]);
},
ensureMulti: function() {
if (this.feature._latlngs.length && isFlat(this.feature._latlngs)) {
this.feature._latlngs = [this.feature._latlngs];
}
},
addNewEmptyShape: function() {
if (this.feature._latlngs.length) {
var shape = [];
this.appendShape(shape);
return shape;
} else {
return this.feature._latlngs;
}
},
formatShape: function(shape) {
if (isFlat(shape)) return shape;
else if (shape[0]) return this.formatShape(shape[0]);
},
// 🍂method splitShape(latlngs?: Array, index: int)
// Split the given `latlngs` shape at index `index` and integrate new shape in instance `latlngs`.
splitShape: function(shape, index) {
if (!index || index >= shape.length - 1) return;
this.ensureMulti();
var shapeIndex = this.feature._latlngs.indexOf(shape);
if (shapeIndex === -1) return;
var first = shape.slice(0, index + 1),
second = shape.slice(index);
// We deal with reference, we don't want twice the same latlng around.
second[0] = L.latLng(second[0].lat, second[0].lng, second[0].alt);
this.feature._latlngs.splice(shapeIndex, 1, first, second);
this.refresh();
this.reset();
}
});
// 🍂namespace Editable; 🍂class PolygonEditor; 🍂aka L.Editable.PolygonEditor
// 🍂inherits PathEditor
L.Editable.PolygonEditor = L.Editable.PathEditor.extend({
CLOSED: true,
MIN_VERTEX: 3,
newPointForward: function(latlng) {
L.Editable.PathEditor.prototype.newPointForward.call(this, latlng);
if (!this.tools.backwardLineGuide._latlngs.length) this.tools.anchorBackwardLineGuide(latlng);
if (this._drawnLatLngs.length === 2) this.tools.attachBackwardLineGuide();
},
addNewEmptyHole: function(latlng) {
this.ensureNotFlat();
var latlngs = this.feature.shapeAt(latlng);
if (!latlngs) return;
var holes = [];
latlngs.push(holes);
return holes;
},
// 🍂method newHole(latlng?: L.LatLng, index: int)
// Set up drawing tools for creating a new hole on the Polygon. If the `latlng` param is given, a first point is created.
newHole: function(latlng) {
var holes = this.addNewEmptyHole(latlng);
if (!holes) return;
this.setDrawnLatLngs(holes);
this.startDrawingForward();
if (latlng) this.newPointForward(latlng);
},
addNewEmptyShape: function() {
if (this.feature._latlngs.length && this.feature._latlngs[0].length) {
var shape = [];
this.appendShape(shape);
return shape;
} else {
return this.feature._latlngs;
}
},
ensureMulti: function() {
if (this.feature._latlngs.length && isFlat(this.feature._latlngs[0])) {
this.feature._latlngs = [this.feature._latlngs];
}
},
ensureNotFlat: function() {
if (!this.feature._latlngs.length || isFlat(this.feature._latlngs)) this.feature._latlngs = [this.feature._latlngs];
},
vertexCanBeDeleted: function(vertex) {
var parent = this.feature.parentShape(vertex.latlngs),
idx = L.Util.indexOf(parent, vertex.latlngs);
if (idx > 0) return true; // Holes can be totally deleted without removing the layer itself.
return L.Editable.PathEditor.prototype.vertexCanBeDeleted.call(this, vertex);
},
getDefaultLatLngs: function() {
if (!this.feature._latlngs.length) this.feature._latlngs.push([]);
return this.feature._latlngs[0];
},
formatShape: function(shape) {
// [[1, 2], [3, 4]] => must be nested
// [] => must be nested
// [[]] => is already nested
if (isFlat(shape) && (!shape[0] || shape[0].length !== 0)) return [shape];
else return shape;
}
});
// 🍂namespace Editable; 🍂class RectangleEditor; 🍂aka L.Editable.RectangleEditor
// 🍂inherits PathEditor
L.Editable.RectangleEditor = L.Editable.PathEditor.extend({
CLOSED: true,
MIN_VERTEX: 4,
options: {
skipMiddleMarkers: true
},
extendBounds: function(e) {
var index = e.vertex.getIndex(),
next = e.vertex.getNext(),
previous = e.vertex.getPrevious(),
oppositeIndex = (index + 2) % 4,
opposite = e.vertex.latlngs[oppositeIndex],
bounds = new L.LatLngBounds(e.latlng, opposite);
// Update latlngs by hand to preserve order.
previous.latlng.update([e.latlng.lat, opposite.lng]);
next.latlng.update([opposite.lat, e.latlng.lng]);
this.updateBounds(bounds);
this.refreshVertexMarkers();
},
onDrawingMouseDown: function(e) {
L.Editable.PathEditor.prototype.onDrawingMouseDown.call(this, e);
this.connect();
var latlngs = this.getDefaultLatLngs();
// L.Polygon._convertLatLngs removes last latlng if it equals first point,
// which is the case here as all latlngs are [0, 0]
if (latlngs.length === 3) latlngs.push(e.latlng);
var bounds = new L.LatLngBounds(e.latlng, e.latlng);
this.updateBounds(bounds);
this.updateLatLngs(bounds);
this.refresh();
this.reset();
// Stop dragging map.
// L.Draggable has two workflows:
// - mousedown => mousemove => mouseup
// - touchstart => touchmove => touchend
// Problem: L.Map.Tap does not allow us to listen to touchstart, so we only
// can deal with mousedown, but then when in a touch device, we are dealing with
// simulated events (actually simulated by L.Map.Tap), which are no more taken
// into account by L.Draggable.
// Ref.: https://github.com/Leaflet/Leaflet.Editable/issues/103
e.originalEvent._simulated = false;
this.map.dragging._draggable._onUp(e.originalEvent);
// Now transfer ongoing drag action to the bottom right corner.
// Should we refine which corner will handle the drag according to
// drag direction?
latlngs[3].__vertex.dragging._draggable._onDown(e.originalEvent);
},
onDrawingMouseUp: function(e) {
this.commitDrawing(e);
e.originalEvent._simulated = false;
L.Editable.PathEditor.prototype.onDrawingMouseUp.call(this, e);
},
onDrawingMouseMove: function(e) {
e.originalEvent._simulated = false;
L.Editable.PathEditor.prototype.onDrawingMouseMove.call(this, e);
},
getDefaultLatLngs: function(latlngs) {
return latlngs || this.feature._latlngs[0];
},
updateBounds: function(bounds) {
this.feature._bounds = bounds;
},
updateLatLngs: function(bounds) {
var latlngs = this.getDefaultLatLngs(),
newLatlngs = this.feature._boundsToLatLngs(bounds);
// Keep references.
for (var i = 0; i < latlngs.length; i++) {
latlngs[i].update(newLatlngs[i]);
}
}
});
// 🍂namespace Editable; 🍂class CircleEditor; 🍂aka L.Editable.CircleEditor
// 🍂inherits PathEditor
L.Editable.CircleEditor = L.Editable.PathEditor.extend({
MIN_VERTEX: 2,
options: {
skipMiddleMarkers: true
},
initialize: function(map, feature, options) {
L.Editable.PathEditor.prototype.initialize.call(this, map, feature, options);
this._resizeLatLng = this.computeResizeLatLng();
},
computeResizeLatLng: function() {
// While circle is not added to the map, _radius is not set.
var delta = (this.feature._radius || this.feature._mRadius) * Math.cos(Math.PI / 4),
point = this.map.project(this.feature._latlng);
return this.map.unproject([point.x + delta, point.y - delta]);
},
updateResizeLatLng: function() {
this._resizeLatLng.update(this.computeResizeLatLng());
this._resizeLatLng.__vertex.update();
},
getLatLngs: function() {
return [this.feature._latlng, this._resizeLatLng];
},
getDefaultLatLngs: function() {
return this.getLatLngs();
},
onVertexMarkerDrag: function(e) {
if (e.vertex.getIndex() === 1) this.resize(e);
else this.updateResizeLatLng(e);
L.Editable.PathEditor.prototype.onVertexMarkerDrag.call(this, e);
},
resize: function(e) {
var radius = this.feature._latlng.distanceTo(e.latlng);
this.feature.setRadius(radius);
},
onDrawingMouseDown: function(e) {
L.Editable.PathEditor.prototype.onDrawingMouseDown.call(this, e);
this._resizeLatLng.update(e.latlng);
this.feature._latlng.update(e.latlng);
this.connect();
// Stop dragging map.
e.originalEvent._simulated = false;
this.map.dragging._draggable._onUp(e.originalEvent);
// Now transfer ongoing drag action to the radius handler.
this._resizeLatLng.__vertex.dragging._draggable._onDown(e.originalEvent);
},
onDrawingMouseUp: function(e) {
this.commitDrawing(e);
e.originalEvent._simulated = false;
L.Editable.PathEditor.prototype.onDrawingMouseUp.call(this, e);
},
onDrawingMouseMove: function(e) {
e.originalEvent._simulated = false;
L.Editable.PathEditor.prototype.onDrawingMouseMove.call(this, e);
},
onDrag: function(e) {
L.Editable.PathEditor.prototype.onDrag.call(this, e);
this.feature.dragging.updateLatLng(this._resizeLatLng);
}
});
// 🍂namespace Editable; 🍂class EditableMixin
// `EditableMixin` is included to `L.Polyline`, `L.Polygon`, `L.Rectangle`, `L.Circle`
// and `L.Marker`. It adds some methods to them.
// *When editing is enabled, the editor is accessible on the instance with the
// `editor` property.*
var EditableMixin = {
createEditor: function(map) {
map = map || this._map;
var tools = (this.options.editOptions || {}).editTools || map.editTools;
if (!tools) throw Error('Unable to detect Editable instance.');
var Klass = this.options.editorClass || this.getEditorClass(tools);
return new Klass(map, this, this.options.editOptions);
},
// 🍂method enableEdit(map?: L.Map): this.editor
// Enable editing, by creating an editor if not existing, and then calling `enable` on it.
enableEdit: function(map) {
if (!this.editor) this.createEditor(map);
this.editor.enable();
return this.editor;
},
// 🍂method editEnabled(): boolean
// Return true if current instance has an editor attached, and this editor is enabled.
editEnabled: function() {
return this.editor && this.editor.enabled();
},
// 🍂method disableEdit()
// Disable editing, also remove the editor property reference.
disableEdit: function() {
if (this.editor) {
this.editor.disable();
delete this.editor;
}
},
// 🍂method toggleEdit()
// Enable or disable editing, according to current status.
toggleEdit: function() {
if (this.editEnabled()) this.disableEdit();
else this.enableEdit();
},
_onEditableAdd: function() {
if (this.editor) this.enableEdit();
}
};
var PolylineMixin = {
getEditorClass: function(tools) {
return (tools && tools.options.polylineEditorClass) ? tools.options.polylineEditorClass : L.Editable.PolylineEditor;
},
shapeAt: function(latlng, latlngs) {
// We can have those cases:
// - latlngs are just a flat array of latlngs, use this
// - latlngs is an array of arrays of latlngs, loop over
var shape = null;
latlngs = latlngs || this._latlngs;
if (!latlngs.length) return shape;
else if (isFlat(latlngs) && this.isInLatLngs(latlng, latlngs)) shape = latlngs;
else
for (var i = 0; i < latlngs.length; i++)
if (this.isInLatLngs(latlng, latlngs[i])) return latlngs[i];
return shape;
},
isInLatLngs: function(l, latlngs) {
if (!latlngs) return false;
var i, k, len, part = [],
p,
w = this._clickTolerance();
this._projectLatlngs(latlngs, part, this._pxBounds);
part = part[0];
p = this._map.latLngToLayerPoint(l);
if (!this._pxBounds.contains(p)) { return false; }
for (i = 1, len = part.length, k = 0; i < len; k = i++) {
if (L.LineUtil.pointToSegmentDistance(p, part[k], part[i]) <= w) {
return true;
}
}
return false;
}
};
var PolygonMixin = {
getEditorClass: function(tools) {
return (tools && tools.options.polygonEditorClass) ? tools.options.polygonEditorClass : L.Editable.PolygonEditor;
},
shapeAt: function(latlng, latlngs) {
// We can have those cases:
// - latlngs are just a flat array of latlngs, use this
// - latlngs is an array of arrays of latlngs, this is a simple polygon (maybe with holes), use the first
// - latlngs is an array of arrays of arrays, this is a multi, loop over
var shape = null;
latlngs = latlngs || this._latlngs;
if (!latlngs.length) return shape;
else if (isFlat(latlngs) && this.isInLatLngs(latlng, latlngs)) shape = latlngs;
else if (isFlat(latlngs[0]) && this.isInLatLngs(latlng, latlngs[0])) shape = latlngs;
else
for (var i = 0; i < latlngs.length; i++)
if (this.isInLatLngs(latlng, latlngs[i][0])) return latlngs[i];
return shape;
},
isInLatLngs: function(l, latlngs) {
var inside = false,
l1, l2, j, k, len2;
for (j = 0, len2 = latlngs.length, k = len2 - 1; j < len2; k = j++) {
l1 = latlngs[j];
l2 = latlngs[k];
if (((l1.lat > l.lat) !== (l2.lat > l.lat)) &&
(l.lng < (l2.lng - l1.lng) * (l.lat - l1.lat) / (l2.lat - l1.lat) + l1.lng)) {
inside = !inside;
}
}
return inside;
},
parentShape: function(shape, latlngs) {
latlngs = latlngs || this._latlngs;
if (!latlngs) return;
var idx = L.Util.indexOf(latlngs, shape);
if (idx !== -1) return latlngs;
for (var i = 0; i < latlngs.length; i++) {
idx = L.Util.indexOf(latlngs[i], shape);
if (idx !== -1) return latlngs[i];
}
}
};
var MarkerMixin = {
getEditorClass: function(tools) {
return (tools && tools.options.markerEditorClass) ? tools.options.markerEditorClass : L.Editable.MarkerEditor;
}
};
var RectangleMixin = {
getEditorClass: function(tools) {
return (tools && tools.options.rectangleEditorClass) ? tools.options.rectangleEditorClass : L.Editable.RectangleEditor;
}
};
var CircleMixin = {
getEditorClass: function(tools) {
return (tools && tools.options.circleEditorClass) ? tools.options.circleEditorClass : L.Editable.CircleEditor;
}
};
var keepEditable = function() {
// Make sure you can remove/readd an editable layer.
this.on('add', this._onEditableAdd);
};
var isFlat = L.LineUtil.isFlat || L.LineUtil._flat || L.Polyline._flat; // <=> 1.1 compat.
if (L.Polyline) {
L.Polyline.include(EditableMixin);
L.Polyline.include(PolylineMixin);
L.Polyline.addInitHook(keepEditable);
}
if (L.Polygon) {
L.Polygon.include(EditableMixin);
L.Polygon.include(PolygonMixin);
}
if (L.Marker) {
L.Marker.include(EditableMixin);
L.Marker.include(MarkerMixin);
L.Marker.addInitHook(keepEditable);
}
if (L.Rectangle) {
L.Rectangle.include(EditableMixin);
L.Rectangle.include(RectangleMixin);
}
if (L.Circle) {
L.Circle.include(EditableMixin);
L.Circle.include(CircleMixin);
}
L.LatLng.prototype.update = function(latlng) {
latlng = L.latLng(latlng);
this.lat = latlng.lat;
this.lng = latlng.lng;
}
}, window));
\ No newline at end of file
var map = L.map('map', { editable: true, zoomControl: false, drawControl: true }).setView([-4.028349, 104.007235], 10); var map = L.map('map', { editable: true, zoomControl: false, drawControl: true }).setView([-4.125826277307029, 104.1881561279297], 10);
var pool = []; var pool = [];
...@@ -21,14 +21,12 @@ function loaderPage(stat) { ...@@ -21,14 +21,12 @@ function loaderPage(stat) {
$("#sidebar").hide() $("#sidebar").hide()
maps = L.tileLayer('https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', { maps = L.tileLayer('https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}', {
maxZoom: 22, maxZoom: 22,
minZoom: 4, minZoom: 4,
}).addTo(map); }).addTo(map);
OpenStreetMap.onclick = function() { OpenStreetMap.onclick = function() {
// https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
// https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}.png?access_token=pk.eyJ1Ijoib3dlbCIsImEiOiJja2VsNjNxY3AwNng1MzNvOWs0N2U5aXA3In0.kobQj6R5JdlgV78glqjL2Q
maps = L.tileLayer("https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}", { maps = L.tileLayer("https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}", {
attribution: "Data by \u0026copy; \u003ca href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e", attribution: "Data by \u0026copy; \u003ca href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e",
maxZoom: 22, maxZoom: 22,
...@@ -38,7 +36,7 @@ OpenStreetMap.onclick = function() { ...@@ -38,7 +36,7 @@ OpenStreetMap.onclick = function() {
WorldImagery.onclick = function() { WorldImagery.onclick = function() {
maps = L.tileLayer("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", { maps = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: "Data by \u0026copy; \u003ca href=\"http://openstreetmap.org\"\u003eESRI\u003c/a\u003e", attribution: "Data by \u0026copy; \u003ca href=\"http://openstreetmap.org\"\u003eESRI\u003c/a\u003e",
maxZoom: 22, maxZoom: 22,
minZoom: 3, minZoom: 3,
...@@ -66,20 +64,19 @@ var Marker = {}; ...@@ -66,20 +64,19 @@ var Marker = {};
var Poly = {}; var Poly = {};
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.open("GET", "../static/bataskota.json", false); request.open("GET", "../static/batas.json", false);
request.send(null) request.send(null)
var json_batas_kota = JSON.parse(request.responseText); var batas = JSON.parse(request.responseText);
console.log(json_batas_kota); console.log(batas);
var geo_batas = L.geoJson(batas, {
var geo_batas = L.geoJson(null, {
style: function(feature) { style: function(feature) {
return { return {
color: "#fcba03", color: "#000000",
weight: 5, weight: 1,
opacity: 2, opacity: 1,
fillcolor: "#fcba03", fillcolor: "#FFFFFF",
fillOpacity: 0 fillOpacity: 0.1
}; };
}, },
onEachFeature: function(feature, layer) { onEachFeature: function(feature, layer) {
...@@ -87,7 +84,7 @@ var geo_batas = L.geoJson(null, { ...@@ -87,7 +84,7 @@ var geo_batas = L.geoJson(null, {
mouseover: function(e) { mouseover: function(e) {
var layer = e.target; var layer = e.target;
layer.setStyle({ layer.setStyle({
weight: 5, weight: 1,
Color: "#067800", Color: "#067800",
fillColor: "#067800", fillColor: "#067800",
...@@ -105,21 +102,6 @@ var geo_batas = L.geoJson(null, { ...@@ -105,21 +102,6 @@ var geo_batas = L.geoJson(null, {
} }
}).addTo(map); }).addTo(map);
function geo_json_batas(data) {
geo_batas.addData(data)
}
let list_bts = [];
for (var i = 0; i < json_batas_kota.length; i++) {
geoj = json_batas_kota[i];
list_bts.push(geoj);
};
geo_json_batas(list_bts);
map.on(L.Draw.Event.CREATED, function(e) { map.on(L.Draw.Event.CREATED, function(e) {
var layer = e.layer; var layer = e.layer;
...@@ -212,18 +194,9 @@ $("#closeR").click(function() { ...@@ -212,18 +194,9 @@ $("#closeR").click(function() {
map.off('click', cheakDFeas); map.off('click', cheakDFeas);
}); });
// $('#GetAddress').click(function() {
var searchControl = L.esri.Geocoding.geosearch().addTo(map);
// create an empty layer group to store the results and add it to the map
var results = L.layerGroup().addTo(map); var results = L.layerGroup().addTo(map);
// listen for the results event and add every result to the map // listen for the results event and add every result to the map
searchControl.on("results", function(data) {
results.clearLayers();
for (var i = data.results.length - 1; i >= 0; i--) {
results.addLayer(L.marker(data.results[i].latlng));
}
});
$('#GetAddress').click(function() { $('#GetAddress').click(function() {
$("#AddressModal").modal("show"); $("#AddressModal").modal("show");
...@@ -374,7 +347,8 @@ var geo_build_gen = L.geoJson(null, { ...@@ -374,7 +347,8 @@ var geo_build_gen = L.geoJson(null, {
geo_build_gen.resetStyle(e.target); geo_build_gen.resetStyle(e.target);
} }
}); });
var content = `<div class="tabbable"> var content = `
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified"> <ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li class="active text-primary" id="feature-title"><a href="#left-tab1-feas-upl" data-toggle="tab" id="info">Information</a></li> <li class="active text-primary" id="feature-title"><a href="#left-tab1-feas-upl" data-toggle="tab" id="info">Information</a></li>
<li><a href="#right-tab2-feas-upl" data-toggle="tab" id="edit">Edit Buildings</a></li> <li><a href="#right-tab2-feas-upl" data-toggle="tab" id="edit">Edit Buildings</a></li>
......
...@@ -20,6 +20,21 @@ ...@@ -20,6 +20,21 @@
width: auto; width: auto;
height: 100%; height: 100%;
} }
.filter>label:after {
content: "\e98e";
font-family: 'icomoon';
font-size: 12px;
display: inline-block;
position: absolute;
top: 50%;
left: 12px;
margin-top: -6px;
color: #999999;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style> </style>
{% block leafletdraw %} {% block leafletdraw %}
...@@ -144,7 +159,7 @@ ...@@ -144,7 +159,7 @@
<a class="navbar-brand" href="{% url 'apps:dashboard' %}"> <a class="navbar-brand" href="{% url 'apps:dashboard' %}">
<!-- <h3>NationalAddress</h3> --> <!-- <h3>NationalAddress</h3> -->
<i class=" icon-location4"></i> <i class=" icon-location4"></i>
<b>&nbsp;&nbsp;OGAN KOMERING ULU</b> <b>&nbsp;&nbsp;OKU-GIS</b>
</a> </a>
<ul class="nav navbar-nav pull-right visible-xs-block"> <ul class="nav navbar-nav pull-right visible-xs-block">
...@@ -183,6 +198,13 @@ ...@@ -183,6 +198,13 @@
<div class="navbar-collapse collapse" id="navbar-second-toggle"> <div class="navbar-collapse collapse" id="navbar-second-toggle">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="active"><a href="{% url 'apps:dashboard' %}"><i class="icon-display4 position-left"></i> Dashboard</a></li> <li class="active"><a href="{% url 'apps:dashboard' %}"><i class="icon-display4 position-left"></i> Dashboard</a></li>
<li>
<div id="DataTables_Table_0_filter" class="dataTables_filter" style="margin: 0px 0 0px 20px;padding-top:5px;">
<label>
<input type="search" class="" placeholder="Type to search..." aria-controls="DataTables_Table_0">
</label>
</div>
</li>
<li class="hidden-xs" id="jumlah" style="padding-top: 14px;padding-left: 14px;"> <li class="hidden-xs" id="jumlah" style="padding-top: 14px;padding-left: 14px;">
<!-- <li class="hidden-xs"><a href="#" data-toggle="collapse" data-target=".navbar-collapse.in" id="list-btn"><i class="fa fa-list white"></i>&nbsp;&nbsp;List</a></li> --> <!-- <li class="hidden-xs"><a href="#" data-toggle="collapse" data-target=".navbar-collapse.in" id="list-btn"><i class="fa fa-list white"></i>&nbsp;&nbsp;List</a></li> -->
...@@ -201,7 +223,6 @@ ...@@ -201,7 +223,6 @@
</span>&nbsp;&nbsp; Search </span>&nbsp;&nbsp; Search
<span class="caret"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="#" id="GetAddress"><i class="icon-location4"></i>by Address</a></li> <li><a href="#" id="GetAddress"><i class="icon-location4"></i>by Address</a></li>
<!-- <li><a href="#" id="createRadius"><i class="icon-location4"></i>by Radius</a></li> --> <!-- <li><a href="#" id="createRadius"><i class="icon-location4"></i>by Radius</a></li> -->
...@@ -261,30 +282,7 @@ ...@@ -261,30 +282,7 @@
</div> </div>
</div> </div>
</li> </li>
<li class="dropdown">
{% if user.is_superuser %}
<!-- <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-cog3"></i>
<span class="visible-xs-inline-block position-right">Share</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'apps:generate' %}"><i class="icon-cogs"></i> Engine Polygon</a></a>
</li>
<li><a href="{% url 'apps:engine' %}"><i class="icon-square-right"></i> Manage Polygon</a></a>
</li>
<li><a href="{% url 'apps:monitoring' %}"><i class="icon-display4"></i> Monitor</a></li>
<li><a href="{% url 'apps:manage' %}"><i class="icon-user-lock"></i> Manage User</a></li>
<li><a href="{% url 'apps:register' %}"><i class="icon-statistics"></i> Registration User</a></li>
</ul>
</li> -->
{% endif %} {% if user.username == 'khansia' %}
<!-- <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-cog3"></i> <i class="icon-cog3"></i>
<span class="visible-xs-inline-block position-right">Share</span> <span class="visible-xs-inline-block position-right">Share</span>
...@@ -292,20 +290,16 @@ ...@@ -292,20 +290,16 @@
</a> </a>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li><a href="{% url 'apps:generate' %}"><i class="icon-cogs"></i> Engine Polygon</a></a> <li><a href="#"><i class="icon-cogs"></i> Engine Polygon</a></a>
</li> </li>
<li><a href="{% url 'apps:engine' %}"><i class="icon-square-right"></i> Manage Polygon</a></a> <li><a href="#"><i class="icon-square-right"></i> Manage Polygon</a></a>
</li> </li>
<li><a href="{% url 'apps:monitoring' %}"><i class="icon-display4"></i> Monitor</a></li> <li><a href="#"><i class="icon-display4"></i> Monitor</a></li>
<li><a href="{% url 'apps:3dlay' %}"><i class="icon-user-lock"></i> 3D Maps</a></li> <li><a href="#"><i class="icon-user-lock"></i> Manage User</a></li>
<li><a href="{% url 'apps:3dm' %}"><i class="icon-statistics"></i> 3D Maps Local</a></li> <li><a href="#"><i class="icon-statistics"></i> Registration User</a></li>
</ul> </ul>
</li> --> </li>
{% endif %}
</ul> </ul>
</div> </div>
</div> </div>
...@@ -315,14 +309,14 @@ ...@@ -315,14 +309,14 @@
<div style="height: 550px;"> <div style="height: 550px;">
{% block content %} {% block content %}
<!-- <div id="sidebar"> <!-- <div id="sidebar" style="display: block;">
<div class="sidebar-wrapper"> <div class="sidebar-wrapper">
<div class="panel panel-default" id="features"> <div class="panel panel-default" id="features">
<div class="panel-body"> <div class="panel-body">
<div class="row"> <div class="row">
<div class="col-xs-9 col-md-9" id="jumlah"> <div class="col-xs-9 col-md-9" id="jumlah">
<span class="font-weight-bold ml-2 mt-1">Jumlah Bangunan:&nbsp;{{jumlah_bangunan}}</span><br> <span class="font-weight-bold ml-2 mt-1">Jumlah Bangunan:&nbsp;{{jumlah_bangunan}}</span><br>
</div> </div>
</div> </div>
</div> </div>
...@@ -348,60 +342,8 @@ ...@@ -348,60 +342,8 @@
<div id="map"></div> <div id="map"></div>
</div> </div>
<div class="modal fade" id="AddressModal" tabindex="-1" role="dialog"> <div class="modal fade" id="modal-kelurahan" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Search by Address</h4>
</div>
<div class="modal-body">
<form action="{% url 'apps:CheckByAddress' %}" class="form-group" role="search" method="POST">
{% csrf_token %}
<fieldset>
<div>
<label for="cb1-input"><b>Provinsi</b></label><br>
<select id="id_provinsi" class="form-control input-lg">
<option>Select Provinsi</option>
{% for prov in prov_res %}
<option value="{{ prov.0 }}">{{prov.0}}</option>
{% endfor %}
</select><br>
<label for="cb2-input"><b>Kabupaten</b></label><br>
<select id="id_kab" class="form-control input-lg">
<option>Select Kabupaten</option>
</select>
<br>
<label for="cb2-input"><b>Kecamatan</b></label><br>
<select id="id_kec" class="form-control input-lg">
<option>Select Kecamatan</option>
</select>
<br>
<label for="cb2-input"><b>Desa</b></label><br>
<select id="id_desa" name="polydes" class="form-control input-lg">
<option>Select Desa</option>
</select>
<!-- <input type="text" name="polydes" list="exampleList"> -->
<input class="hidden" type="text" name="polykab" id="polykab" value="">
<input class="hidden" type="text" name="polypro" id="polypro">
<input class="hidden" type="text" name="polykec" id="polykec">
<!-- <input class="hidden" type="text" name="polydes" id="polydes"> -->
</div>
<br>
<input class="btn btn-success btn-block" type="submit" value="Get Building">
</fieldset>
</form>
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
</div> -->
</div>
</div>
</div> </div>
<!-- end modal location --> <!-- end modal location -->
...@@ -625,7 +567,7 @@ ...@@ -625,7 +567,7 @@
<script src="{% static 'js/leaflet-bing-layer.js' %}"></script> <script src="{% static 'js/leaflet-bing-layer.js' %}"></script>
{% block js.maps %} {% endblock js.maps %} {% block js %} {% block js.maps %} {% endblock js.maps %} {% block js %}
<script src="{% static 'bataskota.json' %}"> <script>
</script> </script>
<script type="text/javascript" src="{% static 'js/maps.js' %}"></script> <script type="text/javascript" src="{% static 'js/maps.js' %}"></script>
{% endblock js %} {% endblock js %}
...@@ -634,4 +576,453 @@ ...@@ -634,4 +576,453 @@
</body> </body>
</html> </html>
\ No newline at end of file
<script>
var kecamatan = "{{ kecamatan }}".replace(/&#x27;/g, '"');
var result_kec = JSON.parse("" + kecamatan + "");
console.log(result_kec)
var kelurahan = "{{ kelurahan }}".replace(/&#x27;/g, '"');
var result_kel = JSON.parse("" + kelurahan + "")
//var jalan = "{{ jalan }}".replace(/&#x27;/g, '"');
//var result_jln = JSON.parse("" + jalan + "")
var geo_batas_kel = L.geoJson(null, {
style: function(feature) {
return {
color: "#8E0B0B",
weight: 0.5,
opacity: 2,
fillcolor: "#F79997",
fillOpacity: 0.1
};
},
onEachFeature: function(feature, layer) {
layer.on({
click: function(e) {
content = `<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">INFORMASI</h4>
</div>
<div class="modal-body">
<div class="tabbable">
<ul class="nav nav-tabs nav-tabs-bottom nav-justified">
<li class="active text-primary" id="feature-title"><a href="#left-tab1-feas-upl" data-toggle="tab" id="info">Informasi Administrasi</a></li>
<li><a href="#right-tab2-feas-upl" data-toggle="tab" id="edit">Informasi Kependudukan</a></li>
<li><a href="#right-tab3-feas-upl" data-toggle="tab" id="edit">Informasi Pekerjaan & Pendidikan</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="left-tab1-feas-upl" style="padding-bottom: 17px;">
<div style="width: 350px; margin-left:10px;">
<table>
<tr>
<th>Kode Desa</th>
<td>:&nbsp` + feature.administrasi.f1 + `</td>
</tr>
<tr>
<th>Desa/Kelurahan</th>
<td>:&nbsp` + feature.administrasi.f2 + `</td>
</tr>
<tr>
<th>Kecamatan</th>
<td>:&nbsp` + feature.administrasi.f3 + `</td>
</tr>
<tr>
<th>Kabupaten/Kota</th>
<td>:&nbsp` + feature.administrasi.f4 + `</td>
</tr>
<tr>
<th>Provinsi</th>
<td>:&nbsp` + feature.administrasi.f5 + `</td>
</tr>
<tr>
<th>Luas Wilayah</th>
<td>:&nbsp` + feature.administrasi.f10 + `</td>
</tr>
<tr>
<th>Jumlah Penduduk</th>
<td>:&nbsp` + feature.administrasi.f6 + `</td>
</tr>
<tr>
<th>Jumlah KK</th>
<td>:&nbsp` + feature.administrasi.f7 + `</td>
</tr>
</table>
</div>
</div>
<div class="tab-pane" id="right-tab2-feas-upl" style="padding-bottom: 17px;">
<div style="width: 350px; margin-left:10px;">
<table>
<tr>
<th>Jumlah Laki-laki</th>
<td>:&nbsp` + feature.penduduk.f1 + `</td>
</tr>
<tr>
<th>Jumlah Perempuan</th>
<td>:&nbsp` + feature.penduduk.f2 + `</td>
</tr>
<tr>
<th>Belum Kawin</th>
<td>:&nbsp` + feature.penduduk.f3 + `</td>
</tr>
<tr>
<th>Kawin</th>
<td>:&nbsp` + feature.penduduk.f4 + `</td>
</tr>
<tr>
<th>cerai hidup</th>
<td>:&nbsp` + feature.penduduk.f5 + `</td>
</tr>
<tr>
<th>cerai mati</th>
<td>:&nbsp` + feature.penduduk.f10 + `</td>
</tr>
<tr>
<th>wajib KTP</th>
<td>:&nbsp` + feature.penduduk.f11 + `</td>
</tr>
<tr>
<th>Islam</th>
<td>:&nbsp` + feature.penduduk.f12 + `</td>
</tr>
<tr>
<th>Kristen</th>
<td>:&nbsp` + feature.penduduk.f13 + `</td>
</tr>
<tr>
<th>Katolik</th>
<td>:&nbsp` + feature.penduduk.f14 + `</td>
</tr>
<tr>
<th>Hindu</th>
<td>:&nbsp` + feature.penduduk.f15 + `</td>
</tr>
<tr>
<th>Budha</th>
<td>:&nbsp` + feature.penduduk.f16 + `</td>
</tr>
<tr>
<th>Konghucu</th>
<td>:&nbsp` + feature.penduduk.f17 + `</td>
</tr>
<tr>
<th>Kepercayaan Lain</th>
<td>:&nbsp` + feature.penduduk.f18 + `</td>
</tr>
</table>
</div>
</div>
<div class="tab-pane" id="right-tab3-feas-upl" style="padding-bottom: 17px;">
<div style="width: 350px; margin-left:10px;">
<table>
<tr>
<th>Tidak Sekolah</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f1 + `</td>
</tr>
<tr>
<th>Belum Tamat</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f2 + `</td>
</tr>
<tr>
<th>Tamat SD</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f3 + `</td>
</tr>
<tr>
<th>SLTP</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f4 + `</td>
</tr>
<tr>
<th>SLTA</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f5 + `</td>
</tr>
<tr>
<th>Diploma I</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f10 + `</td>
</tr>
<tr>
<th>Diploma II</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f11 + `</td>
</tr>
<tr>
<th>Diploma IV/Strata I</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f12 + `</td>
</tr>
<tr>
<th>Strata I</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f13 + `</td>
</tr>
<tr>
<th>Strata II</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f14 + `</td>
</tr>
<tr>
<th>Strata III</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f15 + `</td>
</tr>
<tr>
<th>Tidak Bekerja</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f16 + `</td>
</tr>
<tr>
<th>Aparatur Pemerintah</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f17 + `</td>
</tr>
<tr>
<th>Tenaga Pendidik</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Wiraswasta</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pertanian</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Tenaga Kesehatan</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pensiunan</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pegawai</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Tentara</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Kepolisian</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pedagang</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Petani</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Peternak</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Nelayan</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Karyawan</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Buruh</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pembantu</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Tukang</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pendeta</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pator</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Ustadz</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Dosen</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Guru</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pilot</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Pengacara</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Notaris</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Arsitek</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Akuntan</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Konsultan</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Dokter</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Bidan</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Perawat</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Psikiater</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Sopir</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
<tr>
<th>Lainnya</th>
<td>:&nbsp` + feature.pekerjaan_pendidikan.f18 + `</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>`;
$("#modal-kelurahan").modal("show");
$("#modal-kelurahan").html(content);
},
mouseover: function(e) {
var layer = e.target;
layer.setStyle({
weight: 0.5,
Color: "#067800",
fillColor: "#067800",
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
}
},
mouseout: function(e) {
geo_batas_kel.resetStyle(e.target);
}
});
}
}).addTo(map);
var geo_batas_kec = L.geoJson(null, {
style: function(feature) {
return {
color: "#08c96b",
weight: 0.5,
opacity: 1,
fillcolor: "#98ff98",
fillOpacity: 0.2
};
},
onEachFeature: function(feature, layer) {
layer.on({
mouseover: function(e) {
var layer = e.target;
layer.setStyle({
weight: 0.5,
Color: "#067800",
fillColor: "#067800",
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
}
},
mouseout: function(e) {
geo_batas_kec.resetStyle(e.target);
}
});
}
}).addTo(map);
var geo_jalan = L.geoJson(null, {
style: function(feature) {
return {
color: "#fcba03",
weight: 5,
opacity: 2,
fillcolor: "#fcba03",
fillOpacity: 0
};
},
onEachFeature: function(feature, layer) {
layer.on({
mouseover: function(e) {
var layer = e.target;
layer.setStyle({
weight: 5,
Color: "#067800",
fillColor: "#067800",
});
if (!L.Browser.ie && !L.Browser.opera) {
layer.bringToFront();
}
},
mouseout: function(e) {
geo_batas_kel.resetStyle(e.target);
}
});
}
}).addTo(map);
function geo_json_jalan(data) {
geo_jalan.addData(data)
}
function geo_json_kel(data) {
geo_batas_kel.addData(data)
}
function geo_json_kec(data) {
geo_batas_kec.addData(data)
}
geo_json_kel(result_kel);
//geo_json_jalan(result_jln)
geo_json_kec(result_kec);
L.control.layers(baseMaps = {}, overlayMaps = {
'Batas Kecamatan': geo_batas_kec,
'Batas Kota': geo_batas,
'batas desa': geo_batas_kel,
// 'jalan': geo_jln
}).addTo(map);
</script>
\ No newline at end of file
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