Timeline for Latitude/longitude from PostGIS table with coordinates transformation not working
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 11, 2023 at 12:04 | vote | accept | Luca Pauluzzi | ||
Oct 11, 2023 at 8:28 | answer | added | KamiSama | timeline score: 1 | |
Oct 10, 2023 at 18:08 | comment | added | JGH |
Investigate a bit more, as it seems there is no need to swap the coordinates UNLESS 1) data is not in 6708 or 2) definition of 6708 has been modified (which could include a bug in proj). select ST_AsText(ST_Transform(st_setsrid('POINT(291349 5072882)'::geometry,6708),4326)); --> ` POINT(12.316065244416027 45.777966400818336)` (POSTGIS="3.3.3 3.3.3" [EXTENSION] PGSQL="150" GEOS="3.11.2-CAPI-1.17.2" PROJ="8.2.1" LIBXML="2.9.14" LIBJSON="0.16" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)")
|
|
Oct 10, 2023 at 15:10 | comment | added | user30184 | Do you know how the data are inserted into the database? Maybe the coordinates have been swapped once then, and now you need to swap them again. | |
Oct 10, 2023 at 14:45 | history | edited | Luca Pauluzzi | CC BY-SA 4.0 |
added 526 characters in body
|
Oct 10, 2023 at 14:43 | comment | added | Luca Pauluzzi | Found it: using ST_FlipCoordinates! SELECT ST_AsText(the_geom) AS xy, ST_AsText(ST_Transform(ST_FlipCoordinates(the_geom),4326)) AS ll FROM acq_impianti WHERE gid=426; xy | ll --------------------------------------------+--------------------------------------------- POINT(291349.5482259364 5072882.274108588) | POINT(12.316072170259908 45.77796903086367) I wonder if there is a cleaner solution.... | |
Oct 10, 2023 at 14:36 | comment | added | Luca Pauluzzi | OK, is there a way to "swap" X with Y? | |
Oct 10, 2023 at 13:46 | comment | added | Spacedman | Its definitely an X/Y vs Y/X problem, I tried it both ways round in R and in one order get the value in the question and the other gets the value in the screenshot... | |
Oct 10, 2023 at 13:37 | history | edited | Vince | CC BY-SA 4.0 |
naming
|
Oct 10, 2023 at 13:04 | comment | added | user30184 | Probably some confusion with x/y order but I can't say where. EPSG:6708 is a northing-easting system. | |
Oct 10, 2023 at 13:01 | comment | added | Ian Turton | are you sure the data in the table is stored in the correct projection? | |
Oct 10, 2023 at 12:46 | history | asked | Luca Pauluzzi | CC BY-SA 4.0 |