TsGeo - Resources - Polygon

A Polyline consists of an ordered list of locations (coordinates) like Polyline but its start and end points are connected.

Public Methods

addPoint(point: Coordinate)

Add new Coordinate point in the object .

getPoints()

Return an array of all points (Array<Coordinate>)

getLats()

Return an array of all latitudes (Array)

getLngs()

Return an array of all longitudes (Array)

getNumberOfPoints()

Return the number of points (number)

format(formatter: FormatterInterface)

Return a string of this Polygon object using the formatter (string)

getSegments()

Return a array of Line for each segment of Polygon object (Array<Line>)

containsGeometry(geometry: GeometryInterface)

Return true if each point of geometry is contained inside the Polygon, false otherwise.

contains(point: Coordinate)

Return true if if given point is contained inside the Polygon, false otherwise.

Uses the PNPOLY algorithm by W. Randolph Franklin. Therfore some edge cases may not give the expected results, e. g. if the point resides on the polygon boundary.

See http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

For special cases this calculation leads to wrong results:

  • if the polygons spans over the longitude boundaries at 180/-180 degrees

getPerimeter(calculator: DistanceInterface)

Return the perimeter of the Polygon in meter using the calculator. (number)

getArea()

Return the area of the Polygon in square meter (m²). (number)

getReverse()

Return a Polyline of where the points are reversed (Polygon)

Polyline Retour Ellipsoid


Ajouter un commentaire