2 simplified a part of the argument

I can complete Anton's plan with an additional assumption that geodesics do not branch. I also assume local compactness (otherwise there are too many technical details to deal with). More precisely, I prove the following:

Let $X$ be a geodesic space. Suppose that

• For every finite subset $Q\subset X$, every similarity $Q\to X$ can be extended to a bijective similarity $X\to X$. A similarity is a map that multiplies all distances by a constant. (It is easy to see that, in the case of a length metric, the more complicated definition from the question reduces to this.)

• $X$ is locally compact.

• For every two distinct points of $X$ there is a unique line containing them. (A line is a subset isometric to $\mathbb R$. The existence of lines follows from the two other assumptions.)

Then $X$ is isometric to $\mathbb R^n$ for some $n$.

Proof. First observe that the group of similarities acts transitively on pairs (oriented line, point not on this line). Indeed, given two such pairs $(\ell_1,p_1)$ and $(\ell_2,p_2)$, it suffices to find similar triples $p_1,x_1,y_1$ and $p_2,x_2,y_2$ where $x_i,y_i$ is a positively oriented pair of points on $\ell_i$. And it is easy to see that such triples $p_i,x_i,y_i$ realise all similarity types compatible with the triangle inequalityof, e.g. isosceles triangles.

Next we construct perpendiculars. Lines $\alpha$ and $\beta$ intersecting at a point $q$ are said to be perpendicular if there exists an isometry that fixes $\alpha$ and maps $\beta$ to itself by reflection in $q$. It is easy to see that this relation is symmetric. Further, for every line $\ell$ and every point $p\notin\ell$ there exists a unique perpendicular to $\ell$ containing $p$. To prove existence, pick two points $x,y\in\ell$ such that $|px|=|py|$. There is an isometry that fixes $p$ and exchanges $x$ and $y$. It acts on $\ell$ by reflection in the midpoint $q$ of $[xy]$, hence the line $(pq)$ is perpendicular to $\ell$. Uniqueness follows from the fact that two distinct reflections of $\ell$ cannot fix $p$, otherwise their composition shifts $\ell$ along itself and fixes $p$, and some iteration of this shift would break the triangle inequality.

This argument also shows that the base $q$ of the perpendicular is the nearest point to $p$ on $\ell$, and the distance from $p$ to $x\in\ell$ grows monotonically with $|qx|$.

Clearly all right-angled triangles with given leg lengths $a$ and $b$ are isometric; denote their hypotenuse by $f(a,b)$. Then $f$ is strictly monotone in each argument and positively homogeneous: $f(ta,tb)=tf(a,b)$.

Next, we show that the sum of Busemann function of two opposite rays is zero. Or, equivalently, if $\gamma$ is an arc-length parametrized line, $q=\gamma(0)$ and a line $(pq)$ is perpendicular to $\gamma$, then $B_\gamma(p)=0$ where $B_\gamma$ denotes the Busemann function of $\gamma$. Suppose the contrary. We may assume that $|pq|=1$ and $B_\gamma(p)=c>0$. This means that for every point $x\in\gamma$ we have $|px|-|qx|\ge c$. Let $s\in\ell$ be very far away and let $p_1$ be the perpendicular from $q$ to $(ps)$. The above inequality implies that $|pp_1|\ge c$, hence we have an upper bound $|qp_1|\le\lambda<1$ where $\lambda$ is determined by $f$ and $c$ and does not depend on $s$. Let $q_1$ be the base of the perpendicular from $p_1$ to $(qs)$, then rescaling the above inequality yields that $|p_1q_1|\le\lambda|qp_1|\le\lambda^2$. The next perpendicular (from $q_1$ to $p_2$ on $(ps)$) has length at most $\lambda^3$ and so on. Summing up these perpendiculars, we see that $|ps|\le 1/(1-\lambda)$ which is not that far away, a contradiction.

The fact that opposite rays yield opposite Busemann functions implies that the Busemann function of a line $\gamma$ is the only 1-Lipschitz function $f$ such that $f(\gamma(t))=-t$ for all $t$. And, given local compactness and non-branching of geodesics, this implies that $X$ is split into lines parallel to $\ell$, where a line $\gamma_1$ is said to be parallel to $\gamma$ if the Busemann function of $\ell$ decays with unit rate along $\gamma_1$ (to construct a parallel line, just glue together two opposite asymptotic rays). Further, Busemann functions of parallel lines coincide, due to their above mentioned uniqueness.

Now it is easy to see that the level set of a Busemann function (which is also a union of perpendiculars to a given line at a given point) has the same isometry extension property and is a geodesic space. Then we can carry induction in the parameter $d$ defined as the maximum number of pairwise perpendicular lines that can go through one point. The cases $d=1$ and $d=2$ can be done by hand, then use isometries exchanging perpendicular lines to do the induction step.

