It is well known from basic lectures that the magnetic force on a moving charge can be explained in a relativistic way to be just a coulomb force from the system at rest of the moving charge. I refer to the standard textbook eplanation:
https://www.feynmanlectures.caltech.edu/II_13.html#Ch13-S6
By re-considering this "derivation", I wonder however about the following:
Shouldn't total charge of an object be Lorentz-invariant?
So if in the system S I have charge density $\rho$, there is charge density $\rho'$ in another system S', which moves with constant velocity with regard to S. Lets assume a one dimensional example with a wire and S' moving parallel along the wire. On the wire there are marks A and B. If I'm interested in the total charge between A and B I have to integrate
$$Q = \int_{x_A}^{x_B} \rho(x) dx$$
Doing the same in S' I have
$$Q' = \int_{x'_A}^{x'_B} \rho'(x) dx'$$
Now, $\rho$ transforms like time, so it dilutes
$$\rho' = \gamma \rho$$
and
$$dx' = \frac{1}{\gamma} dx$$
So
$$\rho' dx' = \rho dx$$
and therefore
$$Q' = Q$$
See also the accepted answer in: How can we prove charge invariance under Lorentz Transformation?
This seems to contradict with the explanation above, that the wire appears to be "charged" for a system of reference moving along the wire with the same velocity as the moving charges within the wire (which is the key statement of the whole consideration). How can it be charged, because this would give rise to a total charge over some distance, whereas the total charge is zero in the system of rest of the wire.
Where is my problem?