Skip to main content
Solved

Select Linestrings from a PostGis table usingg SQL executor.

  • November 2, 2020
  • 3 replies
  • 20 views

pschout
Participant
Forum|alt.badge.img+2

I use the SQL executor to join a lot of PostGreSQL and PostGis tabels.

One of these tables contain a "geom" column with points and line objects. At the end of the SQL statement i want to select only the lines. Can anyone specify which statement to use to select only linestrings?

 

Best answer by ebygomm

I don't have access to PostGIS to test but something along the lines of ?

where ST_GeometryType(geom) = 'ST_LineString'

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • Best Answer
  • November 2, 2020

I don't have access to PostGIS to test but something along the lines of ?

where ST_GeometryType(geom) = 'ST_LineString'

 


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • November 2, 2020

Yes, this ^^^.   Also alternative PostGIS function supported is:

WHERE GeometryType(geom)='LINESTRING'

See PostGIS Documentation

https://postgis.net/docs/ST_GeometryType.html

https://postgis.net/docs/GeometryType.html


pschout
Participant
Forum|alt.badge.img+2
  • Author
  • Participant
  • November 2, 2020

Thanks! Both options are useable!