QGIS/python/core/auto_generated/qgsdistancearea.sip.in

452 lines
14 KiB
Plaintext
Raw Normal View History

2017-04-17 13:05:40 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdistancearea.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsDistanceArea
{
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
2017-12-15 10:36:55 -04:00
Measurements can either be performed on existing QgsGeometry objects, or using
lists of points.
2017-12-15 10:36:55 -04:00
If a valid ellipsoid() has been set for the QgsDistanceArea, all calculations will be
performed using ellipsoidal algorithms (e.g. using Vincenty's formulas). If no
ellipsoid has been set, all calculations will be performed using Cartesian
formulas only. The behavior can be determined by calling willUseEllipsoid().
2017-12-15 10:36:55 -04:00
In order to perform accurate calculations, the source coordinate reference system
of all measured geometries must first be specified using setSourceCrs().
2017-12-15 10:36:55 -04:00
Usually, the measurements returned by QgsDistanceArea are in meters. If no valid
ellipsoid is set, then the units may not be meters. The units can be retrieved
by calling lengthUnits() and areaUnits().
%End
2017-04-17 13:05:40 +10:00
%TypeHeaderCode
#include "qgsdistancearea.h"
%End
public:
QgsDistanceArea();
2017-04-17 13:05:40 +10:00
%Docstring
Constructor
%End
2012-09-03 23:49:46 +02:00
2016-02-03 16:59:49 +11:00
bool willUseEllipsoid() const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns whether calculations will use the ellipsoid. Calculations will only use the
ellipsoid if a valid ellipsoid() has been set.
.. seealso:: :py:func:`ellipsoid`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.14
2017-04-17 13:05:40 +10:00
%End
2016-02-03 16:59:49 +11:00
void setSourceCrs( const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context );
2017-04-17 13:05:40 +10:00
%Docstring
Sets source spatial reference system ``crs``.
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`sourceCrs`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.2
2017-04-17 13:05:40 +10:00
%End
2016-09-15 18:26:43 +10:00
QgsCoordinateReferenceSystem sourceCrs() const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the source spatial reference system.
.. seealso:: :py:func:`setSourceCrs`
.. seealso:: :py:func:`ellipsoidCrs`
%End
QgsCoordinateReferenceSystem ellipsoidCrs() const;
%Docstring
Returns the ellipsoid (destination) spatial reference system.
.. seealso:: :py:func:`sourceCrs`
.. seealso:: :py:func:`ellipsoid`
.. versionadded:: 3.6
2017-04-17 13:05:40 +10:00
%End
2017-04-17 13:05:40 +10:00
bool setEllipsoid( const QString &ellipsoid );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the ``ellipsoid`` by its acronym. Known ellipsoid acronyms can be
2017-12-19 11:43:52 -04:00
retrieved using :py:func:`QgsEllipsoidUtils.acronyms()`
2017-12-15 10:36:55 -04:00
Calculations will only use the ellipsoid if a valid ellipsoid has been set.
2019-02-26 19:54:09 +10:00
:return: ``True`` if ellipsoid was successfully set
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ellipsoid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`willUseEllipsoid`
2017-04-17 13:05:40 +10:00
%End
2012-09-03 15:47:48 +02:00
bool setEllipsoid( double semiMajor, double semiMinor );
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets ellipsoid by supplied radii. Calculations will only use the ellipsoid if
a valid ellipsoid been set.
2019-02-26 19:54:09 +10:00
:return: ``True`` if ellipsoid was successfully set
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ellipsoid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`willUseEllipsoid`
2017-04-17 13:05:40 +10:00
%End
2012-09-03 15:47:48 +02:00
QString ellipsoid() const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns ellipsoid's acronym. Calculations will only use the
ellipsoid if a valid ellipsoid has been set.
.. seealso:: :py:func:`setEllipsoid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`willUseEllipsoid`
.. seealso:: :py:func:`ellipsoidCrs`
2017-04-17 13:05:40 +10:00
%End
2012-09-03 23:49:46 +02:00
2014-01-27 09:22:24 +01:00
double ellipsoidSemiMajor() const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the ellipsoid's semi major axis.
.. seealso:: :py:func:`ellipsoid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ellipsoidSemiMinor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ellipsoidInverseFlattening`
2017-04-17 13:05:40 +10:00
%End
2014-01-27 09:22:24 +01:00
double ellipsoidSemiMinor() const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns ellipsoid's semi minor axis.
.. seealso:: :py:func:`ellipsoid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ellipsoidSemiMajor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ellipsoidInverseFlattening`
2017-04-17 13:05:40 +10:00
%End
2014-01-27 09:22:24 +01:00
double ellipsoidInverseFlattening() const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns ellipsoid's inverse flattening.
The inverse flattening is calculated with invf = a/(a-b).
.. seealso:: :py:func:`ellipsoid`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ellipsoidSemiMajor`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`ellipsoidSemiMinor`
2017-04-17 13:05:40 +10:00
%End
double measureArea( const QgsGeometry &geometry ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Measures the area of a geometry.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param geometry: geometry to measure
:return: area of geometry. For geometry collections, non surface geometries will be ignored. The units for the
2018-05-27 16:33:02 +10:00
returned area can be retrieved by calling areaUnits().
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`measureLength`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`measurePerimeter`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`areaUnits`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.12
2017-04-17 13:05:40 +10:00
%End
double measureLength( const QgsGeometry &geometry ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Measures the length of a geometry.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param geometry: geometry to measure
:return: length of geometry. For geometry collections, non curve geometries will be ignored. The units for the
2018-05-27 16:33:02 +10:00
returned distance can be retrieved by calling lengthUnits().
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`lengthUnits`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`measureArea`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`measurePerimeter`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.12
2017-04-17 13:05:40 +10:00
%End
double measurePerimeter( const QgsGeometry &geometry ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Measures the perimeter of a polygon geometry.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param geometry: geometry to measure
:return: perimeter of geometry. For geometry collections, any non-polygon geometries will be ignored. The units for the
2018-05-27 16:33:02 +10:00
returned perimeter can be retrieved by calling lengthUnits().
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`lengthUnits`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`measureArea`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`measurePerimeter`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.12
2017-04-17 13:05:40 +10:00
%End
double measureLine( const QVector<QgsPointXY> &points ) const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Measures the length of a line with multiple segments.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param points: list of points in line
:return: length of line. The units for the returned length can be retrieved by calling lengthUnits().
.. seealso:: :py:func:`lengthUnits`
2017-04-17 13:05:40 +10:00
%End
double measureLine( const QgsPointXY &p1, const QgsPointXY &p2 ) const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Measures the distance between two points.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param p1: start of line
:param p2: end of line
:return: distance between points. The units for the returned distance can be retrieved by calling lengthUnits().
.. seealso:: :py:func:`lengthUnits`
2017-04-17 13:05:40 +10:00
%End
2017-08-26 03:34:12 +10:00
double measureLineProjected( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI_2, QgsPointXY *projectedPoint /Out/ = 0 ) const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Calculates the distance from one point with distance in meters and azimuth (direction)
When the sourceCrs() is geographic, computeSpheroidProject() will be called
otherwise QgsPoint.project() will be called after QgsUnitTypes.fromUnitToUnitFactor() has been applied to the distance
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param p1: start point [can be Cartesian or Geographic]
:param distance: must be in meters
:param azimuth: - azimuth in radians, clockwise from North
2018-12-19 08:04:27 -04:00
:return: - distance in mapUnits
- projectedPoint: calculated projected point
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`sourceCrs`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`computeSpheroidProject`
2017-12-16 10:38:54 -04:00
.. note::
The input Point must be in the coordinate reference system being used
.. versionadded:: 3.0
2017-04-17 13:05:40 +10:00
%End
2012-09-03 23:49:46 +02:00
QgsUnitTypes::DistanceUnit lengthUnits() const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the units of distance for length calculations made by this object.
.. seealso:: :py:func:`areaUnits`
2017-12-16 10:38:54 -04:00
.. versionadded:: 2.14
2017-04-17 13:05:40 +10:00
%End
QgsUnitTypes::AreaUnit areaUnits() const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the units of area for areal calculations made by this object.
.. seealso:: :py:func:`lengthUnits`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.14
2017-04-17 13:05:40 +10:00
%End
double measurePolygon( const QVector<QgsPointXY> &points ) const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Measures the area of the polygon described by a set of points.
2017-04-17 13:05:40 +10:00
%End
double bearing( const QgsPointXY &p1, const QgsPointXY &p2 ) const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Computes the bearing (in radians) between two points.
2017-04-17 13:05:40 +10:00
%End
static QString formatDistance( double distance, int decimals, QgsUnitTypes::DistanceUnit unit, bool keepBaseUnit = false );
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns an distance formatted as a friendly string.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param distance: distance to format
:param decimals: number of decimal places to show
:param unit: unit of distance
2019-02-26 19:54:09 +10:00
:param keepBaseUnit: set to ``False`` to allow conversion of large distances to more suitable units, e.g., meters to
kilometers
2017-12-15 10:36:55 -04:00
:return: formatted distance string
.. seealso:: :py:func:`formatArea`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.16
2017-04-17 13:05:40 +10:00
%End
static QString formatArea( double area, int decimals, QgsUnitTypes::AreaUnit unit, bool keepBaseUnit = false );
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns an area formatted as a friendly string.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param area: area to format
:param decimals: number of decimal places to show
:param unit: unit of area
2019-02-26 19:54:09 +10:00
:param keepBaseUnit: set to ``False`` to allow conversion of large areas to more suitable units, e.g., square meters to
square kilometers
2017-12-15 10:36:55 -04:00
:return: formatted area string
.. seealso:: :py:func:`formatDistance`
2018-05-28 11:31:08 -04:00
.. versionadded:: 2.14
2017-04-17 13:05:40 +10:00
%End
double convertLengthMeasurement( double length, QgsUnitTypes::DistanceUnit toUnits ) const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Takes a length measurement calculated by this QgsDistanceArea object and converts it to a
different distance unit.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param length: length value calculated by this class to convert. It is assumed that the length
was calculated by this class, ie that its unit of length is equal to lengthUnits().
2017-12-15 10:36:55 -04:00
:param toUnits: distance unit to convert measurement to
:return: converted distance
.. seealso:: :py:func:`convertAreaMeasurement`
2017-12-15 10:36:55 -04:00
2017-04-17 13:05:40 +10:00
.. versionadded:: 2.14
%End
double convertAreaMeasurement( double area, QgsUnitTypes::AreaUnit toUnits ) const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Takes an area measurement calculated by this QgsDistanceArea object and converts it to a
different areal unit.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param area: area value calculated by this class to convert. It is assumed that the area
was calculated by this class, ie that its unit of area is equal to areaUnits().
2017-12-15 10:36:55 -04:00
:param toUnits: area unit to convert measurement to
:return: converted area
.. seealso:: :py:func:`convertLengthMeasurement`
2017-12-15 10:36:55 -04:00
2017-04-17 13:05:40 +10:00
.. versionadded:: 2.14
%End
2017-08-26 03:34:12 +10:00
QgsPointXY computeSpheroidProject( const QgsPointXY &p1, double distance = 1, double azimuth = M_PI_2 ) const;
2017-04-17 13:05:40 +10:00
%Docstring
2017-12-15 10:36:55 -04:00
Given a location, an azimuth and a distance, computes the
location of the projected point. Based on Vincenty's formula
for the geodetic direct problem as described in "Geocentric
Datum of Australia Technical Manual", Chapter 4.
2017-12-16 10:38:54 -04:00
:param p1: - location of first geographic (latitude/longitude) point as degrees.
:param distance: - distance in meters.
:param azimuth: - azimuth in radians, clockwise from North
:return: p2 - location of projected point as longitude/latitude.
2017-04-17 13:05:40 +10:00
.. note::
code (and documentation) taken from rttopo project
2018-01-12 20:51:17 -04:00
https://git.osgeo.org/gogs/rttopo/librttopo
- spheroid_project.spheroid_project(...)
- Valid bounds checking for degrees (latitude=+- 85.05115) is based values used for
-> 'WGS84 Web Mercator (Auxiliary Sphere)' calculations
--> latitudes outside these bounds cause the calculations to become unstable and can return invalid results
2017-12-15 10:36:55 -04:00
2017-04-17 13:05:40 +10:00
.. versionadded:: 3.0
%End
QVector<QVector<QgsPointXY> > geodesicLine( const QgsPointXY &p1, const QgsPointXY &p2, double interval, bool breakLine = false ) const;
%Docstring
Calculates the geodesic line between ``p1`` and ``p2``, which represents the shortest path on the
ellipsoid between these two points.
The ellipsoid settings defined on this QgsDistanceArea object will be used during the calculations.
``p1`` and ``p2`` must be in the sourceCrs() of this QgsDistanceArea object. The returned line
will also be in this same CRS.
The ``interval`` parameter gives the maximum distance between points on the computed line.
This argument is always specified in meters. A shorter distance results in a denser line,
at the cost of extra computing time.
2019-02-26 19:54:09 +10:00
If the geodesic line crosses the antimeridian (+/- 180 degrees longitude) and ``breakLine`` is ``True``, then
the line will be split into two parts, broken at the antimeridian. In this case the function
will return two lines, corresponding to the portions at either side of the antimeridian.
.. versionadded:: 3.6
%End
double latitudeGeodesicCrossesAntimeridian( const QgsPointXY &p1, const QgsPointXY &p2, double &fractionAlongLine /Out/ ) const;
%Docstring
Calculates the latitude at which the geodesic line joining ``p1`` and ``p2`` crosses
the antimeridian (longitude +/- 180 degrees).
The ellipsoid settings defined on this QgsDistanceArea object will be used during the calculations.
``p1`` and ``p2`` must be in the ellipsoidCrs() of this QgsDistanceArea object. The returned latitude
will also be in this same CRS.
:param p1: Starting point, in ellipsoidCrs()
:param p2: Ending point, in ellipsoidCrs()
:return: - the latitude at which the geodesic crosses the antimeridian
- fractionAlongLine: will be set to the fraction along the geodesic line joining ``p1`` to ``p2`` at which the antimeridian crossing occurs.
2019-01-10 07:53:47 +10:00
.. seealso:: :py:func:`splitGeometryAtAntimeridian`
.. versionadded:: 3.6
%End
QgsGeometry splitGeometryAtAntimeridian( const QgsGeometry &geometry ) const;
%Docstring
Splits a (Multi)LineString ``geometry`` at the antimeridian (longitude +/- 180 degrees).
The returned geometry will always be a multi-part geometry.
Whenever line segments in the input geometry cross the antimeridian, they will be
split into two segments, with the latitude of the breakpoint being determined using a geodesic
line connecting the points either side of this segment.
The ellipsoid settings defined on this QgsDistanceArea object will be used during the calculations.
``geometry`` must be in the sourceCrs() of this QgsDistanceArea object. The returned geometry
will also be in this same CRS.
If ``geometry`` contains M or Z values, these will be linearly interpolated for the new vertices
created at the antimeridian.
.. note::
Non-(Multi)LineString geometries will be returned unchanged.
.. seealso:: :py:func:`latitudeGeodesicCrossesAntimeridian`
.. versionadded:: 3.6
2017-04-17 13:05:40 +10:00
%End
2017-04-17 13:05:40 +10:00
};
2014-05-27 23:22:50 +02:00
2017-04-17 13:05:40 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdistancearea.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/