public void NoPrjFileThenSetCoordinateSystemGivesSpatialRefToGeometries() { //Layer name: BCROADSWithoutDbf //Geometry: Line String //Feature Count: 7291 //Extent: (7332083.212797, 236823.718672) - (7538428.618000, 405610.346926) ShapeFileProvider shapeFile = new ShapeFileProvider( BcRoadsWithOutDbfShapeFile, _geoFactory); shapeFile.Open(); ICoordinateSystemFactory <BufferedCoordinate2D> coordSysFactory = _coordSysFactory; String wkt = File.ReadAllText(BcRoadsPrjFile); IProjectedCoordinateSystem cs = WktReader <BufferedCoordinate2D> .ToCoordinateSystemInfo(wkt, coordSysFactory) as IProjectedCoordinateSystem; shapeFile.SpatialReference = cs; Assert.IsNotNull(shapeFile.SpatialReference); IGeometry g = shapeFile.GetGeometryByOid(0); Assert.IsTrue(g.SpatialReference.EqualParams(createExpectedCoordinateSystem())); shapeFile.Close(); }
public void NoPrjFileThenSetCoordinateSystemGivesSpatialRefToGeometries() { //Layer name: BCROADSWithoutDbf //Geometry: Line String //Feature Count: 7291 //Extent: (7332083.212797, 236823.718672) - (7538428.618000, 405610.346926) ShapeFileProvider shapeFile = new ShapeFileProvider( BcRoadsWithOutDbfShapeFile, _geoFactory); shapeFile.Open(); ICoordinateSystemFactory<BufferedCoordinate2D> coordSysFactory = _coordSysFactory; String wkt = File.ReadAllText(BcRoadsPrjFile); IProjectedCoordinateSystem cs = WktReader<BufferedCoordinate2D> .ToCoordinateSystemInfo(wkt, coordSysFactory) as IProjectedCoordinateSystem; shapeFile.SpatialReference = cs; Assert.IsNotNull(shapeFile.SpatialReference); IGeometry g = shapeFile.GetGeometryByOid(0); Assert.IsTrue(g.SpatialReference.EqualParams(createExpectedCoordinateSystem())); shapeFile.Close(); }