@@ -754,24 +754,13 @@ export class FeatureTiles {
754754 * @since 2.0.0
755755 */
756756 simplifyPoints ( lineString : any , isPolygon = false ) : any | null {
757- const coords = simplify (
757+ lineString . coordinates = simplify (
758758 lineString . coordinates . map ( coordinate => {
759759 return { x : coordinate [ 0 ] , y : coordinate [ 1 ] } ;
760760 } ) ,
761761 this . simplifyToleranceInPixels ,
762762 false ,
763763 ) . map ( point => [ point . x , point . y ] ) ;
764- if ( isPolygon ) {
765- if ( coords . length < 4 ) {
766- return null ;
767- } else if ( coords [ 0 ] [ 0 ] !== coords [ coords . length - 1 ] [ 0 ] || coords [ 0 ] [ 1 ] !== coords [ coords . length - 1 ] [ 1 ] ) {
768- // if first and last point do not match, add first point to end
769- coords . push ( coords [ 0 ] . slice ( ) ) ;
770- }
771- } else if ( coords . length < 2 ) {
772- return null ;
773- }
774- lineString . coordinates = coords ;
775764 return lineString ;
776765 }
777766
@@ -792,7 +781,7 @@ export class FeatureTiles {
792781 ] ;
793782 } ) ;
794783 const simplifiedLineString = this . simplifyGeometries ? this . simplifyPoints ( lineString , isPolygon ) : lineString ;
795- if ( simplifiedLineString . coordinates . length > 0 ) {
784+ if ( simplifiedLineString . coordinates . length > 1 ) {
796785 context . moveTo ( simplifiedLineString . coordinates [ 0 ] [ 0 ] , simplifiedLineString . coordinates [ 0 ] [ 1 ] ) ;
797786 for ( let i = 1 ; i < simplifiedLineString . coordinates . length ; i ++ ) {
798787 context . lineTo ( simplifiedLineString . coordinates [ i ] [ 0 ] , simplifiedLineString . coordinates [ i ] [ 1 ] ) ;
0 commit comments