Created
April 30, 2015 04:45
-
-
Save jccartwright/f5931e478beec1dc224f to your computer and use it in GitHub Desktop.
extract points along a line using JTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.vividsolutions.jts.linearref.LengthIndexedLine | |
import com.vividsolutions.jts.io.WKTReader | |
def reader = new WKTReader() | |
def line = reader.read("LINESTRING(10 10, -10 -10)") | |
def lil = new LengthIndexedLine(line) | |
def increment = 2 | |
def index = 0 | |
while (index <= line.length) { | |
println lil.extractPoint(index) | |
index += increment | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment