Hi Tara,
directly extracting all (X,Y) coordinates out from a possibly
complex binary Geometry object is not a problem you can easily
resolve just using a pure SQL approach.
as previously suggested by Jukka and Mark, you could eventually
attempt to grammatically parse the text strings returned by
AsGeoJSON(); it will be rather simple to be implemented for
the simpler LINESTRING and MULTIPOINT cases, but it will quickly
become too much complex for Geometries of the POLYGON,
MULTILINESTRING, MULTIPOLYGON and GEOMETRYCOLLECTION types.
an alternative "pure SQL" approach could be based on SQL
functions such as ST_NumGeometries(), ST_GeometryN(),
ST_ExterionRing(), ST_NumInteriorRings(), ST_InterionRingN(),
ST_NumPoints(), ST_PointN() and ST_X(), ST_Y().
this second approach will easily trigger an huge number of SQL
queries when processing real world Geometries (as e.g. complex
Polygons defined by an outer ring and several inner rings, for
a total number of points easily exceeding several thousands),
and could easily be highly inefficient and terribly slow.
a critical point not to be overlooked: both AsGeoJSON() and
ST_X(), ST_Y() will silently translate the internal Double
Precision coordinates into text strings presenting a limited
precision, thus causing unexpected rounding/truncation effects.
if I'm not wrong you are using SpatiaLite from within a
Python program; in this case the best tool for the trade is
using pyGDAL [1], a powerful module allowing to directly
manipulate binary Geometries [2],[3],[4] and [5].
[1]
https://pcjericks.github.io/py-gdalogr-cookbook/
[2]
https://pcjericks.github.io/py-gdalogr-cookbook/geometry.html#count-points-in-a-geometry
[3]
https://pcjericks.github.io/py-gdalogr-cookbook/geometry.html#count-geometries-in-a-geometry
[4]
https://pcjericks.github.io/py-gdalogr-cookbook/geometry.html#iterate-over-geometries-in-a-geometry
[5]
https://pcjericks.github.io/py-gdalogr-cookbook/geometry.html#iterate-over-points-in-a-geometry
bye Sandro