Skip to content

Commit

Permalink
Correct faulty input geometries
Browse files Browse the repository at this point in the history
  • Loading branch information
jpolchlo authored and echeipesh committed Oct 12, 2021
1 parent 5f45510 commit 5b4a436
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ object SpatialFeatureDF {
FeatureDF(input, featureObj, filters, spark, delimiter)
val emptyPolygonWKB = "0106000020E610000000000000"

// ST_PrecisionReduce may create invalid geometry if it contains a "sliver" that is below the precision threshold
// ST_Buffer(0) fixes these invalid geometries
featureDF
.selectExpr(
s"ST_PrecisionReduce(ST_GeomFromWKB(${wkbField}), 11) AS polyshape",
s"ST_Buffer(ST_PrecisionReduce(ST_GeomFromWKB(${wkbField}), 11), 0) AS polyshape",
s"struct(${featureObj.featureIdExpr}) as featureId"
)
.where(s"${wkbField} != '${emptyPolygonWKB}'")
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "1.7.6"
version in ThisBuild := "1.7.7"

0 comments on commit 5b4a436

Please sign in to comment.