PostGIS geometry PgDAC

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 1
Joined: Fri 13 Mar 2020 09:50

PostGIS geometry PgDAC

Post by UserJK » Fri 13 Mar 2020 11:47


I have PostgreSQL database with Postgis geometry.
How to decode postgis binary geometry to 'WKT' or any other format or get PgDAC object (ex. TPgPoint) in Delphi application (or any other)

Code: Select all

procedure TfmMain.Button5Click(Sender: TObject);
  fld: TField;
  pgfld: TPgGeometricField;
  pGeom: TPgGeometric;
  pPoint: TPgPoint;
  pCBlob: TCompressedBlob;
  x,y: Double;
  PgQuery1.SQL.Add('SELECT * FROM test_geom');
  fld := PgQuery1.FieldByName('geometry');
  pgfld := TPgGeometricField(fld);

  pGeom := pgfld.AsPgGeometric;
  pCBlob := TCompressedBlob(pGeom);//works, but how to decode geometry data?

  pPoint := TPgPoint(pGeom);//don't work
  x := pPoint.X;
  y := pPoint.Y;
I also have tried to use postgis function ST_AsText(geometry) in SQL

Code: Select all

  PgQuery1.SQL.Add('SELECT ST_AsText(geometry) FROM test_geom');
But this throws me error that function st_astext(public.geometry) doesn't exist.

When I create table using point or polygon data type I can get TPgPoint.

Code: Select all

CREATE TABLE test_geom_point
  geometry point,
  id integer NOT NULL

INSERT INTO test_geom_point(
            geometry, id )
    VALUES (point(2,1), 1);
Unfortunately, this isn't Postgis geometry and I can't show this data in application like QGis.
Also I can't show in my application data with Postgis geometry

How to decode Postgis geometry?

Devart Team
Posts: 16
Joined: Wed 11 Mar 2020 08:28

Re: PostGIS geometry PgDAC

Post by oleg0k » Tue 17 Mar 2020 12:40

We support only official releases of database systems, and we cannot guarantee compatibility of our products with third-party solutions.
We’ll consider adding support for PostGis in future releases.

wbr, Oleg
DAC Team

Post Reply