This project is read-only.

Define polygon cross 180 meridian

May 3 at 4:56 PM
Hello All,

I am new to DotSpatial and I try to define a polygon cross 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 shape file, 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.

Thank you very much!
May 4 at 7:50 AM
Please use DotSpatial.Controls.DatelineCrossingMap instead of DotSpatial.Controls.Map.

Map is not able to show date line crossing polygons correctly.
Marked as answer by kunluncat on 5/4/2017 at 10:32 AM
May 4 at 6:32 PM
Hi jany,

This really helps. Thank you very much!