Class: GeometryFactory

jsts.geom.GeometryFactory

new GeometryFactory()

Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0.
Source:

Methods

buildGeometry(geomList) → {Geometry}

Build an appropriate Geometry, MultiGeometry, or GeometryCollection to contain the Geometrys in it. For example:
  • If geomList contains a single Polygon, the Polygon is returned.
  • If geomList contains several Polygons, a MultiPolygon is returned.
  • If geomList contains some Polygons and some LineStrings, a GeometryCollection is returned.
  • If geomList is empty, an empty GeometryCollection is returned
Note that this method does not "flatten" Geometries in the input, and hence if any MultiGeometries are contained in the input a GeometryCollection containing them will be returned.
Parameters:
Name Type Description
geomList the Geometrys to combine.
Source:
Returns:
a Geometry of the "smallest", "most type-specific" class that can contain the elements of geomList .
Type
Geometry

createLinearRing(coordinates) → {LinearRing}

Creates a LinearRing using the given Coordinates; a null or empty array will create an empty LinearRing. The points must form a closed and simple linestring. Consecutive points must not be equal.
Parameters:
Name Type Description
coordinates Array.<Coordinate> an array without null elements, or an empty array, or null.
Source:
Returns:
A new LinearRing.
Type
LinearRing

createLineString(coordinates) → {LineString}

Creates a LineString using the given Coordinates; a null or empty array will create an empty LineString. Consecutive points must not be equal.
Parameters:
Name Type Description
coordinates Array.<Coordinate> an array without null elements, or an empty array, or null.
Source:
Returns:
A new LineString.
Type
LineString

createPoint(coordinate) → {Point}

Creates a Point using the given Coordinate; a null Coordinate will create an empty Geometry.
Parameters:
Name Type Description
coordinate Coordinate Coordinate to base this Point on.
Source:
Returns:
A new Point.
Type
Point

createPolygon(shell, holes) → {Polygon}

Constructs a Polygon with the given exterior boundary and interior boundaries.
Parameters:
Name Type Description
shell LinearRing the outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be created.
holes Array.<LinearRing> the inner boundaries of the new Polygon, or null or empty LinearRing s if the empty geometry is to be created.
Source:
Returns:
A new Polygon.
Type
Polygon

toGeometry(envelope) → {jsts.geom.Geometry}

Creates a Geometry with the same extent as the given envelope. The Geometry returned is guaranteed to be valid. To provide this behaviour, the following cases occur:

If the Envelope is:

  • null : returns an empty Point
  • a point : returns a non-empty Point
  • a line : returns a two-point LineString
  • a rectangle : returns a Polygon> whose points are (minx, miny), (minx, maxy), (maxx, maxy), (maxx, miny), (minx, miny).
Parameters:
Name Type Description
envelope jsts.geom.Envelope the Envelope to convert.
Source:
Returns:
an empty Point (for null Envelopes), a Point (when min x = max x and min y = max y) or a Polygon (in all other cases).
Type
jsts.geom.Geometry