Thursday, July 01, 2004

OSEI Spatial

I tried to add the AnitMeridianLineSplitter to the OSEI spatial chaing, but apparently the JTS GeometryEditor class does not allow structure to be altered. The LineSplitter takes a polygon and if it crosses the AntiMeridian, it makes it a Multi Part Polygon, which is altering the structure.

So I created a Spatial Chain object that allows this type of thing.

Unfortunately, I realized that the AnitMeridianLineSplitter does not encompass my problem.

Here is an example:
-107.96, -5.5,
-107.96, -25,
-133, -25,
-133, -5.5,
-107.96, -5.5

Note that the outer ring is supposed to be specified counter clockwise to determine which side of the outer ring is the inside of the polygon. In this case, the inside of the polygon would be everything outside of this outer ring. This is not correct and the line does not cross the anti meridian. But we want the polygon to cross (figuratively) the anti meridian.

So what has to be done, is that the polygon needs to be detached from itself and attached to the anti meridian to form two polygons:

-107.96,-5.5
-107.96,-25
180,-25
180,-5.5
-107.96,-5.5

-133, -5.5
-180, -5.5
-180, -25
-133, -25
-133, -5.5

I realize that this is not a good example because the longitude values are just accidentally flipped, but it still gets the point accross.

No comments: