Java – how to create a polygon in JTS when we have a coordinate list?
                                        
                    •
                    Java                                    
                We can use this coordinate list to create a linestring:
Geometry g1 = new GeometryFactory().createLineString(coordinates);
How do we create polygons using coordinate lists?
Thank you in advance
Solution
The answers accepted in 2012 may still be valid (still embarrassing), but now you should do this:
// Create a GeometryFactory if you don't have one already GeometryFactory geometryFactory = new GeometryFactory(); // Simply pass an array of Coordinate or a CoordinateSequence to its method Polygon polygonFromCoordinates = geometryFactory.createPolygon(coordinates);
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        