class Polygon extends Geometry
A Polygon Geometry.
You can create a Polygon with no holes by providing a LinearRing:
Polygon p = new Polygon(new LinearRing([[1,1],[4,1],[4,4],[1,1]]))
Or you can create a Polygon with an exterior LinearRing and a List of hole LinearRings:
Polygon p = new Polygon(new LinearRing([1,1], [10,1], [10,10], [1,10], [1,1]), [new LinearRing([2,2], [4,2], [4,4], [2,4], [2,2]), new LinearRing([5,5], [6,5], [6,6], [5,6], [5,5])])
Or you can create a Polygon with no holes by providing a variable List of Doubles:
Polygon p = new Polygon([1,2],[3,4],[5,6],[1,2])
Or you can create a Polygon a List of a List of a List of Doubles. The first List of List of Doubles is the exterior ring. Others are holes.
Polygon p = new Polygon([[[1,2],[3,4],[5,6],[1,2]]])
Or you can create a Polygon a List LinearRings. The first List of List of Doubles is the exterior ring. Others are holes.
Polygon p = new Polygon([new LinearRing([1,1], [10,1], [10,10], [1,10], [1,1]), new LinearRing([2,2], [4,2], [4,4], [2,4], [2,2]), new LinearRing([5,5], [6,5], [6,6], [5,6], [5,5])])
Constructor and description |
---|
Polygon
(Polygon poly) Create a new Polygon by wrapping a JTS Polygon. |
Polygon
(LinearRing ring) Create a Polygon with no holes. |
Polygon
(LinearRing ring, java.util.List<LinearRing> holes) Create a new Polygon with an exterior ring and a List of holes. |
Polygon
(java.util.List<java.lang.Double>[] ring) Create a new Polygon with an exterior ring as a List of List of Doubles |
Polygon
(java.util.List rings) Create a new Polygon from a List of a List of a List of Doubles or LinearRings. |
Type Params | Return Type | Name and description |
---|---|---|
|
LineString |
getExteriorRing() Get the exterior ring or shell |
|
LineString |
getInteriorRingN(int n) Get the nth interior ring or hole |
|
java.util.List<LineString> |
getInteriorRings() Get a List of all interior rings |
|
int |
getNumInteriorRing() Get the number of interior rings or holes |
|
MultiPolygon |
plus(Polygon poly) Add this Polygon with another to create a MultiPolygon. |
|
Geometry |
split(LineString lineString) Split a Polygon with a LineString |
|
Geometry |
split(MultiLineString multiLineString) Split a Polygon with a MultiLineString |
Create a new Polygon by wrapping a JTS Polygon.
poly
- A JTS PolygonCreate a Polygon with no holes.
Polygon p = new Polygon(new LinearRing([[1,1],[4,1],[4,4],[1,1]]))
ring
- A LinearRingCreate a new Polygon with an exterior ring and a List of holes.
Polygon p = new Polygon(new LinearRing([1,1], [10,1], [10,10], [1,10], [1,1]), [new LinearRing([2,2], [4,2], [4,4], [2,4], [2,2]), new LinearRing([5,5], [6,5], [6,6], [5,6], [5,5])])
ring
- A LinearRing for the exterior shellholes
- A List of LinearRings for the holesCreate a new Polygon with an exterior ring as a List of List of Doubles
Polygon p = new Polygon([1,2],[3,4],[5,6],[1,2])
ring
- A variable List of List of DoublesCreate a new Polygon from a List of a List of a List of Doubles or LinearRings. The first List of List of Doubles is the exterior ring. Others are holes.
Polygon p = new Polygon([[[1,2],[3,4],[5,6],[1,2]]]) Polygon p = new Polygon([new LinearRing([1,1], [10,1], [10,10], [1,10], [1,1]), new LinearRing([2,2], [4,2], [4,4], [2,4], [2,2]), new LinearRing([5,5], [6,5], [6,6], [5,6], [5,5])])
rings
- A List of LinearRings or a List of List of DoublesGet the exterior ring or shell
Get the nth interior ring or hole
n
- The index of a interior ring or holeGet a List of all interior rings
Get the number of interior rings or holes
Add this Polygon with another to create a MultiPolygon.
poly
- The other PolygonSplit a Polygon with a LineString
lineString
- The LineStringSplit a Polygon with a MultiLineString
multiLineString
- The MultiLineString