Skip to content

Parsing the encode result is broken in CLI  #71

@shabnomnom

Description

@shabnomnom

When attempting to save the result from the endcode flag, the outputted result is not the same as the outputted result from the GeoJSON node script. There is an issue with the parser of the input or output.

Steps to reproduce:

  1. polyline.json file includes:

[[-114.05130386352539,51.112359778280194],[-114.05130386352539,51.11947193091105],[-114.05611038208008,51.12324308281078][-114.06538009643555,51.126152046793365], [-114.0736198425293,51.12916855668462]]

  1. using : cat polyline.json | ./bin/polyline.bin.js --encode > encoded-poly.txt:

result in encoded-poly.txt:

"??????????_}hQ?????_qo]?~flW?_seK?~|hQ?_}hQ?_qo]?~reK?~|hQ?_seK?~|hQ?_}hQ?~reK?_{rc@?????~flW???????_ibE?_ibE?_seK?_glW?~reK???_ibE?~zrc@?_{rc@?~nyo@?_ibE?_oyo@?~po]?????????????????????????????????????_}hQ?????_qo]?~flW?_seK?~|hQ?_}hQ?_qo]?~reK?~|hQ?_seK?~|hQ?_}hQ?~reK?_{rc@?????~flW???????_oyo@?~po]?_}hQ?~zrc@?_oyo@?~zrc@?~|hQ?_y|u@?~nyo@???~hbE?_qo]?????????????????????????????????????_}hQ?????_qo]?_ibE?~po]???~hbE?_}hQ?_qo]?~zrc@?~reK?_oyo@?~nyo@???_oyo@?????~flW?????_ibE?_ibE?~hbE?_seK?~hbE?~|hQ?_oyo@?~zrc@?_{rc@?~dvi@?~hbE?_evi@?_ibE?????????????????????????????????????_}hQ?????_{rc@?~hbE?~reK?_qo]?~nyo@???_y|u@?~|hQ?~reK?~hbE?_seK?????????~flW?????_ibE?_glW?~po]?_glW?~|hQ?~reK?_glW?_seK?_ibE?_seK?~zrc@???_}hQ?~hbE?????????????????????????????????????_}hQ?????_evi@?~flW?_}hQ?~po]?_oyo@?~hbE?~flW?~reK?_}hQ?~|hQ?_evi@?~zrc@?????~flW?????_ibE?_evi@?~nyo@?_qo]?_seK?~|hQ???_ibE???_seK?~flW?_seK?~flW???????"

Compare to the result from the GeoJSON node script:

const polyline = require('@mapbox/polyline')
undefined
polyline.fromGeoJSON({ "type": "Feature",
... "geometry": {
..... "type": "LineString",
..... "coordinates": [[-114.05130386352539,51.112359778280194], [-114.05130386352539,51.11947193091105],[-114.05611038208008,51.12324308281078], [-114.06538009643555,51.126152046793365],[-114.0736198425293,51.12916855668462] ]
..... },
... "properties": {}
... });
'g{}vHrsbwTmk@?qV]eQ|x@{Qnr@'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions