Created
October 8, 2015 16:14
-
-
Save tnaka78/8d02006fadc393532579 to your computer and use it in GitHub Desktop.
NetTopologySuiteを使ってShapefileを読むプログラム
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 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