generateLineHash: Generate a unique ID for line segments

Description Usage Arguments Details Value Note Author(s)

View source: R/generateLineHash.R

Description

Generate a unique ID for a line segment, based on the non-cryptographic murmur32 hash.

Usage

1
generateLineHash(x, precision=-1, algo='murmur32')

Arguments

x

a SpatialLinesDataFrame object, with 1 line segment per feature (e.g. simple features)

precision

digits are rounded to this many places to the right (negative) or left (positive) of the decimal place

algo

hash function algorithm

Details

The input SpatialLinesDataFrame object must NOT contain multi-part features. The precision specified should be tailored to the coordinate system in use and the snapping tolerance used to create join decision line segments. A precision of 4 is reasonable for geographic coordinates (snapping tolerance of 0.0001 degrees or ~ 10 meters). A precision of -1 (snapping tolerance of 10 meters) is reasonable for projected coordinate systems with units in meters.

Value

A vector of unique IDs created from the hash of line segment start and end vertex coordinates. Unique IDs are returned in the order of records of x and can therefore be saved into a new column of the associated attribute table.

Note

An error is issued if any non-unique IDs are generated. This could be casued by using coordiantes that do not contain enough precision for unique hashing.

Author(s)

D.E. Beaudette


sharpshootR documentation built on May 2, 2019, 4:46 p.m.