Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Transformation ¶
type Transformation struct {
// contains filtered or unexported fields
}
Transformation transforms coordinates from a source coordinate reference system (CRS) to a target CRS. Instances of this type are not thread-safe (i.e. a single Transformation should not be used by multiple goroutines without synchronization).
func NewTransformation ¶
func NewTransformation(sourceCRS, targetCRS string) (*Transformation, error)
NewTransformation creates a new Transformation object that can be used to transform coordinates. It retains memory resources that aren't managed by the Go runtime. The Transformation.Release method must be called to free these resources. The returned Transformation instance is not thread-safe.
The sourceCRS and targetCRS parameters can be in any format accepted by the `proj_create_crs_to_crs` function in the PROJ library. Allowed formats include (but are not limited to):
- A PROJ string, e.g. "+proj=longlat +datum=WGS84".
- A WKT string describing the CRS.
- An AUTHORITY:CODE string, e.g. "EPSG:4326".
- The name of a CRS found in the PROJ database, e.g. "NAD27".
func (*Transformation) Forward ¶
func (p *Transformation) Forward(ct geom.CoordinatesType, coords []float64) error
Forward does an in-place transform of coordinates from the source CRS to the target CRS. Coordinates should be laid out in the order X1, Y1, X2, Y2, ... (for XY coordinates), X1, Y1, Z1, X2, Y2, Z2, ... (for XYZ coordinates), X1, Y1, M1, X2, Y2, M2, ... (for XYM coordinates), or X1, Y1, Z1, M1, X2, Y2, Z2, M2, ... (for XYZM coordinates). The length of the coords slice must be a multiple of the dimension of the coordinates type.
func (*Transformation) Inverse ¶
func (p *Transformation) Inverse(ct geom.CoordinatesType, coords []float64) error
Inverse does an in-place transform of coordinates from the target CRS to the source CRS. Its signature operates in the same way as the Transformation.Forward method.
func (*Transformation) Release ¶
func (p *Transformation) Release()
Release releases the resources held by the Transformation object that are managed outside the Go runtime. It should be called at least once when the Transformation is no longer needed.