vendredi 3 mars 2017

Add and save feature attribute Geojeson with leaflet

I have Geojson file named json_point2. This file holds point data as follows.

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 ] } },

When I click this point on my web apps, I want to enter input value of class and save this value again.

I can click on the point with the following code and enter the attribute. But he does not record it in his database.

Mycode var layer_point2 = new L.geoJson(json_point2, { attribution: '', pane: 'pane_point2', onEachFeature: function (json_point2, layer) { var input = L.DomUtil.create('input', 'my-input'); input.value = json_point2.properties['Class']; L.DomEvent.addListener(input, 'change', function () { json_point2.properties['Class'] = input.value; }); layer.bindPopup(input); }
}).addTo(map)




Aucun commentaire:

Enregistrer un commentaire