Skip to content

Date line bug using multi polygon #6

Description

@ayende

The following failing test demonstrate the problem.
A mutli polygon that crosses the date line doesn't work properly.

    using NetTopologySuite.Geometries;
    using NetTopologySuite.IO;
    using Spatial4n.Core.Context;
    using Spatial4n.Core.Context.Nts;
    using Spatial4n.Core.Shapes.Nts;
    using Xunit;

    namespace Spatial4n.Tests.bugs
    {
        public class DateLine
        {
            [Fact]
            public void ShouldWork()
            {
                var wktReader = new WKTReader(NtsSpatialContext.GEO.GetGeometryFactory());
                var poly = wktReader.Read("MULTIPOLYGON (((100 50, -100 50, -100 -50, 100 -50, 100 50)))");

                var polyShape = new NtsGeometry(poly, NtsSpatialContext.GEO, true);
                var ptShape = new NtsPoint(new Point(0, 0), SpatialContext.GEO);

                var spatialRelation = polyShape.Relate(ptShape);
                Assert.Equal(spatialRelation, Spatial4n.Core.Shapes.SpatialRelation.INTERSECTS);
            } 
        }
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions