frederickjansen / polyline Goto Github PK
View Code? Open in Web Editor NEWA Python implementation of Google's Encoded Polyline Algorithm Format.
Home Page: http://goo.gl/PvXf8Y
License: MIT License
A Python implementation of Google's Encoded Polyline Algorithm Format.
Home Page: http://goo.gl/PvXf8Y
License: MIT License
I know it is heated question, and I usually wouldn’t want to impose my point of view.
However, currently, a string is decoded as [(lat, lon)…] while it is (lon, lat) (aka x,y on a planar map) on https://github.com/mapbox/polyline that inspired this library.
This makes it a bit cumbersome to use geojson as it also expects coordinates in the (x,y) order.
I don’t mind fixing it and making a pull request. However, I want to be sure that the original author agrees with that view.
string
'jq~DcfwbViCeLy@wDcBgEMYrFqDrFmDfDyBnBqAbHiETMfFqCTMpIaDFCHGzBkAjB_ArAo@zBo@xCi@bDi@nEm@zC%5BpCUt@CrAGNABMNaABO%7CA_ODk@lB_Th@GJeDI@kDgDSUe@c@kHgHwBuBMKa@@@%5BHUVo@pEiLVu@xCqHFMTg@JWLc@Nc@D@dk@Ci@Go@aAcHCOMq@c@kCqAgIMu@AiIc@iCO}AEyBDcC@%5D%7C@gJdBwOHy@fByARSVSlEyDtBaBfBwApAcAx@o@r@k@%7C@k@pCoBJIlMoIfIcFvA}@nau@j@@pilaw@xCiBl@@zfodBwABwAzFoDlFgDdC{AHGpBoAvA{@t@e@xJeGtFmD%5CQJIpBoAb@W%5CUf@@hkhb@f@e@%7CFyDJGbKqFhL{G%60PwInBgAtEaBl@MfDs@tD{@tco@bBk@%60Bs@dAs@%7CBqAHGh@%5BlBgA%7C@i@r@a@LIEOUcACIUGGSOs@eAyE_@}AI%5BCQGYc@oBc@kBc@oBa@eBUcAMm@iA_F}A}GgCeHcAwC}BiGwDkKgAkCgBwEIWaCoGs@mBwB_Gk@yA%5DeA??yAaEiA}CyDqKoA_EwA_EqBwGcDuKGO}IcYmDaLkCoIq@yDGi@Cq@A}BHkDb@yN@mAVqH@o@JsCRuFHwBFiCP}I@c@?YAa@Ew@?%5De@}FAI@MUgCOiBM_B_@oEScCI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@nBt@rCr@hCh@nBx@zCJAfAKHAz@IXC%5C?XApCUlCSJAz@GNAZCXEl@Kx@Mn@Kd@If@I@l%7C@NdJVd@H%7C@PzAl@t@b@%60At@fAjALNf@l@@@jn@Bp@bBh@bBAFDPZpAbAjEb@hAl@hAz@bAfBpAvJjE%60RlJzAt@hDbCzBnBTTb@%5Cj@p@l@t@%5Cb@p@x@FJhAzAnEFh@l@xBbCjCzBfA~@PNNNDDdBlBTXbClCHJlAjBlCjEz@hDl@zBH%5CpAnJF%60@ZjJBrI@bM?f@?rB?l@AzEBl@J%60Ep@vHLvABPJp@DXBLR%7CAPbAvAzFZrADLXt@m@%5Cy@j@tAtCk@f@h@nA%7CAvD'
returns IndexError: string index out of range error . it's weird ,but i use https://github.com/mapbox/polyline , it works .
Hi, I got this warning while installing the package:
/usr/lib/python3.11/site-packages/setuptools/_core_metadata.py:157: SetuptoolsDeprecationWarning: Invalid config.
!!
********************************************************************************
newlines are not allowed in `summary` and will break in the future
********************************************************************************
!!
write_field('Summary', single_line(summary))
Is it possible to generate URL safe encoded strings? (only uses a-z, A-Z, 0-9, and URL safe characters like + * _ -.)
Similar to: https://github.com/LiveBy/url-safe-polyline
Hello,
This report comes from the Debian bug tracker, Bug#1018439
Polyline still uses nose 1, which is an obsolete testing framework for
Python, dead and unmaintained since 2015 2.
It would be good to port polyline to one of the alternatives: nose2 4, pytest 5
or unittest from Python standard library 6.
There is a script called nose2pytest 7 which can assist with migrating from
nose to pytest.
Any interest in a PR that addresses this? Any particular direction / alternative you'd prefer?
Hi,
I'm the author of fast-polylines
gem in ruby and in crystal. I've recently created an equivalent project in python, that takes advantage of C bindings to compute way faster.
I still have some work to do on it, mainly tests and documentation. But rather than publishing a new library, I was thinking that I could merge this into your project. No need for two competing libraries. Great for me: you already have documentation and tests (although I'd add a few tests relative to how it is implemented in C). Great for you: way better perfs.
Here's a quick benchmark I made to showcase efficiency, you can run it locally as well:
git clone [email protected]:buonomo/fast-polyline.py
cd fast-polyline.py
make install
make bench
fast_polyline: 0.583ms
polyline: 39.7ms
fast_polyline is 68.1 times faster.
fast_polyline: 1.53ms
polyline: 25.9ms
fast_polyline is 17.0 times faster.
Note that performances would be improved a bit more before publication, especially on decode.
Also, Since it would change in lot in the codebase, I'd be happy to help maintaining the project afterward and having my email mentionned in the pyproject.toml.
I had a polygon it encoded, here are the first two points:
[(45.01659550333779, -72.84230558748105), (45.01648444523865, -72.83481118517622)]
It produced a polyine for me, BUT they were in the wrong place.
It encode them as:
(0.45017, -0.72842), (0.45016, -0.72835)
Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.