I found marker-size: medium in the properties section in the GeoJSON file. so I want to call that marker-size, to be used in the PHP Leaflet code. So I need a solution for using this marker size and how can I solve it easily
===========geojson data=========================
{
"type":"FeatureCollection",
"features":[
{
"type":"Feature",
"properties":{"markercolor":"#1e7e7e","marker-size":"medium","marker-symbol":"","title":"Indonesia"},
"geometry":{"type":"Point","coordinates":[107.9296875,-6.664607562172573]}
},
{
"type":"Feature",
"properties":{},
"geometry":{"type":"Point","coordinates":[114.873046875,4.565473550710278]}
},
========leaflet php code===========
pointToLayer: function(feature, latlng) {
var smallIcon = L.icon({
iconSize:feature.properties.marker_size,
iconAnchor: [13, 27],
popupAnchor: [1, -24],
});
return L.marker(latlng, {icon: smallIcon});
},
onEachFeature:onEachFeature
}).addTo(mymap);
});
L.circleMarker
has nosize
option, onlyradius
. Please edit your question end explain the rule/formula of how you want to assign marker size on the basis of feature properties. Marker radius is a number, and there is no such property in your GeoJSON data.medium
size. You can only specify markerradius
, where radius is size in pixels. You have to decide how big (what radius) will your marker be formedium
property value.