public final class Polygon
extends java.lang.Object
double[]
coordinates, or use fromGeoJSON(java.lang.String)
if you have a polygon already encoded as a
GeoJSON string.
NOTES:
spatial-extras
module
Modifier and Type | Field and Description |
---|---|
double |
maxLat
maximum latitude of this polygon's bounding box area
|
double |
maxLon
maximum longitude of this polygon's bounding box area
|
double |
minLat
minimum latitude of this polygon's bounding box area
|
double |
minLon
minimum longitude of this polygon's bounding box area
|
Constructor and Description |
---|
Polygon(double[] polyLats,
double[] polyLons,
Polygon... holes)
Creates a new Polygon from the supplied latitude/longitude array, and optionally any holes.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static Polygon[] |
fromGeoJSON(java.lang.String geojson)
Parses a standard GeoJSON polygon string.
|
Polygon[] |
getHoles()
Returns a copy of the internal holes array
|
double |
getPolyLat(int vertex)
Returns latitude value at given index
|
double[] |
getPolyLats()
Returns a copy of the internal latitude array
|
double |
getPolyLon(int vertex)
Returns longitude value at given index
|
double[] |
getPolyLons()
Returns a copy of the internal longitude array
|
GeoUtils.WindingOrder |
getWindingOrder()
Returns the winding order (CW, COLINEAR, CCW) for the polygon shell
|
int |
hashCode() |
int |
numHoles()
returns the number of holes for the polygon
|
int |
numPoints()
returns the number of vertex points
|
java.lang.String |
toGeoJSON()
prints polygons as geojson
|
java.lang.String |
toString() |
static java.lang.String |
verticesToGeoJSON(double[] lats,
double[] lons) |
public final double minLat
public final double maxLat
public final double minLon
public final double maxLon
public Polygon(double[] polyLats, double[] polyLons, Polygon... holes)
public int numPoints()
public double[] getPolyLats()
public double getPolyLat(int vertex)
public double[] getPolyLons()
public double getPolyLon(int vertex)
public Polygon[] getHoles()
public GeoUtils.WindingOrder getWindingOrder()
public int numHoles()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String verticesToGeoJSON(double[] lats, double[] lons)
public java.lang.String toGeoJSON()
public static Polygon[] fromGeoJSON(java.lang.String geojson) throws java.text.ParseException
java.text.ParseException
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.