Polylabel-rs
A Rust implementation of the Polylabel algorithm
Visualised: The orange dot is the polygon centroid. The teal dot is the ideal label position.
How to Use
extern crate polylabel;
use polylabel;
extern crate geo;
use ;
let coords = vec!;
let ls = LineString;
let poly = Polygon;
let label_pos = polylabel;
// Point(0.5625, 0.5625)
Documentation
FFI
Call polylabel_ffi
with the following three mandatory arguments:
Array
(a void pointer to an array of two-elementc_double
s, the exterior Polygon ring)WrapperArray
(a void pointer to an array ofArray
s, the interior Polygon rings, empty if there are none)tolerance
, ac_float
The function returns a struct with two c_double
fields:
x_pos
y_pos
A Python example is available in ffi.py
Binaries
Binary libs for:
x86_64
*nix (built usingmanylinux1
, thus easy to include in Python 2.7 / 3.4 wheels) and OS Xi686
andx86_64
Windows
are available in releases.