1

Following the suggestion from this topic I'm posting my question here.

I have a table in postgres/postgis with geo data and I want to show them on map via qgis.

Here is the table:

city  |  street  |  geo
A     |  A1      |  LINESTRING(17.257125 54.595952,17.253573 54.599437)

I do not know how to do this. I can show a single point on map (creating geo column with AddGeometryColumn function) without any problem, but how to show this part LINESTRING(17.257125 54.595952,17.253573 54.599437) (points with line between them). Any advices, suggestions or link to some articles about it?

I was thinking about splitting geo coordinates from Linestring(), but in the end this will not work at least that is my opinion.

I'm new to GIS things so please guide me.

Voystin
  • 113
  • 4
  • to display the points (nodes) on a linestring check out this question: http://gis.stackexchange.com/questions/177613/how-to-display-vertex-markers-in-qgis-for-non-editable-layers if you want the nodes as features then you will have to create a separate layer like this: http://gis.stackexchange.com/questions/41923/how-to-extract-point-from-a-linemultilinestring – ylka May 24 '16 at 13:25

1 Answers1

2

PostgreSQL / PostGIS (pgAdmin3) create a view and use ST_GeomFromText (text WKT):

  • text WKT = geo;

enter image description here

pigreco
  • 4,460
  • 1
  • 15
  • 32
  • Thank you for your answer, however I found that for this case I create geometry column but forgot to fill it with data. Now when I'm trying to do this in the same way as with my table with points only I have error message: Error: parse error - invalid geometry HINT: "Linestring(LINESTRING(" <-- parse error at position 22 within geometry. This is my query: UPDATE public.tablename SET geom = ST_GeomFromText('Linestring('|| x || ')',4269); where x is the name of table with linestring data. – Voystin May 25 '16 at 07:12
  • I did not understand, do you want to get a linear geometry starting from a points table? – pigreco May 25 '16 at 09:12
  • Actually doesn't matter anymore. I had a mistake in data in table. Data in Geo column were in format LINESTRING(17.257125 54.595952,17.253573 54.599437). When I removed LINESTRING, ( and ) everything is working fine. So thank you very much for your support. – Voystin May 25 '16 at 09:21