I have an excel file containing some unprojected geographical coordinate values such as:
Time,Lat,Lon,Alt
2017:11:21:13:44:07:132,61.8984838,24.2221901,165
I wrote a java code to store the data to postgresql database. Now, my postgres database contains a table named 'info' which contains all the data from excel file. I also added a gid column to give unique serial number for all data and a geometry column to my database with null value. I want to put projected UTM value to that geometry column. My required UTM zone is WGS 84 UTM 35N and its EPSG code is 32635. Is st_transform able to do this projection? My sample query is here:
Update info set geom = sq.geom
from (
select ST_Transform(geom,32635) as geom
from (
SELECT ST_setsrid(geom_v,4326) as geom
from (
select 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
I added st_setsrid as without this, postgres was returning "undefined 0 srid values" error. I set the srid to 4326 just for an example. It could be any valid srid. Anyway the query is filling the geom column with same value for each row. Such as:
geom
geometry
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F000026218A29179C154199C0063B12315A41'
But if I try this:
select ST_Transform(geom,32635) as geom
from (
SELECT ST_setsrid(geom_v,4326) as geom
from (
select 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 limit 10
) as fpp
)as ftt
) as tr
Then, it gives 10 different geometry values. Such as:
geom
geometry
'01010000207B7F000026218A29179C154199C0063B12315A41'
'01010000207B7F0000463A245D169C1541B86D933712315A41'
'01010000207B7F0000629183D5149C1541EBB6462A12315A41'
'01010000207B7F00007ECE9CA0139C15418EC6E61712315A41'
'01010000207B7F000064C89D65129C15415AD97AF911315A41'
'01010000207B7F0000B0693E76119C1541291311E011315A41'
'01010000207B7F0000F868ED7D109C154120819BC411315A41'
'01010000207B7F00003A478EDD0F9C1541E15E44AD11315A41'
'01010000207B7F00003A478EDD0F9C1541E15E44AD11315A41'
'01010000207B7F00003A478EDD0F9C1541E15E44AD11315A41'
Why this?