Reading and writing geographic objects

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: Reading and writing geographic objects

Post by DemetrionQ » Mon 03 Jun 2013 15:58

Hello.

You can contact our sales department via the contact form on our website to get more information about your subscription: http://www.devart.com/company/contactform.html

thvedel
Posts: 14
Joined: Wed 04 May 2005 06:39
Location: Denmark

Re: Reading and writing geographic objects

Post by thvedel » Mon 03 Jun 2013 22:35

I have contacted the sales department several times the last weeks, but they never return an answer to me...

Actually this is the reason that I ask here what to do.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Reading and writing geographic objects

Post by AlexP » Tue 04 Jun 2013 07:48

Hello,

Please contact our sales department at sales*devart*com to update login and password for access to the latest PgDAC version.

[email protected]
Posts: 27
Joined: Fri 12 Feb 2010 07:44

Re: Reading and writing geographic objects

Post by [email protected] » Fri 23 Aug 2013 14:05

Hello.

I have downloaded latest version of PgDAC.
Is this feature has been added in this version?
If yes, could you give me an example how to use it?

Regards
Wojto

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Reading and writing geographic objects

Post by AlexP » Fri 23 Aug 2013 15:30

Hello,

The code below demonstrates data modification in a Poligon type object, you can work in the similar way with the object types: Point, PointsArray, LSeg, Box, Path and Circle

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var
  p: TPgGeometric;
  i: integer;
begin
  PgQuery1.Edit;
  for i:= 0 to TPgPolygon(PgQuery1f_polygon.AsPgGeometric).Count - 1 do begin
    TPgPolygon(PgQuery1f_polygon.AsPgGeometric).Points[i].X := 0;
    TPgPolygon(PgQuery1f_polygon.AsPgGeometric).Points[i].Y := 0;
  end;
  PgQuery1.Post;
end;

[email protected]
Posts: 27
Joined: Fri 12 Feb 2010 07:44

Re: Reading and writing geographic objects

Post by [email protected] » Mon 26 Aug 2013 08:27

Hello again.

I am affraid it doesn't work.
I would like to make certain:
PgDAC works currently not only with native field types for PostreSQL but with "GEOMETRY" from PostGIS also. So, I use similar code like I wrote in the beginning of this thread:

TPgGeometric *geom = ((TPgGeometricField*) qSelect->FieldByName("the_geom"))->AsPgGeometric;

TPgPolygon *poly = (TPgPolygon*) geom;

for ( int i = 0; i < poly->Count; i++ )
{
TPgPoint *p1 = poly->Points;
}

It is writing in C++ but that is the same idea.
Pointer 'geom' is NULL. How can I get "the_geom" field value? In ODAC I use ->GetObject() method.

Regards
Wojto.

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: Reading and writing geographic objects

Post by DemetrionQ » Tue 27 Aug 2013 10:04

Hello.

I couldn't reproduce the problem. Please provide the script for creating the table. Also make sure the TPgConnection.Options.EnableGeometrics property is set to True.

[email protected]
Posts: 27
Joined: Fri 12 Feb 2010 07:44

Re: Reading and writing geographic objects

Post by [email protected] » Tue 27 Aug 2013 12:31

There is:

CREATE TABLE test_geom
(
f_id integer NOT NULL,
the_geom geometry
)
WITH (
OIDS=FALSE
);
ALTER TABLE test_geom OWNER TO postgres;

INSERT INTO test_geom(f_id, the_geom) VALUES (1, ST_GeometryFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'))


I don't know what variable "PgQuery1f_polygon" means in your example.
TPgConnection.Options.EnableGeometrics property is set to True.

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: Reading and writing geographic objects

Post by DemetrionQ » Thu 29 Aug 2013 10:51

PgDAC supports only standard geometric types of PostgreSQL server: POINT, LSEG, BOX, PATH, POLYGON, CIRCLE.

In our example, PgQuery1f_polygon is a persistent field for the f_polygon column created in the Fields Editor of the PgQuery1 component.

[email protected]
Posts: 27
Joined: Fri 12 Feb 2010 07:44

Re: Reading and writing geographic objects

Post by [email protected] » Thu 29 Aug 2013 12:09

I beg your pardon?
AlexP wrote:Hello,

This feature is added to PgDAC, it will be available in the next build.
So what feature is it?
In previous post I wrote:
[email protected] wrote: I would like to make certain:
PgDAC works currently not only with native field types for PostreSQL but with "GEOMETRY" from PostGIS also.
I did not find answer.
We are going to buy PgDAC components because of that new feauture and you tell me again that functionality is not available?

Ok.
Could you tell me when do you plan to implement that feature?

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: Reading and writing geographic objects

Post by DemetrionQ » Fri 30 Aug 2013 09:05

AlexP wrote:Hello,

This feature is added to PgDAC, it will be available in the next build.
It was about the full support of the standard geometric types, and it was added. We have not announced the support for the PostGIS types, and we don't plan development in this direction for the near future.
You can leave a request to add this functionality at our UserVoice ( http://devart.uservoice.com/forums/1046 ... components ). If the suggestion reaches a large number of votes, we will consider the possibility of its implementation.

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

Re: Reading and writing geographic objects

Post by Morelli » Fri 27 Nov 2020 09:38

Hi,
Had anyone ins this forum successfully read/wrote PostGIS geometries?

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

Re: Reading and writing geographic objects

Post by oleg0k » Fri 12 Mar 2021 15:43

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