public void UseShapefileFeaturesAdFeatureCoverageSource() { string path = Path.Combine(sharpMapGisShapeFilePath, "rivers.shp"); ShapeFile shapeFile = new ShapeFile(path); // select only some features from shapefile IEnvelope coverageFeatureEnvelope = shapeFile.GetExtents(); coverageFeatureEnvelope.ExpandBy(0.5, 0.5); FeatureCoverage coverage = new FeatureCoverage(); coverage.Components.Add(new Variable <double>("value")); coverage.Arguments.Add(new Variable <FeatureDataRow>("feature")); coverage.Features = new EventedList <IFeature>(shapeFile.GetFeatures(coverageFeatureEnvelope).Cast <IFeature>()); double[] values = new double[coverage.FeatureVariable.Values.Count]; for (int i = 0; i < values.Length; i++) { values[i] = i; } coverage.SetValues(values); }
public void FeatureCount() { string path = TestHelper.GetTestDataPath(@"DeltaShell\DeltaShell.Plugins.SharpMapGis.Tests\", "Europe_Lakes.shp"); IFeatureProvider dataSource = new ShapeFile(path); Assert.AreEqual(37, dataSource.Features.Count); Assert.IsTrue(dataSource.Features.Count == dataSource.GetFeatures(dataSource.GetExtents()).Count); }