LocalData/localdata-api — pull request #163 by prashtx (2014-03-03 08:53:53+00:00)
Title: Simplify indexed geometries

We sometimes encounter overly complicated geometries (over 1,000 coordinates in one case), which really slow down our geo queries, even with an index. Since we have a separate `indexedGeometry` field in Response documents, we can safely simplify those geometries. Right now the production database has 20 documents with over 50 coordinates in the indexed geometry.

Modify `Response.createIndexedGeometry` to simplify geometries with over 50 coordinates.

Add a maintenance tool for recomputing the indexed geometries. This script is idempotent as long as the model's algorithm has not changed, and it only affects the `indexedGeometry` field, so it should be pretty safe. It processes every Response document, though, so it's best to use `heroku run bash` and run it remotely.

/cc @hampelm