In a Polish space, is every analytic set the continuous image of a Borel set from the same Polish space? I'm confused by a subtle point in the definition of analytic sets. Suppose I have a Polish space $X$. Now I start with the collection of Borel sets in $X$ and take all their continuous images in $X$. Do I get the entire family of analytic sets in this way? In other words, can I say in good conscience that the analytic sets in $X$ are the continuous images of the Borel sets in $X$?
Let me state the question another way. By definition a set $A\subseteq X$ is analytic if it is the image $A=f(B)$ of some Borel set $B\subset P$ in some Polish space $P$ using some continuous mapping $f:P\to X$. I don't like referring to an external space $P$. What happens if I try to simplify the definition by requiring $P=X$; will I still get all the analytic sets?
 A: The answer is positive.
If $X$ is countable all subsets of $X$ are Borel, so they are their own continuous image through the identity function.
If $X$ is uncountable then it contains a copy of the Cantor space, but the Cantor space contains a copy of the Baire space $\mathcal N$ (which is necessarily $G_\delta$ in $X$, unrelated to your question but interesting nonetheless is the fact that a Polish space contains $\mathcal N$ as a closed subspace iff $X$ is not $\sigma$-compact) and being the continuous image of $\mathcal N$ is one of the many characterizations of analytic sets.
Edit: Following the comment by Samuel I realized that the definition used in the original question is different from the one I had in mind and the continuous function is required to have domain the whole of $X$. In that case the answer is negative: the Cook continuum is a compact metric space $X$ with the property that every continuous function $X\to X$ is either constant or the identity. Clearly no analytic but not Borel subset of $X$ is the image of a Borel set through a continuous function $X\to X$.
