public static Geometry removeCoordinates(Geometry geom) {
        if(geom ==null){
            return null;
        }
        else if (geom.isEmpty()) {
            return geom;
        } else if (geom instanceof Point){
            return geom;        }
         else if (geom instanceof MultiPoint) {
            return removeCoordinates((MultiPoint) geom);
        } else if (geom instanceof LineString) {
            return removeCoordinates((LineString) geom);
        } else if (geom instanceof MultiLineString) {
            return removeCoordinates((MultiLineString) geom);
        } else if (geom instanceof Polygon) {
            return removeCoordinates((Polygon) geom);
        } else if (geom instanceof MultiPolygon) {
            return removeCoordinates((MultiPolygon) geom);
        } else if (geom instanceof GeometryCollection) {
            return removeCoordinates((GeometryCollection) geom);
        }
        return null;
    }
public static Geometry removeCoordinates ( Geometry geom ) { if ( geom == null ) { return null ; } else if ( geom . isEmpty ( ) ) { return geom ; } else if ( geom instanceof Point ) { return geom ; } else if ( geom instanceof MultiPoint ) { return removeCoordinates ( ( MultiPoint ) geom ) ; } else if ( geom instanceof LineString ) { return removeCoordinates ( ( LineString ) geom ) ; } else if ( geom instanceof MultiLineString ) { return removeCoordinates ( ( MultiLineString ) geom ) ; } else if ( geom instanceof Polygon ) { return removeCoordinates ( ( Polygon ) geom ) ; } else if ( geom instanceof MultiPolygon ) { return removeCoordinates ( ( MultiPolygon ) geom ) ; } else if ( geom instanceof GeometryCollection ) { return removeCoordinates ( ( GeometryCollection ) geom ) ; } return null ; }
Removes duplicated coordinates within a geometry.

@param geom
@return