Skip to content

S2 Polyline does not support compressed encoding #232

@theSloopJohnB

Description

@theSloopJohnB

In the C++ implementation, polylines use version '2' for their compressed format:

https://github.com/google/s2geometry/blob/master/src/s2/s2polyline.cc#L73-L74

static const unsigned char kCurrentCompressedEncodingVersionNumber = 2;

But the Go implementation seems to share polyline and polygon encoding implementations here:

https://github.com/golang/geo/blob/master/s2/encode.go#L29C1-L31C37

// encodingCompressedVersion is the current version of the
// compressed format.
encodingCompressedVersion = int8(4)

So, the Go S2 implementation cannot in fact read the compressed S2 Polyline, because it triggers the version mismatch check:

if int(version) != int(encodingVersion) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions