コード例 #1
0
        public IEnumerable<KeyValuePair<string, DbGeography>> Read(string filePath, string nameColumnIdentifier)
        {
            var shapes = new ShapeFileHelper().Read(filePath, nameColumnIdentifier);
            return shapes.AsParallel().Select(x =>
            {
                var transformedGeography = GeometryTransform.TransformGeometry(
                    GeometryFactory.Default, x.Value, _transform);

                var sqlGeography = SqlGeography.STGeomFromText(new SqlChars(transformedGeography.AsText()), 4326)
                    .MakeValid();

                var invertedSqlGeography = sqlGeography.ReorientObject();
                if (sqlGeography.STArea() > invertedSqlGeography.STArea())
                {
                    sqlGeography = invertedSqlGeography;
                }

                var dbGeography = DbSpatialServices.Default.GeographyFromProviderValue(sqlGeography);

                return new KeyValuePair<string, DbGeography>(x.Key, dbGeography);
            });
        }
コード例 #2
0
 public void ReadShapeFile()
 {
     var shapes = new ShapeFileHelper().Read("..\\..\\..\\data\\KOMMUNE", "KOMNAVN").ToList();
 }