1

I can complete Anton's plan with an additional assumption that geodesics do not branch. I also assume local compactness (otherwise there are too many technical details to deal with). More precisely, I prove the following:

Let $X$ be a geodesic space. Suppose that

• For every finite subset $Q\subset X$, every similarity $Q\to X$ can be extended to a bijective similarity $X\to X$. A similarity is a map that multiplies all distances by a constant. (It is easy to see that, in the case of a length metric, the more complicated definition from the question reduces to this.)

• $X$ is locally compact.

• For every two distinct points of $X$ there is a unique line containing them. (A line is a subset isometric to $\mathbb R$. The existence of lines follows from the two other assumptions.)

Then $X$ is isometric to $\mathbb R^n$ for some $n$.

Proof. First observe that the group of similarities acts transitively on pairs (oriented line, point not on this line). Indeed, given two such pairs $(\ell_1,p_1)$ and $(\ell_2,p_2)$, it suffices to find similar triples $p_1,x_1,y_1$ and $p_2,x_2,y_2$ where $x_i,y_i$ is a positively oriented pair of points on $\ell_i$. And it is easy to see that such triples $p_i,x_i,y_i$ realise all similarity types compatible with the triangle inequality.

Next we construct perpendiculars. Lines $\alpha$ and $\beta$ intersecting at a point $q$ are said to be perpendicular if there exists an isometry that fixes $\alpha$ and maps $\beta$ to itself by reflection in $q$. It is easy to see that this relation is symmetric. Further, for every line $\ell$ and every point $p\notin\ell$ there exists a unique perpendicular to $\ell$ containing $p$. To prove existence, pick two points $x,y\in\ell$ such that $|px|=|py|$. There is an isometry that fixes $p$ and exchanges $x$ and $y$. It acts on $\ell$ by reflection in the midpoint $q$ of $[xy]$, hence the line $(pq)$ is perpendicular to $\ell$. Uniqueness follows from the fact that two distinct reflections of $\ell$ cannot fix $p$, otherwise their composition shifts $\ell$ along itself and fixes $p$, and some iteration of this shift would break the triangle inequality.

This argument also shows that the base $q$ of the perpendicular is the nearest point to $p$ on $\ell$, and the distance from $p$ to $x\in\ell$ grows monotonically with $|qx|$.

Clearly all right-angled triangles with given leg lengths $a$ and $b$ are isometric; denote their hypotenuse by $f(a,b)$. Then $f$ is strictly monotone in each argument and positively homogeneous: $f(ta,tb)=tf(a,b)$.

Next, we show that the sum of Busemann function of two opposite rays is zero. Or, equivalently, if $\gamma$ is an arc-length parametrized line, $q=\gamma(0)$ and a line $(pq)$ is perpendicular to $\gamma$, then $B_\gamma(p)=0$ where $B_\gamma$ denotes the Busemann function of $\gamma$. Suppose the contrary. We may assume that $|pq|=1$ and $B_\gamma(p)=c>0$. This means that for every point $x\in\gamma$ we have $|px|-|qx|\ge c$. Let $s\in\ell$ be very far away and let $p_1$ be the perpendicular from $q$ to $(ps)$. The above inequality implies that $|pp_1|\ge c$, hence we have an upper bound $|qp_1|\le\lambda<1$ where $\lambda$ is determined by $f$ and $c$ and does not depend on $s$. Let $q_1$ be the base of the perpendicular from $p_1$ to $(qs)$, then rescaling the above inequality yields that $|p_1q_1|\le\lambda|qp_1|\le\lambda^2$. The next perpendicular (from $q_1$ to $p_2$ on $(ps)$) has length at most $\lambda^3$ and so on. Summing up these perpendiculars, we see that $|ps|\le 1/(1-\lambda)$ which is not that far away, a contradiction.

The fact that opposite rays yield opposite Busemann functions implies that the Busemann function of a line $\gamma$ is the only 1-Lipschitz function $f$ such that $f(\gamma(t))=-t$ for all $t$. And, given local compactness and non-branching of geodesics, this implies that $X$ is split into lines parallel to $\ell$, where a line $\gamma_1$ is said to be parallel to $\gamma$ if the Busemann function of $\ell$ decays with unit rate along $\gamma_1$ (to construct a parallel line, just glue together two opposite asymptotic rays). Further, Busemann functions of parallel lines coincide, due to their above mentioned uniqueness.

Now it is easy to see that the level set of a Busemann function (which is also a union of perpendiculars to a given line at a given point) has the same isometry extension property and is a geodesic space. Then we can carry induction in the parameter $d$ defined as the maximum number of pairwise perpendicular lines that can go through one point. The cases $d=1$ and $d=2$ can be done by hand, then use isometries exchanging perpendicular lines to do the induction step.