Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In my table I have a column "location" that is a POINT. I tried this:

SELECT ST_X(location), ST_Y(location) FROM locations;

But I still get the error message: ERROR: function st_x(point) does not exist

share|improve this question
1  
If you execute the query SELECT ST_X(ST_GeomFromEWKT('POINT(1 2 3 4)')); does it work or get any error? –  juanluisrp Jun 26 '13 at 9:46
    
it returns "1". I have the postgis extension added –  George Hown Jun 26 '13 at 12:09
    
what do you get from "\d locations" and "select * from locations"? paste here the first 5 lines of the latter query –  Gery Jun 26 '13 at 12:17

2 Answers 2

up vote 1 down vote accepted

It looks like your column location type is point (PostgreSQL reference). This is a native PostgreSQL type, not an Postgis datatype.

You have to change location column data type to geometry or add a new geometry column with the Postgis function AddGeometryColumn.

share|improve this answer
    
It works now! Thanks –  George Hown Jun 26 '13 at 17:26

you need to use:

SELECT ST_X(geom), ST_Y(geom) FROM locations;

I suppose that locations is a table of points with the geometry named as "geom".

Hope this helps,

share|improve this answer
    
Property Value Name location Position 35 Data type point Collation Default Sequence Not NULL? No Primary key? No Foreign key? No Storage PLAIN Inherited No Statistics -1 System column? No I don't understand what you mean with this comment –  Gery Jun 26 '13 at 12:21
    
my "location" column field table properties...I dont know how to edit this nicely :( –  George Hown Jun 26 '13 at 13:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.