Edit Vector Layers using GIS C# Library
Contents
[
Hide
]
Edit Vector Layers
Aspose.GIS API lets you to edit vector layers as shown in the code snippet below.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
using (var layer = Drivers.Kml.EditLayer(Path.Combine(workFolder, "edit_me_out.kml"))) | |
{ | |
// add | |
Feature featureToAdd = layer.ConstructFeature(); | |
featureToAdd.SetValue("string_field", "new_value"); | |
featureToAdd.Geometry = new Point(5, 5); | |
layer.Add(featureToAdd); | |
// update | |
Feature featureToReplace = layer.ConstructFeature(); | |
featureToReplace.SetValue("string_field", "updated_value"); | |
featureToReplace.Geometry = new Point(12, 12); | |
layer.ReplaceAt(1, featureToReplace); | |
// remove | |
layer.RemoveAt(0); | |
} |