I am using PostgreSQL (9.5) and PostGIS (2.2.2).
I need to create a multipoint geometry while keeping track of the order of the points. (I would assume the point order to be the same order as the one used while creating the geometry).
geom = public.ST_GeomFromEWKT('SRID= 3067; MULTIPOINT((6703022 329690),(6702875 329189), (6706855 321939), (6706937 321896))')
Point 1: (6703022 329690) ; Point 2: (6702875 329189) ; Point 3: (6706855 321939) ; Point 4: (6706937 321896)
What would be the best approach?
Having one table with a geometry column or having two tables, one has all the other attributes and the other one has relations to the first table with the points and an id to give some order?
I also would like to know if it is possible to extract the n-th element of a multipoint (for instance the 3rd point).
For instance from the geom example above, I would like to get the Point 3... The return value should be (6706855 321939).
The same question applies for the first and last elements of the geometry. And by the way, is there a way to know how many points are in a multipoint geometry?
Asking how many points are in the geometry of the first example would return 4.
I have been trying to read the documentation about multipoints in the postgis reference but it seems quite confusing for me...
Thanks in advance,