[openstreetmap/openstreetmap-website] Avoid use of scientific notation in geocoder results (PR #4961)

Anton Khorev notifications at github.com
Fri Jul 12 12:45:06 UTC 2024


@AntonKhorev requested changes on this pull request.



> @@ -60,6 +60,19 @@ def test_identify_latlon_ne_d
     end
   end
 
+  ##
+  # Test identification of integer lat/lon pairs using N/E with degrees
+  def test_identify_latlon_ne_d_int_deg
+    [
+      "N50 E14",
+      "N50° E14°",
+      "50N 14E",
+      "50°N 14°E"
+    ].each do |code|
+      latlon_check code, 50, 14
+    end
+  end
+

I don't know if we want to identify these as coordinates. In this PR they fail with `ArgumentError: invalid value for BigDecimal(): "50."`.

- `N50.° E14.°` and `50.°N 14.°E` used to be not identified
- `N50. E14.` used to be identified with correct values
- `50.N 14.E` used to be identified with incorrect values

```suggestion

  def test_no_identify_latlon_ne_d_missing_fraction_part
    [
      # "N50. E14.", # was picked up as 50.0, 14.0
      "N50.° E14.°",
      # "50.N 14.E", # was picked up as 0.0, 0.0
      "50.°N 14.°E"
    ].each do |code|
      get search_path(:query => code)
      assert_response :success
      assert_template :search
      assert_template :layout => "map"
      assert_equal %w[osm_nominatim], assigns(:sources).pluck(:name)
    end
  end
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4961#pullrequestreview-2174639852
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4961/review/2174639852 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240712/f632f928/attachment-0001.htm>


More information about the rails-dev mailing list