Reputation: 1
Trying to create a view that joins two tables, converts XY coord data into a sinlge spatial point, and sets the SRID value. I've got it all working except for the SRID command. I can't use pre assigned coordinates to do a transform as I'm generating multiple results. Any help would be appreciated!
CREATE VIEW V_Station_Locations AS
SELECT S.station_id, S.station_name,
ST_MakePoint(V.x_coord, V.y_coord)
ST_SetSRID(ST_Point(x_coord, y_coord),28350)
FROM STATION S
INNER JOIN SUBURB_VERTEX V ON (S.vertex_id=V.vertex_id)
Upvotes: 0
Views: 303
Reputation: 17846
Just move the st_setSRID
up:
CREATE VIEW V_Station_Locations AS
SELECT S.station_id, S.station_name,
ST_SetSRID(ST_MakePoint(V.x_coord, V.y_coord),28350) as geom
FROM STATION S
INNER JOIN SUBURB_VERTEX V ON (S.vertex_id=V.vertex_id)
Upvotes: 1