Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i was trying to make control layer for my geojson layer. i use leaflet feature group to group it into one control, but there is an error that says Uncaught TypeError: Cannot read property 'minZoom' of undefined.

What I have tried:

var IncomeGroup = L.featureGroup().addTo(map);
    var overlays = {
    "Income" : IncomeGroup
    };
    console.log(overlays);
    //Menampilkan data kecamatan choropleth Income
    <?php
        $getKecamatan=$db->ObjectBuilder()->get('kecamatan');
        foreach ($getKecamatan as $row) {
            ?>

            <?php
            $arrayKecIncome[]='{
            name: "'.$row->nama_kecamatan.'",
            layer: new L.GeoJSON.AJAX(["assets/unggah_kecamatan/geojson/'.$row->geojson_kecamatan.'"],{
                style: styleIncome
                
            }).addTo(IncomeGroup).bindPopup(
                "Kecamatan : '.$row->nama_kecamatan.'<br>Pendapatan Rerata (Rp) : '.$dataIncome[$row->kode_kecamatan].'")
            }';
        }
    ?>

    var array = [
            <?=implode(',', $arrayKecIncome);?>
        ];
        
    //Menampilkan data kecamatan choropleth-end
        
    L.control.layers(baseLayers, overlays).addTo(map);
Posted
Comments
gggustafson 1-May-21 14:25pm    
why are you closing and reopening php?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900