Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird encoded polyline #2

Closed
frinux opened this issue Aug 8, 2018 · 1 comment
Closed

Weird encoded polyline #2

frinux opened this issue Aug 8, 2018 · 1 comment

Comments

@frinux
Copy link

frinux commented Aug 8, 2018

While encoding GeoJSON into encoded Polyline, I detected sometimes that the result is not what is expected.
Here is the GeoJSON:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
            [
                -0.55461,
                47.497491
            ],
            [
                -0.554074,
                47.497393
            ],
            [
                -0.553654,
                47.497298
            ],
            [
                -0.553135,
                47.49717
            ],
            [
                -0.552639,
                47.497018
            ],
            [
                -0.552086,
                47.4968
            ]
        ]
      },
      "properties": {}
    }
  ]
}

And the encoded polyline:

iz{`HhikBRkBPsAXeB\\cBj@mB

Here is a screenshot of both GeoJSON and polyline on a map:
capture du 2018-08-08 11-59-51
It seems that a single point is wrong encoded (the fifth one) : [-0.552639,47.497018] is encoded as (47.49702,-0.55329)

Is there something wrong with the algorithm implementation?

@frinux
Copy link
Author

frinux commented Aug 8, 2018

My bad, the encoded polyline has been "corrupted" by my PHP framework, which escapes backslashes...
When escaping is removed, the original polyline is well formated, as expected?
Sorry for the trouble :/

@frinux frinux closed this as completed Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant