Example #1
0
        static void ImportProvinceLayer(string path)
        {
            using (var shapefile = new Shapefile(path))
            {
                foreach (var shape in shapefile)
                {
                    ShapePolygon polygon = shape as ShapePolygon;

                    Province province = new Province();
                    province.Name    = shape.GetMetadata("name");
                    province.Country = shape.GetMetadata("country");
                    province.Shape   = Poly2Str(polygon.Parts);
                    province.ID      = db.Id(1);

                    long len = 0;

                    foreach (var i in polygon.Parts)
                    {
                        len = len + i.Length;
                    }

                    Assert.Test(len < 65535, () => province.Country + len);


                    db.Insert <Province>("Province", province);
                }
            }
        }