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
UserJK
Posts: 1
Joined: Fri 13 Mar 2020 09:50

PostGIS geometry PgDAC

Post by UserJK » Fri 13 Mar 2020 11:47

Hi.

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);
var
  fld: TField;
  pgfld: TPgGeometricField;
  pGeom: TPgGeometric;
  pPoint: TPgPoint;
  pCBlob: TCompressedBlob;
  x,y: Double;
begin
  PgQuery1.SQL.Clear;
  PgQuery1.SQL.Add('SELECT * FROM test_geom');
  PgQuery1.Open;
  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');
  PgQuery1.Open;
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?

oleg0k
Devart Team
Posts: 190
Joined: Wed 11 Mar 2020 08:28

Re: PostGIS geometry PgDAC

Post by oleg0k » Tue 17 Mar 2020 12:40

Hello,
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

Morelli
Posts: 15
Joined: Thu 19 Mar 2015 15:45

Re: PostGIS geometry PgDAC

Post by Morelli » Fri 27 Nov 2020 09:25

Hi,

do you now support PostGIS GEOMETRY?
Had anyone ins this forum successfully read/wrote PostGIS geometries?

oleg0k
Devart Team
Posts: 190
Joined: Wed 11 Mar 2020 08:28

Re: PostGIS geometry PgDAC

Post by oleg0k » Thu 03 Dec 2020 17:37

Hello,
We support only official releases of database systems, and we cannot guarantee compatibility of our products with third-party solutions. You are welcome to leave your suggestion about adding support for PostGIS spatial geometry types to PgDAC on our UserVoice page ( https://devart.uservoice.com/forums/104 ... y_id=18923 )

wbr, Oleg
Devart Team

Post Reply