There are 2 perfect squares each rotation of the spiral. ⌊(⌈⍵*÷2)÷2
is a Chebyshev distance of ⍵ to origin, i.e. the absolute value of larger coordinate. To get the other, subtract that square and do some modular magic dance (there are 4 zeros at each layer, and 4 max values at turning points where both coordinates are equal), and just add the two together.
{(|k-(2×k)|⍵-(1+k×2)*2) + k←⌊(⌈⍵*÷2)÷2 ;k} 277678
(That ;k
is GNU APL notation for local variable, just remove it for Dyalog).