<p><b>@gravitystorm</b> commented on this pull request.</p>

<p>This looks great! Just a few comments from me based on an initial look through the PR. I plan to look at this in more detail in the next few weeks.</p><hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2485#discussion_r362025847">app/controllers/api/map_controller.rb</a>:</p>
<pre style='color:#555'>> @@ -5,6 +5,13 @@ class MapController < ApiController
     before_action :check_api_readable
     around_action :api_call_handle_error, :api_call_timeout
 
+    before_action :default_format_xml
+
+    # Set format to xml unless client requires a specific format
+    def default_format_xml
</pre>
<p>There's no need to repeat the function definition in each controller. You can move the definition to <code>app/controllers/api_controller.rb</code>, since all the controllers in <code>app/controllers/api/</code> are subclassed from that one.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2485#discussion_r362027031">app/controllers/api/map_controller.rb</a>:</p>
<pre style='color:#555'>> @@ -5,6 +5,13 @@ class MapController < ApiController
     before_action :check_api_readable
     around_action :api_call_handle_error, :api_call_timeout
 
+    before_action :default_format_xml
</pre>
<p>We need to be careful about this. Previously in <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="380901348" data-permission-text="Issue title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/2065" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/2065/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/2065">#2065</a> we ran into problems with accidentally ignoring <code>Accepts</code> headers. This approach is different, so perhaps avoids that problem, but we should have test-suite coverage for whatever we are trying to support.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2485#discussion_r362029852">app/views/api/nodes/_node.json.jbuilder</a>:</p>
<pre style='color:#555'>> @@ -0,0 +1,15 @@
+json.type "node"
+json.id node.id
+if node.visible
+  json.lat format("%.7f", node.lat.to_f)
</pre>
<p>In order to get the XML output the way we want it, we have created our own "Coord" class. This allows us to precisely control what the output is whenever the coord is converted to a string, without having to write "format(%.7f)" all over the codebase.</p>
<p><a href="https://github.com/openstreetmap/openstreetmap-website/blob/c524cbf096d9f67936a5ec6050e5c83fd49077cd/app/models/concerns/geo_record.rb#L4-L15">https://github.com/openstreetmap/openstreetmap-website/blob/c524cbf096d9f67936a5ec6050e5c83fd49077cd/app/models/concerns/geo_record.rb#L4-L15</a></p>
<p>In that PR I used <code>.to_f</code> in the json views for notes, to avoid the builder calling <code>.to_s</code> and getting quoted strings. Would that avoid the quoting problem you have here too?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/2485?email_source=notifications&email_token=AAK2OLP5IWNHTXJ2IHK3ZNLQ3INRDA5CNFSM4KAKS5KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCQMJFIQ#pullrequestreview-337154722">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMH6VFXSOEQSPP5FDDQ3INRDANCNFSM4KAKS5KA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAK2OLJU26B2ZDBG5U6DNPTQ3INRDA5CNFSM4KAKS5KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCQMJFIQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/2485?email_source=notifications\u0026email_token=AAK2OLP5IWNHTXJ2IHK3ZNLQ3INRDA5CNFSM4KAKS5KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCQMJFIQ#pullrequestreview-337154722",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/2485?email_source=notifications\u0026email_token=AAK2OLP5IWNHTXJ2IHK3ZNLQ3INRDA5CNFSM4KAKS5KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCQMJFIQ#pullrequestreview-337154722",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>