Software14
Software14

Reputation: 179

Java How to set new coordinates to a geometry in 2D

I have some geometry in 3D and I woudlike to return a geometry in 2D (dimension 2) with new coordinates :

private static Geometry convert2D(Geometry g3D) {
        // copy geometry
        Geometry g2D = (Geometry) g3D.clone();
        Geometry geometry;
        // set new 2D coordinates
        for (Coordinate c : g2D.getCoordinates()) {
            c.setCoordinate(new Coordinate(c.x, c.y));
        }

        // SET NEW COORDINATES TO g2D 
        
        return g2D;
    }

How can I do that with because the object geometry don't have the method setCoordinates ?

Upvotes: 1

Views: 202

Answers (0)

Related Questions