Skip to main content
Solved

Select Linestrings from a PostGis table usingg SQL executor.


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'

 

View original
Did this help you find an answer to your question?

3 replies

ebygomm
Influencer
Forum|alt.badge.img+39
  • 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!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings