I've just had some thoughts on this and wanted to see if my assumptions are correct. I'm going to deal with one line segment in relation to the neatline at a time.

The neatline will be created as a LineString in a clockwise direction (right hand rule).

The line segment to create the polygon must be trimmed so that it does not extend beyond the neatline and must already follow the RHR.

The neatline and the line segment will be noded by using the union operator to create a MultiLineString.

The diagram below shows a + for the start/end of each line segment and arrows for the direction and numbers for each segment

   ------+---->------
   |      \         |
   |       \  4     |
1  ^       \/       v 2
   |         \      |
   |          \     |
   +------<----+-----
         3


Each noded line it the MultiLineString will be processed.

Create a list to store line segments that are part of the polygon and put the original line segment in it.

If the start of a noded line string shares the same coordinate as the end of original line string then given that the line and the neatline follow the RHR the noded segment must be appended to the end of the list of polygon line segments.

In the diagram segment 3 will be matched

If the end of a noded line string shares the same coordinate as the end of the original line string the that the line and the neatline follow the RHR the noded segment must be inserted at the beginning of the list of polygon line segments. This check is required as you will get two line segments around the start of the neatline geometry

In the diagram segment 1 will be matched.

After processing all the segments we will have the polygon.

Now if you have the classic double sided river case where both lines cross the neatline then what you can do is create a new polygon from the intersection of the two geometries.

Can anyone see any problems with this.

Paul

P.S. again ignore the hole case


The neatline geometry is created

Paul Austin wrote:

I have a data set which uses line strings to represent polygons. In some cases these line strings do not form a closed ring directly, instead it uses the neatline of a mapsheet to virtually close the polygon within that sheet (the full polygon would be across multiple sheets). In the following example there is a line for river that goes from the bottom to the top of the sheet with the river on the right. +---------+----------+ | \ | | \ | | \ | | \ | | \ | +------------------+-+ Is there an easy way given a line string geometry and a polygon neatline to create a new polygon for the river portion on the right? Cheers, Paul _______________________________________________ jts-devel mailing list [email protected] http://lists.refractions.net/mailman/listinfo/jts-devel

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to