Javascript 如何使用传单添加和保存功能属性GeoJSON

Javascript 如何使用传单添加和保存功能属性GeoJSON,javascript,web,leaflet,geojson,Javascript,Web,Leaflet,Geojson,我有一个名为json_point2的GeoJSON文件。 此文件保存点数据,如下所示 var json_point2={ "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [ { "type": "Feature", "properties": { "Class": null }, "geome

我有一个名为json_point2的GeoJSON文件。 此文件保存点数据,如下所示

var json_point2={
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "Class": null }, "geometry": { "type": "Point", "coordinates": [ 40.193168611061743, 40.904508523555492 ] } },
{ "type": "Feature", "properties": { "Class": null }, "geometry": { "type": "Point", "coordinates": [ 40.191358449981372, 40.902051540140285 ] } },
当我在web应用程序上单击此点时,我想输入类的输入值并再次保存此值

我可以使用以下代码单击该点并输入属性。但他并没有将其记录在数据库中

麦可德

 map.createPane('pane_point2');
map.getPane('pane_point2').style.zIndex = 602;
map.getPane('pane_point2').style['mix-blend-mode'] = 'normal';
var layer_point2 = new L.geoJson(json_point2, {
    attribution: '<a href=""></a>',
    pane: 'pane_point2',
    onEachFeature: function (feature, layer) {
        var input = L.DomUtil.create('input', 'my-input');
        input.value = feature.properties.Class;
        L.DomEvent.addListener(input, 'change', function () {
            feature.properties.Class = input.value;
        });
        layer.bindPopup(input);
        layer_point2.toGeoJSON();
    }   
}).addTo(map);
map.createPane('pane_point2');
map.getPane('pane_point2')。style.zIndex=602;
map.getPane('pane_point2')。style['mix-blend-mode']='normal';
var layer_point2=新的L.geoJson(json_point2{
归属:'',
窗格:“窗格_点2”,
onEachFeature:功能(功能,图层){
var input=L.DomUtil.create('input','my input');
input.value=feature.properties.Class;
L.DomEvent.addListener(输入'change',函数(){
feature.properties.Class=input.value;
});
图层绑定弹出窗口(输入);
layer_point2.toGeoJSON();
}   
}).addTo(地图);

您是说文件在添加值时不会更新吗?如果是这样,那是因为您需要在添加属性后将更新的数据写入文件。否则下次加载文件时它将不在那里。是的,我想添加新值并更新geojson文件。如何在我的GeoJson文件中添加新的atribute值并保存它。我在代码部分做了一些更改,但没有成功。layer_point2_toGeoJSON();不起作用我可以通过弹出的o web应用程序给出值,但ıdint'将此值添加到我的geojson文件中。