abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
474 stars 113 forks source link

Apk: Json output with gzip #648

Closed afischerdev closed 7 months ago

afischerdev commented 7 months ago

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 https://github.com/abrensch/brouter/blob/c6473055f4bd5bc8742cfe6cc81cbf7aecf24760/brouter-routing-app/src/main/java/btools/routingapp/BRouterService.java#L102-L104

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

devemux86 commented 7 months ago

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 commented 7 months ago

@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 commented 7 months ago

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