Skip to main content

Module shape

Module shape 

Source
Expand description

Decode an individual shape record into a geonative_core::Geometry.

§Per-type layouts (2D only — Z/M deferred to v0.2)

All offsets are within the record’s content (i.e. after the 8-byte record header). The first 4 bytes are always the LE shape-type code.

  • Point (type 1)type(4) + x(8) + y(8) = 20 bytes
  • MultiPoint (type 8)type(4) + bbox(32) + num_points(4) + points(16*N)
  • PolyLine (type 3) / Polygon (type 5)type(4) + bbox(32) + num_parts(4) + num_points(4) + parts[num_parts](4*P) + points[num_points](16*N). Parts are 0-based indices into the points array marking the start of each part/ring.

§Polygon ring orientation

Shapefile uses CW = exterior, CCW = hole — the opposite of the OGC convention used by geonative-core. We compute each ring’s signed area to determine its role, then reverse every ring so the emitted polygon ends up CCW-exterior / CW-hole (OGC) as the IR expects.

Functions§

decode_record_content