I guess you are confused with what the different coordinates are.
EPSG:900913 (officially EPSG:3857) has an extent (worldwide) of
-20037508.34,-20037508.34,20037508.34,20037508.34
Your point (-8.397 43.3708) does not seem to be in this range (it's in portugal, right?)
This means that your point is in EPSG:4326 ("lat/lons") already.
You saying that "I took the points coordinates from google maps" confirms this to me, as google maps uses spherical mercator (EPSG:900913) internally, but it's api (and web pages) exposes all coordinates as EPSG:4326
Therefore, you should store your coordinates in PostGIS with EPSG:4326, and if this is what you need to get out there should be no need for transformations.
As user30184 outlined:
It's a very common task, and there's plenty of documentation: ST_Transform.
To apply this, you need to figure out the EPSG codes of your projections.
UTM 35N probably is EPSG:32635, and your lat/lon coordinates could be anything. One of the more common ones is WGS84 as used in GPS with code EPSG:4326
The Postgis query then would be
SELECT ST_Transform(geom, 4326,32635)
If your postgis table already has the proper source SRID, you can do a simpler
SELECT ST_Transform(geom, 32635)
EDIT after you updated your question a lot:
The issue is not with ST_Transform, the issue is your query. You explicitly set all geometries to be the same. This is how UPDATE in combination with subqueries works. I really recommend you dig through the documentation a bit more to grasp this.
The solution to this issue can be found in the docs as well, by using a WHERE clause at the end. While not standard SQL, PostgreSQL allows UPDATE WHERE in order to apply subqueries to specific rows they match.
In most cases, one has a unique identifier that you can use (just hand it down from the sub queries).
In your case, depending on your data, you could use the timestamp or the lon/lat/alt itself to do so, as all these should match the same anyway.:
UPDATE info SET geom = sq.geom
FROM (
SELECT lon, lat,alt, ST_Transform(geom,32635) as geom
FROM (
SELECT lon,lat,alt, ST_setsrid(geom_v,4326) as geom
from (
select lon,lat,alt, ST_MakePoint(lon,lat,alt) as geom_v
from (
select latitude as lat, longitude as lon, altitude as alt from info order by gid asc
) as fpp
)as ftt
) as tr
) as sq
WHERE info.lon = sq.lon AND info.lat = sq.lat AND info.alt = sq.alt
However, your entire query is unnecessarily convoluted (extremely so!).
You could (and should) just use this:
UPDATE test SET geom = ST_Transform(ST_SetSRID(ST_MakePoint(lon,lat, alt),4326),32635)
to achieve the same result with a much faster and easier-to-read query.
Best Answer
First off:
But, to help you out here; if I assume correctly that you simply want all geometries in table
foo
transformed into the given projection, and the original geometries are correctly referenced to a CRS, tryto get the binary representation of your transformed geometries (standard format used for storage and geometric analysis within PostGIS) for further tasks, or
to get a simple textual representation of your geometries.
If you´d like to create a new table with those geometries, use
(I need to add here: creating tables like above is trivial, maintaining performant database/table structures is not. Among a lot of other things, for one of the next steps in learning PostgreSQL/PostGIS I recommend to read about indexes/table statistics and performance in general)
Filters are most commonly added in the
WHERE
block, liketo select only those rows/geometries of table
foo
that are well formed.Note: in all cases, these queries will only return your geometries, no other column will be added to either the output or the table. To add more columns, name them in the
SELECT
command, possibly before the geometry, like