0

I'm developing a web application using PostGIS, Laravel, Vue.js and Openlayers, for the moment I generate the GeoJSON from my database using the following code :

 public function plosWithGeom()
    {

        return DB::table("plos")->selectRaw("ST_AsGeoJSON(geometry) as geom,*")->get();
    }

which is equivalent to

 select ST_AsGeoJSON(geometry) as geom,* from plos

using this approach serves me a result that's easy to manipulate using JavaScript, but I'm asking about performance compared to serve this data using an OGC service (WMS/WFS ) on MapServer

Update :

The server sends the data to the frontend like a text, in the frontend I parse this data using JavaScript and show it with OpenLayers. For the moment I'm working with a region, the server serves linestring and points with 530KB as size and I predict that will reach 10MB when working with all the country.

closed as too broad by Vince, Ian Turton May 22 at 11:22

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    That's impossible to say without knowing all about your data, setup, hardware, clients etc. And are you sure you mean WMS? – bugmenot123 May 22 at 8:20
  • i mean also WFS, i provided some details in the comments of @IanTurton answer – Boussadjra Brahim May 22 at 9:01
  • Not sure if you meant mapserver (specific software) rather than a generic term for wms/wfs – nmtoken May 22 at 9:16
  • 1
    This is like asking whether school bus or bicycle is faster, without providing distances or what needs to be carried. – Vince May 22 at 10:41
  • 1
    you need to edit the question to make what you want clearer. – Ian Turton May 22 at 11:22
3

Hard to answer without more info.

Getting the data from the DB will be about the same in each case.

Converting it to an image (WMS) or GeoJSON will depend on the number and size of the features.

Transmitting the data to the client will again depend on the size and number of features, for small datasets GeoJSON will be faster but for larger or more complex features WMS will win.

Finally displaying the data will depend on the size and complexity of the data, for very small data sets you can probably parse the GeoJSON into OpenLayers features faster than you can display an image, but you then have to style and draw them which may well end up being slower.

  • the server sends the data to the frontend like a text, in the frontend i parse this data using javascript and showing it with openlayers, for the moment i'm working with a region, the server serves linestring and points with 530KB i and i predict that will reach 10MB when working with all the country – Boussadjra Brahim May 22 at 8:41
  • use WMS then - 10Mb will take an age to download and process on my phone – Ian Turton May 22 at 8:42
  • the app is dedicated to professional use, so it runs in machines with i3/4GB minimal requirements – Boussadjra Brahim May 22 at 8:52
  • 1
    For keeping the filesize small, you can use filters for BBOX, zoom and features. You could do it yourself or use a WFS. An example for WFS would be openlayers.org/en/latest/examples/vector-wfs-getfeature.html – bennos May 22 at 9:21

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