locked
"Best Practices" when spanning International dateline? RRS feed

  • Question

  • Is there a generally accepted "best practice" for dealing with lines/polygons that span the international dateline?  Any special considerations for use of Geometry vs Geography in this case?

     

    I am imagining that there will also need to be some "trickery" done in any drawing code to render the image to the user (using MapPoint, Virtual Earth, etc).  Any reference to a known best practice for drawing items spanning the dateline would also be appreciated.
    Monday, April 21, 2008 3:12 PM

Answers

  • For geometry you will have to split your data in two along the date line.

    For geography you just continue right over the dateline. for instance if you want to make a line that crosses the dateline using geography, you will only need the endpoints: (170,0 -> -170,0).

    If you did this line using geometry, it would go the long way around Earth. Geography automatically chooses the shortest part.

    For Geometry, you will need to split that line into a MultiLineString: (170,0 -> 180,0) and (-180,0 -> -170,0).

    The same goes for polygons - You can view each line segment along the edge of the polygon as a line.

     

    The big problem comes when you have geometry-based data that you want to insert into your geography instance. Russia is a good example, because you will have two polygons that share the same border along the dateline. In order to import that into a geography column, you would first have to merge the two polygons together, removing the line along the dateline.

    Tuesday, April 22, 2008 5:21 AM
    Answerer