Home Dashboard Directory Help
Search

DbGeography.Intersects works incorrectly for a polygon intersected with two opposite hemispheres by Alexander Petropavlovsky


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 777462
Opened: 1/24/2013 7:32:32 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Say, we have the polygon which covers a Russia territory (by google maps geocoding):

    POLYGON ((19.64053 41.18535, -169.0465 41.18535, -169.0465 81.85812, 19.64053 81.85812, 19.64053 41.18535))

This polygon is intersected with the Northern hemisphere and two opposite hemispheres: the Eastern and the Western.

Let's take a point somewhere in Siberia:

    POINT (93.3252301 56.1171069)

And check what Siberia still stays in Russia:

    var russia = DbGeography.FromText("POLYGON ((19.64053 41.18535, -169.0465 41.18535, -169.0465 81.85812, 19.64053 81.85812, 19.64053 41.18535))", 4326);
    var point = DbGeography.FromText("POINT (93.3252301 56.1171069)", 4326);
    var isSiberiaInRussia = russia.Intersects(point);
    // isSiberiaInRussia equals false, and it's wrong.

Let's take a polygon which is intersected only with the Northern and the Eastern hemispheres. Let it be Moscow:
    
    POLYGON ((37.31933 55.48993, 37.94566 55.48993, 37.94566 56.00966, 37.31933 56.00966, 37.31933 55.48993))

And take the point in the Red Square:

    POINT (37.622504899999967 55.753602)

Let's check it:

    var moscow = DbGeography.FromText("POLYGON ((37.31933 55.48993, 37.94566 55.48993, 37.94566 56.00966, 37.31933 56.00966, 37.31933 55.48993))", 4326);
    var redSquare = DbGeography.FromText("POINT (37.622504899999967 55.753602)", 4326);
    var isRedSquareInMoscow = moscow.Intersects(redSquare);
    // isRedSquareInMoscow equals true, and it's right.
Details
Sign in to post a comment.
Posted by Microsoft on 1/25/2013 at 12:49 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 1/24/2013 at 7:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.