Skip to content

Instantly share code, notes, and snippets.

@tnaka78
Created October 8, 2015 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnaka78/8d02006fadc393532579 to your computer and use it in GitHub Desktop.
Save tnaka78/8d02006fadc393532579 to your computer and use it in GitHub Desktop.
NetTopologySuiteを使ってShapefileを読むプログラム
using GeoAPI.Geometries;
using NetTopologySuite.Geometries;
using NetTopologySuite.IO;
namespace NTSReadShapefileExample
{
class Program
{
static void Main(string[] args)
{
IGeometryFactory factory = new GeometryFactory();
using (ShapefileDataReader reader = new ShapefileDataReader(@"c:\work\aed_20150515\aed_20150515.shp", factory))
{
while (reader.Read())
{
Point geom = reader.Geometry as Point;
System.Console.WriteLine(string.Format("{0}: {1:F4},{2:F4}", reader.GetString(1), geom.X, geom.Y));
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment