gdal.LineString
Concrete representation of a multi-vertex line.
Table of Contents
-
Methods
- addSubLineString(linestartend)
- boundary()
- buffer(distancesegments)
- centroid()
- clone()
- closeRings()
- contains(geometry)
- convexHull()
- crosses(geometry)
- difference(geometry)
- disjoint(geometry)
- distance(geometry)
- empty()
- equals(geometry)
- flattenTo2D()
- getEnvelope()
- getEnvelope3D()
- getLength()
- intersection(geometry)
- intersects(geometry)
- isEmpty()
- isRing()
- isSimple()
- isValid()
- overlaps(geometry)
- segmentize(segment_length)
- simplify(tolerance)
- simplifyPreserveTopology(tolerance)
- swapXY()
- symDifference(geometry)
- toGML()
- toJSON()
- toKML()
- toObject()
- touches(geometry)
- toWKB(byte_ordervariant)
- toWKT()
- transform(transformation)
- transformTo(srs)
- union(geometry)
- value(distance)
- within(geometry)
- Attributes
Constructor
gdal.LineString
()
Example:
var lineString = new gdal.LineString();
lineString.points.add(new gdal.Point(0,0));
lineString.points.add(new gdal.Point(0,10));`
Methods
addSubLineString
-
line
-
start=0
-
end=-1
Add a segment of another linestring to this one.
Adds the request range of vertices to the end of this line string in an efficient manner. If the start index is larger than the end index then the vertices will be reversed as they are copied.
Parameters:
-
line
gdal.LineStringthe other linestring
-
[start=0]
Int optionalthe first vertex to copy, defaults to 0 to start with the first vertex in the other linestring
-
[end=-1]
Int optionalthe last vertex to copy, defaults to -1 indicating the last vertex of the other linestring
Returns:
boundary
()
Compute boundary.
Returns:
gdal.Geometry
buffer
-
distance
-
segments
Buffers the geometry by the given distance.
Parameters:
-
distance
Number -
segments
Integer
Returns:
gdal.Geometry
centroid
()
Compute the centroid of the geometry.
Returns:
gdal.Point
clone
()
Clones the instance.
Returns:
gdal.Geometry
closeRings
()
Closes any un-closed rings.
contains
-
geometry
Determines if the current geometry contains the provided geometry.
Parameters:
-
geometry
gdal.Geometry
Returns:
Boolean
convexHull
()
Compute convex hull.
Returns:
gdal.Geometry
crosses
-
geometry
Determines if the two geometries cross.
Parameters:
-
geometry
gdal.Geometry
Returns:
Boolean
difference
-
geometry
Compute the difference of this geometry with another.
Parameters:
-
geometry
gdal.Geometry
Returns:
gdal.Geometry
disjoint
-
geometry
Determines if the two geometries are disjoint.
Parameters:
-
geometry
gdal.Geometry
Returns:
Boolean
distance
-
geometry
Computes the distance between the two geometries.
Parameters:
-
geometry
gdal.Geometry
Returns:
Number
empty
()
Clears the geometry.
equals
-
geometry
Determines if the two geometries equal each other.
Parameters:
-
geometry
gdal.Geometry
Returns:
Boolean
flattenTo2D
()
Convert geometry to strictly 2D
Returns:
void
Computes the bounding box (envelope).
Returns:
Bounding envelope
Computes the 3D bounding box (envelope).
Returns:
Bounding envelope
getLength
()
Computes the length of the line string.
Returns:
Number
intersection
-
geometry
Compute intersection with another geometry.
Parameters:
-
geometry
gdal.Geometry
Returns:
gdal.Geometry
intersects
-
geometry
Determines if the two geometries intersect.
Parameters:
-
geometry
gdal.Geometry
Returns:
Boolean
isEmpty
()
Determines if the geometry is empty.
Returns:
Boolean
isRing
()
Determines if the geometry is a ring.
Returns:
Boolean
isSimple
()
Determines if the geometry is simple.
Returns:
Boolean
isValid
()
Determines if the geometry is valid.
Returns:
Boolean
overlaps
-
geometry
Determines if the current geometry overlaps the provided geometry.
Parameters:
-
geometry
gdal.Geometry
Returns:
Boolean
segmentize
-
segment_length
Modify the geometry such it has no segment longer then the given distance.
Parameters:
-
segment_length
Number
Returns:
Number
simplify
-
tolerance
Reduces the geometry complexity.
Parameters:
-
tolerance
Number
Returns:
gdal.Geometry
simplifyPreserveTopology
-
tolerance
Reduces the geometry complexity while preserving the topology.
Parameters:
-
tolerance
Number
Returns:
gdal.Geometry
swapXY
()
Swaps x, y coordinates.
symDifference
-
geometry
Computes the symmetric difference of this geometry and the second geometry.
Parameters:
-
geometry
gdal.Geometry
Returns:
gdal.Geometry
toGML
()
Convert a geometry into GML format.
Returns:
gdal.Geometry
toJSON
()
Convert a geometry into JSON format.
Returns:
gdal.Geometry
toKML
()
Convert a geometry into KML format.
Returns:
gdal.Geometry
toObject
()
Object
Converts the geometry to a GeoJSON object representation.
Returns:
GeoJSON
touches
-
geometry
Determines if the two geometries touch.
Parameters:
-
geometry
gdal.Geometry
Returns:
Boolean
toWKB
-
byte_order="MSB"
-
variant="OGC"
Convert a geometry into well known binary format.
Parameters:
-
[byte_order="MSB"]
String optional(Constants (wkbByteOrder))
-
[variant="OGC"]
String optional
Returns:
gdal.Geometry
toWKT
()
Convert a geometry into well known text format.
Returns:
gdal.Geometry
transform
-
transformation
Apply arbitrary coordinate transformation to the geometry.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the CoordinateTransformation object, and the actual SRS of the geometry will be ignored.
Parameters:
-
transformation
gdal.CoordinateTransformation
union
-
geometry
Compute the union of this geometry with another.
Parameters:
-
geometry
gdal.Geometry
Returns:
gdal.Geometry
Returns the point at the specified distance along the line string.
Parameters:
-
distance
Number
Returns:
within
-
geometry
Determines if the current geometry is within the provided geometry.
Parameters:
-
geometry
gdal.Geometry
Returns:
Boolean