<script>
    var kantor_administrasi = "{{ kantor_administrasi }}".replace(/&#x27;/g, '"');
    var result_kan_adm = JSON.parse("" + kantor_administrasi + "")
        // console.log(result_kan_adm[1]['administrasi']['f2'])

    geo_po_adm = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            // console.log(feature.administrasi.f1)

            if (feature.administrasi.f2 == 'Kantor Polisi') {
                var smallIcon = new L.Icon({
                    iconSize: [25, 25],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/police.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [20, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Instalasi TNI (AD/AL/AU)') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/tni.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]

                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Bangunan/Kantor Pertahanan Keamanan Lainnya') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/tni.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Pemerintah Lainnya') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/kades.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Camat') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/lurah.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Kepala Desa') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/lurah.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor DPRD') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/lurah.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Lurah') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/lurah.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Lembaga Pemasyarakatan') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/pemerintahan_lain.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Kantor Bupati') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/lurah.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [38, 38],
                    shadowAnchor: [23, 32]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            }
        }
    });

    var markeradm = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-adm',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_adm(data) {
        geo_po_adm.addData(data)
    }

    geo_json_po_adm(result_kan_adm);

    function k_adm() {
        var checkBox = document.getElementById("knt_adm");
        if (checkBox.checked == true) {
            newe(markeradm, geo_po_adm, checkBox)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            markeradm.remove()
            geo_po_adm.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var layanan_kesehatan = "{{ layanan_kesehatan }}".replace(/&#x27;/g, '"');
    var result_lay_kes = JSON.parse("" + layanan_kesehatan + "")

    var geo_po_kes = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [20, 20],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
                iconUrl: 'static/img/icon/rs.svg',
                shadowUrl: 'static/img/icon/shadow.svg',
                shadowSize: [35, 35],
                shadowAnchor: [22, 31]
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
            marker.bindTooltip(feature.administrasi.f1, {
                permanent: false,
                className: "my-label",
                offset: [0, 0]
            });
            return marker
        }
    });

    var markerkes = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-sakit',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_kes(data) {
        geo_po_kes.addData(data)
    }

    geo_json_po_kes(result_lay_kes);

    function l_kes() {
        var checkBox = document.getElementById("lyn_kes");
        if (checkBox.checked == true) {
            newe(markerkes, geo_po_kes, checkBox)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            markerkes.remove()
            geo_po_kes.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var puskesmas = "{{ puskesmas }}".replace(/&#x27;/g, '"');
    var result_puskes = JSON.parse("" + puskesmas + "")

    var geo_po_puskes = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [20, 20],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
                iconUrl: 'static/img/icon/rs.svg',
                shadowUrl: 'static/img/icon/shadow.svg',
                shadowSize: [35, 35],
                shadowAnchor: [22, 31]
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
            marker.bindTooltip(feature.administrasi.f1, {
                permanent: false,
                className: "my-label",
                offset: [0, 0]
            });
            return marker
        }
    });

    var markerpuskes = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-sakit',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_puskes(data) {
        geo_po_puskes.addData(data)
    }

    geo_json_po_puskes(result_puskes);

    function pks() {
        var checkBox = document.getElementById("pus");
        if (checkBox.checked == true) {
            newe(markerpuskes, geo_po_puskes, checkBox)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            markerpuskes.remove()
            geo_po_puskes.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var rumah_sakit = "{{ rumah_sakit }}".replace(/&#x27;/g, '"');
    var result_rumah_sakit = JSON.parse("" + rumah_sakit + "")

    var geo_po_rumah_sakit = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [25, 25],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
                iconUrl: 'static/img/icon/rs.svg',
                shadowUrl: 'static/img/icon/shadow.svg',
                shadowSize: [35, 35],
                shadowAnchor: [19, 31]
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
            marker.bindTooltip(feature.administrasi.f1, {
                permanent: false,
                className: "my-label",
                offset: [0, 0]
            });
            return marker
        },onEachFeature: function(feature, layer) {
                layer.on({
                    click: function(e) {
                        content =`
                        <table class="table table-hover tasks-list">
                            <thead style="text-align: center;">
                                <tr>
                                    <th style="padding: 0 0 0 0px;">
                                        <img src="static/img/icon/rs.svg" alt="Image" style="width: 100%;max-height: 237px;height:237"> 
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <div class= "container">
                                    <tr style="height: 100px;">
                                        <th>
                                            <div>
                                                <h1 style="font-family: Google Sans,Roboto,Arial,sans-serif;
                                                letter-spacing: 0;
                                                font-weight: 400;">
                                                    <span style="font-size: x-large;">
                                                        ` + feature.administrasi.f1 + `
                                                    </span>
                                                </h1>
                                            </div>
                                        </th>
                                    </tr>
                                </div>
                                <div class= "container">
                                    <tr style="height: 30px;">
                                        <th>
                                            <span>
                                                ` + feature.administrasi.f3 + `
                                            </span>
                                        </th>
                                    </tr>
                                </div>
                                <div class= "container">
                                    <tr style="height: 40px;">
                                        <th>
                                            <span>
                                                ` + feature.administrasi.f2 + `
                                            </span>
                                        </th>
                                    </tr>
                                </div>
                                <div class= "container">
                                    <tr style="height: 40px;">
                                        <th>
                                            <p>
                                                <span>Luas Bangunan : None</span>
                                            </p>
                                            <p>
                                                <span>Luas Tanah : None</span>
                                            </p>
                                            <p>
                                                <span>Tinggi Bangunan : None</span>
                                            </p>
                                        </th>
                                    </tr>
                                </div>
                                <div class= "container">
                                    <tr style="height: 40px;">
                                        <th>
                                            <p>
                                                <span> </span>
                                            </p>
                                        </th>
                                    </tr>
                                </div>
                            </tbody>
                        </table>`;
                        $("#panel-samping").css("display", "block");
                        $("#button_hide_panel").css("display", "block")
                        $("#thisFooter").css('left', '380px');
                        $("#thisFooter").css('width', '930px');
                        $("#thisFooter").css('display', 'none');
                        $("#button_unhide").css('display', 'block')
                        $("#isi_panel").html(content)
                        $()
                    }
                })
        }
    });

    function geo_json_po_rumah_sakit(data) {
        geo_po_rumah_sakit.addData(data)
    }

    geo_json_po_rumah_sakit(result_rumah_sakit);

    function rs() {
        var checkBox = document.getElementById("rusak");
        if (checkBox.checked == true) {
            geo_po_rumah_sakit.addTo(map)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            geo_po_rumah_sakit.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var sarana_ibadah = "{{ sarana_ibadah }}".replace(/&#x27;/g, '"');
    var result_sarana_ibadah = JSON.parse("" + sarana_ibadah + "")

    var geo_po_sarana_ibadah = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            if (feature.administrasi.f2 == 'Masjid') {
                var smallIcon = new L.Icon({
                    iconSize: [25, 25],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/masjid.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [35, 35],
                    shadowAnchor: [19, 30]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Gereja') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/gereja.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [35, 35],
                    shadowAnchor: [22, 31]

                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Peribadatan/Sosial Lainnya') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/pesantren.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [35, 35],
                    shadowAnchor: [22, 31]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Pura') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/pura.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [35, 35],
                    shadowAnchor: [22, 31]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            }
        }
    });

    var markeribdh = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-ibdh',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_sarana_ibadah(data) {
        geo_po_sarana_ibadah.addData(data)
    }

    geo_json_po_sarana_ibadah(result_sarana_ibadah);

    function fiksi() {
        var checkBox = document.getElementById("ibdh");
        if (checkBox.checked == true) {
            newe(markeribdh, geo_po_sarana_ibadah, checkBox)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            markeribdh.remove()
            geo_po_sarana_ibadah.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var sarana_pendidikan = "{{ sarana_pendidikan }}".replace(/&#x27;/g, '"');
    var result_sarana_pendidikan = JSON.parse("" + sarana_pendidikan + "")

    var geo_po_sarana_pendidikan = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            if (feature.administrasi.f2 == 'Pendidikan Tinggi') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/kampus.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [35, 35],
                    shadowAnchor: [19, 30]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else if (feature.administrasi.f2 == 'Perpustakaan') {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/perpus.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [35, 35],
                    shadowAnchor: [22, 31]

                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            } else {
                var smallIcon = new L.Icon({
                    iconSize: [20, 20],
                    iconAnchor: [13, 27],
                    popupAnchor: [1, -24],
                    iconUrl: 'static/img/icon/sekolah.svg',
                    shadowUrl: 'static/img/icon/shadow.svg',
                    shadowSize: [35, 35],
                    shadowAnchor: [22, 31]
                });
                var marker = L.marker(latlng, {
                    icon: smallIcon
                });
                marker.bindTooltip(feature.administrasi.f1, {
                    permanent: false,
                    className: "my-label",
                    offset: [0, 0]
                });
                return marker
            }
        }
    });

    var markerpend = L.markerClusterGroup({
        iconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();

            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster-pend',
                iconSize: new L.Point(40, 40)
            });
        },
        //Disable all of the defaults:
        spiderfyOnMaxZoom: false,
        showCoverageOnHover: false
    });

    function geo_json_po_sarana_pendidikan(data) {
        geo_po_sarana_pendidikan.addData(data)
    }

    geo_json_po_sarana_pendidikan(result_sarana_pendidikan);

    function didik() {
        var checkBox = document.getElementById("dididik");
        if (checkBox.checked == true) {
            newe(markerpend, geo_po_sarana_pendidikan, checkBox)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            markerpend.remove()
            geo_po_sarana_pendidikan.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var spbu = "{{ spbu }}".replace(/&#x27;/g, '"');
    var result_spbu = JSON.parse("" + spbu + "")

    var geo_po_spbu = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [25, 25],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
                iconUrl: 'static/img/icon/pom.svg',
                shadowUrl: 'static/img/icon/shadow.svg',
                shadowSize: [35, 35],
                shadowAnchor: [19, 30]
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
            marker.bindTooltip(feature.administrasi.f1, {
                permanent: false,
                className: "my-label",
                offset: [0, 0]
            });
            return marker
        }
    });

    function geo_json_po_spbu(data) {
        geo_po_spbu.addData(data)
    }

    geo_json_po_spbu(result_spbu);

    function pom_mini() {
        var checkBox = document.getElementById("pom_bengsin");
        if (checkBox.checked == true) {
            geo_po_spbu.addTo(map)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            geo_po_spbu.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var stasiun = "{{ stasiun }}".replace(/&#x27;/g, '"');
    var result_stasiun = JSON.parse("" + stasiun + "")

    var geo_po_stasiun = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [20, 20],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
                iconUrl: 'static/img/icon/kereta.svg',
                shadowUrl: 'static/img/icon/shadow.svg',
                shadowSize: [35, 35],
                shadowAnchor: [22, 31]
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
            marker.bindTooltip(feature.administrasi.f1, {
                permanent: false,
                className: "my-label",
                offset: [0, 0]
            });
            return marker
        }
    });

    function geo_json_po_stasiun(data) {
        geo_po_stasiun.addData(data)
    }

    geo_json_po_stasiun(result_stasiun);

    function sthall() {
        var checkBox = document.getElementById("tasiun");
        if (checkBox.checked == true) {
            geo_po_stasiun.addTo(map)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            geo_po_stasiun.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var terminal = "{{ terminal }}".replace(/&#x27;/g, '"');
    var result_terminal = JSON.parse("" + terminal + "")

    var geo_po_terminal = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [18, 18],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
                iconUrl: 'static/img/icon/bus.svg',
                shadowUrl: 'static/img/icon/shadow.svg',
                shadowSize: [35, 35],
                shadowAnchor: [22, 31]
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
            marker.bindTooltip(feature.administrasi.f1, {
                permanent: false,
                className: "my-label",
                offset: [0, 0]
            });
            return marker
        }
    });

    function geo_json_po_terminal(data) {
        geo_po_terminal.addData(data)
    }

    geo_json_po_terminal(result_terminal);

    function temanggung() {
        var checkBox = document.getElementById("caheum");
        if (checkBox.checked == true) {
            geo_po_terminal.addTo(map)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            geo_po_terminal.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var cagar_budaya = "{{ cagar_budaya }}".replace(/&#x27;/g, '"');
    var result_cagar_budaya = JSON.parse("" + cagar_budaya + "")

    var geo_po_cagar_budaya = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [20, 20],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
                iconUrl: 'static/img/icon/loc.svg',
                shadowUrl: 'static/img/icon/shadow.svg',
                shadowSize: [35, 35],
                shadowAnchor: [22, 31]
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
            marker.bindTooltip(feature.administrasi.f1, {
                permanent: false,
                className: "my-label",
                offset: [0, 0]
            });
            return marker
        }
    });

    function geo_json_po_cagar_budaya(data) {
        geo_po_cagar_budaya.addData(data)
    }

    geo_json_po_cagar_budaya(result_cagar_budaya);

    function cb100() {
        var checkBox = document.getElementById("cabud");
        if (checkBox.checked == true) {
            geo_po_cagar_budaya.addTo(map)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            geo_po_cagar_budaya.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    var gardu_listrik = "{{ gardu_listrik }}".replace(/&#x27;/g, '"');
    var result_gardu_listrik = JSON.parse("" + gardu_listrik + "")

    var geo_po_gardu_listrik = L.geoJson(null, {
        pointToLayer: function(feature, latlng) {
            var smallIcon = new L.Icon({
                iconSize: [20, 20],
                iconAnchor: [13, 27],
                popupAnchor: [1, -24],
                iconUrl: 'static/img/icon/listrik.svg',
                shadowUrl: 'static/img/icon/shadow.svg',
                shadowSize: [35, 35],
                shadowAnchor: [22, 31]
            });
            var marker = L.marker(latlng, {
                icon: smallIcon
            });
            marker.bindTooltip(feature.administrasi.f1, {
                permanent: false,
                className: "my-label",
                offset: [0, 0]
            });
            return marker
        }
    });

    function geo_json_po_gardu_listrik(data) {
        geo_po_gardu_listrik.addData(data)
    }

    geo_json_po_gardu_listrik(result_gardu_listrik);

    function gl100() {
        var checkBox = document.getElementById("gardu");
        if (checkBox.checked == true) {
            geo_po_gardu_listrik.addTo(map)
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');
        } else {
            geo_po_gardu_listrik.remove()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    function gas_all() {
        var checkBox = document.getElementById("po_all");
        if (checkBox.checked == true) {
            document.getElementById("knt_adm").checked = true;
            document.getElementById("lyn_kes").checked = true;
            document.getElementById("pus").checked = true;
            document.getElementById("rusak").checked = true;
            document.getElementById("ibdh").checked = true;
            document.getElementById("dididik").checked = true;
            document.getElementById("pom_bengsin").checked = true;
            document.getElementById("tasiun").checked = true;
            document.getElementById("caheum").checked = true;
            document.getElementById("cabud").checked = true;
            document.getElementById("gardu").checked = true;
            k_adm()
            l_kes()
            pks()
            rs()
            fiksi()
            didik()
            pom_mini()
            sthall()
            temanggung()
            cb100()
            gl100()
            $("#thisFooter").css('display', 'none');
            $("#legendapo").css('display', 'block');

        } else {
            document.getElementById("knt_adm").checked = false;
            document.getElementById("lyn_kes").checked = false;
            document.getElementById("pus").checked = false;
            document.getElementById("rusak").checked = false;
            document.getElementById("ibdh").checked = false;
            document.getElementById("dididik").checked = false;
            document.getElementById("pom_bengsin").checked = false;
            document.getElementById("tasiun").checked = false;
            document.getElementById("caheum").checked = false;
            document.getElementById("cabud").checked = false;
            document.getElementById("gardu").checked = false;
            k_adm()
            l_kes()
            pks()
            rs()
            fiksi()
            didik()
            pom_mini()
            sthall()
            temanggung()
            cb100()
            gl100()
            $("#button_unhide").css('display', 'block');
            $("#legendapo").css('display', 'none');
        }
    }

    function newe(marques, xnxx, xxx) {
        marques.addLayer(xnxx);
        map.addLayer(marques);
        // map.removeLayer(xnxx);
        // map.addLayer(markersknt);
        var lastZoom;
        map.on('zoomend', function() {
            var zoom = map.getZoom();
            console.log(zoom)
            if (zoom < 14 && (!lastZoom || lastZoom >= 14)) {
                if (xxx.checked == true) {
                    $("#thisFooter").css('display', 'none');
                    $("#legendapo").css('display', 'block');
                    map.removeLayer(marques);
                    map.addLayer(marques);
                    map.removeLayer(xnxx);
                } else {
                    $("#button_unhide").css('display', 'block');
                    $("#legendapo").css('display', 'none');
                    map.removeLayer(marques);
                }
            } else if (zoom >= 14 && (!lastZoom || lastZoom < 14)) {
                if (xxx.checked == true) {
                    map.removeLayer(marques);
                    map.addLayer(xnxx);
                } else {
                    map.removeLayer(xnxx);
                }

            }
            lastZoom = zoom;
        })
    }
</script>