2

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.

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

1 Answer 1

4

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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