Select to view content in your preferred language

KML Custom Data

256
1
Jump to solution
10-16-2024 03:35 AM
DmitriyKolokolnikov
Emerging Contributor

Does KML Placemark support storing custom data? I tried using KmlPlacemark.Attributes[], but it didn't seem to have any effect. What am I doing wrong?

 

 

// Create a new KML document.
_kmlDocument = new KmlDocument() { Name = "Vehicle Path" };

// Create a KML dataset using the KML document.
_kmlDataset = new KmlDataset(_kmlDocument);

// Create the KML layer using the KML dataset.
_kmlLayer = new KmlLayer(_kmlDataset);

// Create a KmlGeometry 
KmlGeometry kmlGeometry = new KmlGeometry(location, KmlAltitudeMode.Absolute);

// Create a new placemark.
KmlPlacemark kmlPlacemark = new KmlPlacemark(kmlGeometry);

// Add a Attribute
kmlPlacemark.Attributes["speed"] = VehicleSpeed;

// Add the placemark to the KmlDocument.
_kmlDocument?.ChildNodes.Add(kmlPlacemark);

// Save a file
_kmlDocument?.SaveAsAsync("test.kmz");
0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

We're actively working on this, and editing custom data is planned to be available in the next release.
In the current 200.5 release you can access the custom data (read-only) in KmlNode.ExtendedSchemaData and KmlNode.ExtendedNonSchemaData

View solution in original post

1 Reply
dotMorten_esri
Esri Notable Contributor

We're actively working on this, and editing custom data is planned to be available in the next release.
In the current 200.5 release you can access the custom data (read-only) in KmlNode.ExtendedSchemaData and KmlNode.ExtendedNonSchemaData