[openstreetmap/openstreetmap-website] Rework coordinates to avoid scientific formatting of small numbers (#1566)

Andy Allan notifications at github.com
Fri Jun 23 13:12:59 UTC 2017

This turned out to be slightly more complex than I expected, but it does work using the delegate method. Fixes #1509 

In the json builder, an explicit `.to_f` is required since the builder calls `to_s` on objects that it doesn't recognise, and we would end up with strings instead of floats in the json.

In lib/potlatch, again we need to be explicit, since there's a hardcoded shortcut for built-in types when running `[n].pack("G")`, but adding `.to_f` sorts it out too.

The rest of the changes are in the tests, where testing coordinates as strings needs the corresponding changes.

You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * Rework coordinates to avoid scientific formatting of small numbers. Fixes #1509

-- File Changes --

    M app/models/node.rb (4)
    M app/views/notes/_note.json.jsonify (2)
    M lib/bounding_box.rb (8)
    M lib/geo_record.rb (19)
    M lib/potlatch.rb (4)
    M test/controllers/api_controller_test.rb (4)
    M test/controllers/changeset_controller_test.rb (24)
    M test/controllers/relation_controller_test.rb (8)
    M test/lib/bounding_box_test.rb (16)
    M test/models/note_test.rb (8)
    M test/models/old_node_test.rb (8)
    M test/models/tracepoint_test.rb (8)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20170623/0b4be6aa/attachment.html>

More information about the rails-dev mailing list