I have a layer of Points with some attributes in GeoServer. Is it possible to create a style that would combine all the points in this layer in a line according to "date" attribute order? I want to receive a list of points through WFS service and single line through WMS service from the same layer.

EDIT: I use PostgreSQL with PostGIS.

  • What's your data source? – DPSSpatial May 16 '17 at 2:51
  • @DPSSpatial I use PostgreSQL database with PostGIS – Vitaliy May 16 '17 at 3:16
  • the answer below was what I was going to suggest... – DPSSpatial May 16 '17 at 13:06

No. SLD cannot do this.

But you can create SQL Views from GeoServer:

Go to Layer -> New Layer -> Choose your PostGIS Store from the Dropdown -> Configure new SQL view ...

Then you can write something like this using ST_MakeLine as SQL statement:

SELECT ST_MakeLine(the_geom ORDER BY date) as line FROM your_points_table;

For the WFS Service you will receive the same line of course. But you could split the line to points from the WFS in your client afterwards.

  • Idea should work but that SQL for sure not. See better examples in postgis.net/docs/ST_MakeLine.html. – user30184 May 16 '17 at 6:32
  • right, the points need to be ordered, not the line ;-) Updated the answer – pLumo May 16 '17 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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