You can find detailed information at: Read Vector Layer Features, Points, and Geometries from CSV Files
Last active
November 5, 2021 20:31
-
-
Save aspose-com-gists/504b09424d4da605ce3e21f1021cf957 to your computer and use it in GitHub Desktop.
Read Vector Layer Features, Points, and Geometries from CSV Files
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
using (var layer = Drivers.Csv.OpenLayer(dataDir + "sample.csv")) | |
{ | |
// Print attributes | |
foreach (var attribute in layer.Attributes) | |
{ | |
Console.Write($"'{attribute.Name}' "); | |
} | |
Console.WriteLine(); | |
// Print records | |
foreach (var feature in layer) | |
{ | |
var dump = feature.GetValuesDump(); | |
foreach (var item in dump) | |
{ | |
Console.Write($"'{item}' "); | |
} | |
Console.WriteLine(); | |
} | |
} |
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
using (var layer = Drivers.Csv.OpenLayer(dataDir + "geometries.csv", | |
new CsvOptions() | |
{ | |
ColumnWkt = "geom_data" | |
})) | |
{ | |
// Print geometry in wkt format | |
foreach (var feature in layer) | |
{ | |
Console.Write($"'{feature.Geometry.AsText()}: "); | |
Console.WriteLine(); | |
} | |
} |
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
using (var layer = Drivers.Csv.OpenLayer(dataDir + "geometries.csv", | |
new CsvOptions() | |
{ | |
ColumnX = "x", | |
ColumnY = "y", | |
ColumnZ = "z", | |
ColumnM = "m" | |
})) | |
{ | |
// Print geometry in wkt format | |
foreach (var feature in layer) | |
{ | |
Console.Write($"'{feature.Geometry.AsText()}: "); | |
Console.WriteLine(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment