Learn R Programming

gdalraster (version 1.11.1)

g_distance: Compute the distance between two geometries

Description

g_distance() returns the distance between two geometries or -1 if an error occurs. Returns the shortest distance between the two geometries. The distance is expressed into the same unit as the coordinates of the geometries.

Usage

g_distance(this_geom, other_geom)

Value

Numeric. Distance or '-1' if an error occurs.

Arguments

this_geom

Character. OGC WKT string for a simple feature geometry.

other_geom

Character. OGC WKT string for a simple feature geometry.

Examples

Run this code
g_distance("POINT (0 0)", "POINT (5 12)")

Run the code above in your browser using DataLab