I have very large number of polygons and I want to render them on world wind. So was I was using their Polygon class as follows:
ShapeAttributes normalAttributes = new BasicShapeAttributes();
normalAttributes.setInteriorMaterial(Material.YELLOW);
normalAttributes.setOutlineWidth(2);
normalAttributes.setOutlineOpacity(0.5);
normalAttributes.setDrawInterior(true);
normalAttributes.setDrawInterior(true);
//define the coordinates position
ArrayList<Position> positions = new ArrayList<Position>();
positions.add(Position.fromDegrees(52, 10, 5e4));
positions.add(Position.fromDegrees(55, 11, 5e4));
positions.add(Position.fromDegrees(55, 11, 5e4));
positions.add(Position.fromDegrees(52, 14, 5e4));
positions.add(Position.fromDegrees(52, 10, 5e4));
Polygon poly = new Polygon(positions);
It works for small data-sets, but when the number of polygons increase(~45k), It runs out of memory(4GB), or for lesser number runs slowly. Can someone suggest some technique to render such a large data-set efficiently. Thanks,
It may be that you need to simplify the number of points in the polygon. One method of doing this is using the Ramer-Douglas-Peucker algorithm. Using this, you can greatly reduce the number of points within your polygon while maintaining its shape.
There are many implementations of this algorithm available, depending on licensing, including simplify-java (MIT licence).