I am new to using POSTGIS and PostgreSQL.
I am trying to convert PostGIS coordinates into lat and long values. When I copy one of the values and query like
SELECT ST_AsText('0101000000A7E8482EFFC55B402063EE5A42064140');
The query runs without an error. But when I try the query for the entire table column like
SELECT ST_AsText(GPS) from schema.table;
I am getting an error saying
" 0101000000A7E8482EFFC" <-- parse error at position 22 within geometry
The column data type is text. I am unsure why the ST_AsText is unable to read the whole text and stops at position 21.
Additional information:
PostgreSQL version : 10.7
pgAdmin : 4.5
PostGIS: 2.4.3
I am using Python SQLAlchemy to Insert the tables directly into PostgreSQL.
GEOMETRY
bytea representation asTEXT
?? That column really should be the appropriateGEOMETRY
type. I guess the actual string literal of bytea can be cast implicitly when passed toST_AsText
, but not when passed as column reference...\df++ st_asText
show an (undocumented) version that gets a text input, cast it to geometry and call the common `st_asText(geometry)`` function. This cast should be valid on txt/bytea