I installed PostgreSQL 9.2.4 and PostGIS 2.0.3 on my Windows 8 machine. Then I created a table using phpPgAdmin and added a geometry column using the following statement.
SELECT AddGeometryColumn('tablename', 'area', -1, 'POLYGON', 2);
That resulted in these table columns.
+------+---------------------+--------+----------------------------------+-----------+
|Column|Type |Not Null|Default |Constraints|
+------+---------------------+--------+----------------------------------+-----------+
|id |integer |NOT NULL|nextval('simple_id_seq'::regclass)|PRIMARY KEY|
|name |character varying(50)| | | |
|area |geometry(Polygon) | | | |
+------+---------------------+--------+----------------------------------+-----------+
After some simple text queries I tried to play with geometry data. This is the query I tried to execute.
INSERT INTO tablename (name, area)
VALUES (
'Lake',
GeometryFromText('POLYGON((84 104, 212 48, 321 122, 243 179, 275 238, 131 240))', -1)
);
Unfortunately, it throws an error message.
ERROR: function geometryfromtext(unknown, integer) does not exist
LINE 4: GeometryFromText('POLYGON((84 104, 212 48, 321 122, 243 ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Since AddGeometryColumn
was successful, I assume that PostGIS is set up properly. How can I insert geometry data in my table? What am I doing wrong?