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

Apk: Json output with gzip #648

Closed
afischerdev opened this issue Nov 29, 2023 · 3 comments
Closed

Apk: Json output with gzip #648

afischerdev opened this issue Nov 29, 2023 · 3 comments
Labels

Comments

@afischerdev
Copy link
Collaborator

This is a call to all app developers using BRouter as a routing engine.

As part of the changes to the output routines #646, the Json output should also be available as gzip when called with parameter acceptCompressedResult=true.

Please see line 103

String gpxMessage = worker.getTrackFromParams(params);
if (canCompress && gpxMessage.startsWith("<")) {
try {

Otherwise, the size will cause the service interface to break sooner than for a GPX output.

@devemux86
Copy link
Contributor

We could also encode the polyline of the path coordinates?
(could be as option)

https://developers.google.com/maps/documentation/utilities/polylinealgorithm

All online routers do this by significantly reducing the size of their json responses.

@afischerdev
Copy link
Collaborator Author

@devemux86
Thanks for the link.
I didn't know that before.

Minify is another idea, I was able to save more than half of the space (json) - without gzip.
And all clients should be able to read this without changing the code.

@afischerdev
Copy link
Collaborator Author

A short json size test - Hannover Frankfurt trekking ~350km:
json out size 764508
minity out size 645464
gzip out size 213615

json out size 764504
gzip out size 220431

time minify ~170ms - a regex logic was used
time gzip ~70ms - both variantes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants