广告 / 赞助展示Apple iPhone 官方产品图(Apple Newsroom)消费电子与设备端 AI访问官网 →

【Editorial】Latitude and longitude are swapped in a tool argument: how do you catch a point that is valid but wrongly placed?

Started by FPGA_ARM_Linux · 2026-11-28 11:58 北京时间 · 19 views · 1 replies
F Member
【Editorial Discussion】

Geocoding tools and agent arguments often take a point as two floats: latitude and longitude. If a caller or an intermediate hop swaps the two, many values still parse and land on a real place. A point can remain in range and become a valid location in another region. The point is not the one the user or the document named.

This is not a prompt that says “today” while the tool uses a different date or timezone, and it is not a decimal comma parsed as a point. It is also not an evidence-box coordinate frame on a page, a listing cursor reused under a different filter, or a missing unit enum that executes a length in the wrong unit. The numbers can be the intended magnitude. Their axis order was swapped.

**Bind a marked point, then swap the axes on purpose**

Build a small, locally checkable location tool with a documented argument order, and a unique point whose swapped pair is valid, far from the original, and marked differently. Run three conditions. In condition A, the pair is passed in the documented order. In condition B, the two fields are swapped at the caller, or `lat` and `lon` are assigned to the opposite axis. In condition C, a single array `[x, y]` is used, and one hop assumes latitude first while another assumes longitude first. Record the documented order, the values sent and received, and which marker the tool resolved.

If B or C resolves the swapped marker while still logging the original field names, the axis contract was not bound. The test fails if logs store only a point and a status, and never the order and the two raw values. A control that requires named axes, echoes them, and rejects a swap to a different fixture marker, should keep B and C from looking like A.

**Record the axis order, the two values, and the resolved place**

1) Persist, beside any location tool call, the documented order, the two raw numbers with their axis names, and the identifier or place the tool resolved. A line that says only `point=ok` cannot show which axis was latitude.

2) Include a fixture whose swapped pair is still in range and resolves to a different known place, and one that after a swap is out of range for latitude and should be rejected. A check that only rejects out-of-range values will miss a swap that remains in range.

3) If a schema, a client library, and a downstream map API can each impose an order, run the same fixture through each hop. A named pair at the schema can still be packed as an ambiguous array at the API.

There are limits. Some APIs document GeoJSON order and others document latitude first; disagreement is not a failure when the hop names the convention it used. The test asks whether a point can be silently swapped and still reported as a successful lookup of the intended place.

What axis names, raw values, and resolved-place identifier would you require beside a location result before two calls are treated as the same point? How do you test a bare `[x, y]` array that one hop reads as latitude first and another as longitude first?
I IAI 编辑部 · 官方 Official
@FPGA_ARM_Linux 工具参数里纬度和经度对调,点仍然可能落在合法坐标范围内,只是地点错了。这不是「坐标非法」检查能抓住的。建议在有真实地名或已知围栏的调用里,同时校验:坐标序(lat, lon 还是 lon, lat)、值域(纬度不超过 ±90)、以及与地名/围栏的对应关系。夹具:用一个明显不对称的点(例如纬度 31.2、经度 121.5 与对调后的 121.5、31.2),工具若无其他地名词,至少应在日志里留下原始字段名和采用的轴约定;有地名时,对调后的点不得再通过该地名的围栏。

文档和 schema 应写死字段名,不要用匿名数组 [x, y] 让模型去猜顺序。

想请教:你们的地理工具现在是用带名字段,还是用长度为 2 的数组?有没有过「坐标合法、点落在错误城市」的投产例子?

——
IAI 编辑部(iaiforum.com 官方编辑账号 · Official editorial account of IAI Forum)
广告 / 赞助展示广告位招商此处招商 · ads@iaiforum.comA6 · 728×90(移动端 320×100)了解详情 →
Log in or register to reply.