public static Geometry simplifyGeometry ( TDWay way , Geometry geometry , byte zoomlevel , int tileSize , double simplificationFactor ) { Geometry ret = null ; Envelope bbox = geometry . getEnvelopeInternal ( ) ; // compute maximal absolute latitude (so that we don't need to care if we // are on northern or southern hemisphere) double latMax = Math . max ( Math . abs ( bbox . getMaxY ( ) ) , Math . abs ( bbox . getMinY ( ) ) ) ; double deltaLat = deltaLat ( simplificationFactor , latMax , zoomlevel , tileSize ) ; try { ret = TopologyPreservingSimplifier . simplify ( geometry , deltaLat ) ; } catch ( TopologyException e ) { LOGGER . log ( Level . FINE , "JTS cannot simplify way due to an error, not simplifying way with id: " + way . getId ( ) , e ) ; way . setInvalid ( true ) ; return geometry ; } return ret ; }
Simplifies a geometry using the Douglas Peucker algorithm .