Me gustaría agregar dos atributos a la capa. Esta capa se dibuja utilizando el control de dibujo del folleto (nuevo L.Control.Draw). Primer atributo de desplegable y otro como texto libre . Puedo hacerlo por separado con la opción emergente, pero no funciona en conjunto. Por favor, revisa mi código y ayúdame a resolver este problema.
/ Leaflet Draw var drawnItems = new L.FeatureGroup(); map.addLayer(drawnItems); var drawControl = new L.Control.Draw({ edit: { featureGroup: drawnItems, poly: { allowIntersection: false } }, draw: { circle: false, circlemarker: false, polygon: { allowIntersection: false, showArea: true, } } }); map.addControl(drawControl); const dropdown = `Opt from dropdown: <select id="ddlViewBy"> <option value="building">building</option> <option value="road">road</option> <option value = "poi">poi</option> </select>: <button onclick="buttonFunction()">submit</button>`; // Object created - bind popup to layer, add to feature group map.on(L.Draw.Event.CREATED, function (event) { var layer = event.layer; var content = getPopupContent(layer); if (content !== null) { layer.bindPopup(content); } // Add info to feature properties feature = layer.feature = layer.feature || {}; feature.type = feature.type || "Feature"; var props = feature.properties = feature.properties || {}; // Intialize feature.properties props.info = content; //props.domain=domain; drawnItems.addLayer(layer); addPopup(layer) console.log(JSON.stringify(drawnItems.toGeoJSON())); }); function addPopup(layer) { var content = document.createElement("textarea"); content.addEventListener("keyup", function () { //layer.getPopup().on('remove', function() { console.log('ffff') layer.feature.properties.desc = content.value; }); layer.on("popupopen", function () { console.log('cccc') content.value = layer.feature.properties.desc; content.focus(); }); //layer.bindPopup(content,{closeOnClick: false, autoClose: true}).openPopup(); layer.bindPopup().setPopupContent(dropdown) buttonFunction = () => { const dropdonwValue = document.getElementById("ddlViewBy").value; layer.feature.properties.domain = dropdonwValue; layer.bindPopup(dropdonwValue,{closeOnClick: false, autoClose: true}) } var dupLayer= L.geoJSON(drawnItems); dupLayer.bindPopup(content,{closeOnClick: false, autoClose: true}).openPopup().addTo(map) }