MAK
MAK

Reputation: 7260

Insert GEOMETRY value using PostgreSQL 9.3

I want to insert GEOMETRY values into a table. For which I have a table with three columns as shown below:

Table: geo

create table geo
(
  p1 float,
  p2 float,
  Paths GEOMETRY
);

Input values: I have following values

p1 = 22.9901232886963
p2 = 87.5953903123242

In SQL Server I used this:

INSERT INTO geo(Paths)
VALUES (geometry = geometry::STGeomFromText('POINT (22.9901232886963 87.5953903123242)'
,4326);

Question: Is there any function of GEOMETRY to calculate points in PostgreSQL 9.3 version?

Upvotes: 4

Views: 9659

Answers (1)

MAK
MAK

Reputation: 7260

This works for me by referring: http://www.postgresql.org/docs/current/static/functions-geometry.html.

The function:

point(point(double precision, double precision);

So I need to convert the function: using ::geometry

Finally the insert statement looks like:

insert into geo values(22.9901232886963 87.5953903123242,
point(22.9901232886963 87.5953903123242)::geometry);

Am I right?

Upvotes: 2

Related Questions