Last active
October 25, 2017 13:04
-
-
Save airbreather/0937a51d8949e467e1bc61be7c970e3f to your computer and use it in GitHub Desktop.
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 System; | |
using System.ComponentModel; | |
using GeoAPI; | |
using GeoAPI.Geometries; | |
using NetTopologySuite.Geometries; | |
using NetTopologySuite.IO; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
const string ShapefilePath = "foo.shp"; // change me. obviously. | |
NetTopologySuiteBootstrapper.Bootstrap(); | |
var rd = new ShapefileDataReader(ShapefilePath, GeometryFactory.Default); | |
foreach (ICustomTypeDescriptor dsc in rd) | |
{ | |
int i = 0; | |
foreach (PropertyDescriptor val in dsc.GetProperties()) | |
{ | |
Console.Write("[{0}]: ", i++); | |
object finalValue = val.GetValue(dsc); | |
switch (finalValue) | |
{ | |
case IGeometry geom: | |
Console.Write("(geom)"); | |
break; | |
default: | |
Console.Write("{0} = {1}", val.Name, finalValue); | |
break; | |
} | |
Console.Write("; "); | |
} | |
Console.WriteLine(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment