hotosm / osm-tasking-manager2

Designed and built for Humanitarian OpenStreetMap Team collaborative emergency/disaster mapping, the OSM Tasking Manager 2.0 divides an area into individual squares that can be rapidly mapped by thousands of volunteers.
http://tasks.hotosm.org
Other
425 stars 156 forks source link

Improve projects tasks as json query #974

Closed pgiraud closed 7 years ago

pgiraud commented 7 years ago

Currently the code behind the XHR request to get the GeoJSON corresponding to the tasks of a project to be displayed on the map is a bit slow. Even more when there are a lot of tasks in a project. With the current pull request, the GeoJSON string is built by PostgreSQL instead of Python. It's 5x faster. This will help in reducing the server load.

Moreover we are now able to reduce the precision (number of digits) of the coordinates. This allows us to reduce the network footprint at the same time.

If you want to compare performances you can check out those demo: http://tasks-hotosm.dev.sig.cloud.camptocamp.net/osmtm/project/2419 screenshot from 2017-02-14 14 40 04

http://tasks-hotosm.dev.sig.cloud.camptocamp.net/osmtm_json/project/2419 screenshot from 2017-02-14 14 39 42

coveralls commented 7 years ago

Coverage Status

Changes Unknown when pulling ee5c45aa175fad650659ea387666f1ff51428b88 on pgiraud:tasks-json into on hotosm:master.

pgiraud commented 7 years ago

Can someone please review? This would enhance performance on projects with a lot of tasks a lot!