View README.md

The previous example showed how to intersect a line with a polygon, but the situations can be more complicated, as shown in this example.

The solution is using the lineSplit function for each part of the multilinestring and selecting the ones that fit the needs. The first part can be inside or outside the polygon, depending on the first point. Detecting this, is easy to get only the needed parts.

View README.md

Example to ilustrate this question at gis.stackoverflow.

The solution is using a combination of lineIntersect and lineSlice. The first one gives the points where the line and the polygon intersect. The second takes the part of the polyline btween the two points.

If the result is more complex (i.e. the resulting intersection is a polyline), the algorithm should be repeated for each part in the polygon.

View .block
licence: mit
View .block
licence: mit
View .block
licence: mit
View .block
licence: mit
View README.md

This is an example from the post Canvas mapping with a retina display.

The upper part of the map is not corrected for retins displays and will appear blurred in them, and the lower part is corrected and should appear with sharp edges.

See the post to learn how to simulate the retina display if your device doesn't have it.

View README.md
View .block
licence: mit
View .block
licence: mit