Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: Define polygon cross 180 meridian

$
0
0
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!

Viewing all articles
Browse latest Browse all 3973

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>