Skip to content

Commit

Permalink
Merge pull request #10 from USACE/hotfix/cut-line-match
Browse files Browse the repository at this point in the history
Change InterpolatedLine field to CutLineProfileMatch
  • Loading branch information
ShaneMPutnam authored Jan 25, 2021
2 parents 0fe62e3 + 8414bdb commit 6936fe1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/geospatial.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func getXSBanks(sc *bufio.Scanner, transform gdal.CoordinateTransform, riverReac
if err != nil {
return xsLayer, bankLayers, err
}
if xsLayer.Fields["InterpolatedLine"].(bool) {
if xsLayer.Fields["CutLineProfileMatch"].(bool) {
for sc.Scan() {
line := sc.Text()
if strings.HasPrefix(line, "Bank Sta=") {
Expand All @@ -290,7 +290,7 @@ func getXS(sc *bufio.Scanner, transform gdal.CoordinateTransform, riverReachName
xyPairs := [][2]float64{}
layer := VectorLayer{Fields: map[string]interface{}{}}
layer.Fields["RiverReachName"] = riverReachName
layer.Fields["InterpolatedLine"] = false
layer.Fields["CutLineProfileMatch"] = false

compData := strings.Split(rightofEquals(sc.Text()), ",")

Expand All @@ -316,13 +316,13 @@ func getXS(sc *bufio.Scanner, transform gdal.CoordinateTransform, riverReachName
}
lenProfile := mzPairs[len(mzPairs)-1][0] - mzPairs[0][0]

if lenProfile-lenCutLine <= 0.1 {
if math.Abs(lenProfile-lenCutLine) <= 0.1 {
xyzPoints := attributeZ(xyPairs, mzPairs)
xyzLineString = gdal.Create(gdal.GT_LineString25D)
for _, point := range xyzPoints {
xyzLineString.AddPoint(point.x, point.y, point.z)
}
layer.Fields["InterpolatedLine"] = true
layer.Fields["CutLineProfileMatch"] = true
}

xyzLineString.Transform(transform)
Expand Down

0 comments on commit 6936fe1

Please sign in to comment.