简体   繁体   中英

How do I change / color the icon / marker on the leaflet

How do I change / color the icon / marker on the leaflet, I use geojson, use 2 different geojson from each other in this case the panels and lights, here I will give the 2 geojson, this is the link in question https://tholabulilmi.info/apps/datasurvey/map.php?id=436 I want the marker / icon panel to be different from the light point, thank you

enter code here (lampu geojson)

   
        # Pass Longitude and Latitude Columns here
        'coordinates' => array($row['longitude'], $row['latitude'])
    ),
    # Pass other attribute columns here
    'properties' => array(
        //'kode' => $row['kode'],
        //'marker-color' => '#e60f0f',
        'jenis_lampu' => $row['jenis_lampu'],
        'watt' => $row['watt'],
        'tiang' => $row['tiang'],
        'kabel' => $row['kabel'],
        'kondisi' => $row['kondisi'],
        'Date' => $row['Date'],
        //'tipe' => '1',
        'keterangan' => $row['keterangan']
        )
    );
# Add feature arrays to feature collection array
array_push($geojson['features'], $feature);

}

    # Pass other attribute columns here
    'properties' => array(
        //'marker-color' => '#e60f0f',
        'Idpel' => $row2['idpel'],
        'Rayon' => $row2['rayon'],
        'Daya' => $row2['daya'],
        'Alamat Lengkap' => $row2['alamat_lengkap'],
        'Date' => $row2['Date'],
        //'tipe' => '0',
        'Keterangan' => $row2['keterangan']
        )
    );
    array_push($geojson['features'], $feature);

You can use the images and instructions in this repo: leaflet-colored-markers . In regards of how to apply them to points in a GeoJSON, you can read about that here: Leaflet: how to use a custom marker on a geojson layer? .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM