I would like to get a PostGIS point table from a PostGreSQL table containing OpenDataKit data where the coordinates are contained into in a column in a X Y Z M format (M being I think the value of the GPS precision in meters). E.g:
10.384643333333335 -23.214940000000002 -0.8 5.0
My first question is: what should be the column type for my coordinates_column with such coordinates format? Just text?
Otherwise I try creating the geometry this way:
INSERT INTO schema.posgistable SELECT _id,column1,column2,...,ST_MakePoint(coordinates_column) as geom FROM schema.postgresql_odk_table
as ST_MakePoint seems to be the one able to retrieve X Y Z M data (but separated by ,) but I got this error message:
ERROR: parse error - invalid geometry
Any clue?
String_To_Array
is (by far) the least performant (it was part of my answer; it is deleted now), followed bySplit_Part
, and for this very specific case, using the concatenated WKT string (@dr_jts answer) is even slightly faster.