PageGeoViewportDistanceMeters

Page properties, Measurement and Geospatial

Description

Measures the ground distance between two page points in the same geospatial viewport

Syntax

Delphi

Function TPDFlib.PageGeoViewportDistanceMeters(X1, Y1, X2, Y2: Double; Out DistanceMeters: Double): Integer;

DLL

int DLPageGeoViewportDistanceMeters(int InstanceID, double X1, double Y1, double X2, double Y2, PDouble Distance);

The export is available in the Windows DLL, the macOS Dylib and the Linux shared library

ActiveX

Function PDFlib::PageGeoViewportDistanceMeters(X1 As Double, Y1 As Double, X2 As Double, Y2 As Double, ByRef DistanceMeters As Double) As Long

Available on IPDFlibrary21. Delphi clients using the generated type-library unit can obtain it with CoPDFlibrary.CreateEditionTools21

Automation returns the status and writes the distance to the by-reference argument. Failure returns 0 and sets the distance to zero

Parameters

X1, Y1First point in the raw PDF page coordinate system
X2, Y2Second point in the same coordinate system
DistanceMetersReceives the ground distance in metres

Return values

Returns 1 if both positions are in the same usable viewport and the distance was measured. Returns 0 with a zero result if the selected page has no applicable viewport, either point is outside, or the points select different viewports

Remarks

A point is assigned the topmost usable geospatial viewport whose effective map boundary contains it. The viewport's bounds polygon defines that boundary when present. A degenerate coordinate transform cannot be used for measurement. The coordinate transform uses the viewport control points and follows the units defined for the document’s PDF version. The final measurement has the accuracy characteristics of GeodesicDistanceMeters

See also

PagePointToLatLon · LatLonToPagePoint · GeodesicDistanceMeters · GeodesicPolygonAreaSqMeters