1

I am new to DotSpatial and I try to define a polygon that crosses the 180 meridian by following:

        FeatureSet fs = new FeatureSet(FeatureType.Polygon);
        Coordinate[] coord = new Coordinate[5];
        coord[0] = new Coordinate(30, 48);
        coord[1] = new Coordinate(120, 45);
        coord[2] = new Coordinate(-170, 64);
        coord[3] = new Coordinate(30, 70);
        coord[4] = new Coordinate(30, 48);
        Polygon pg = new Polygon(coord);
        pg.Normalize();
        fs.Features.Add(pg);
        fs.Projection = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984;
        fs.SaveAs(HttpContext.Current.Server.MapPath("~/shp/test2.shp"), true);

However, when I check the shapefile, the polygon comes out to be

Image

If I draw the same polygon in SQL Server with

DECLARE @Poly geography =   
  geography::STPolyFromText('POLYGON((30 48, 120 45, -170 64, 30 70, 30 48))', 4326)  
SELECT @Poly 

I can see the polygon shown as

Image

Can anyone help me how to solve this issue in DotSpatial?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.