Exemple #1
0
        public static Grid FromShapeFile(string shapeFilePath, RutenettType rutenettType, int epsgCode)
        {
            var grid = new Grid(rutenettType);

            Shapefile shapeFile   = Shapefile.OpenFile(shapeFilePath);
            var       numFeatures = shapeFile.NumRows();

            for (var i = 0; i < numFeatures; i++)
            {
                var feature = shapeFile.GetFeature(i);
                var cell    = new GridCell();
                cell.CellId = feature.DataRow[0].ToString();
                var text = new SqlChars(feature.BasicGeometry.ToString());
                cell.Geometry = SqlGeometry.STGeomFromText(text, epsgCode);
                grid.Cells.Add(cell);
            }

            return(grid);
        }