camptocamp / ngeo

Library combining OpenLayers and AngularJS
https://camptocamp.github.io/ngeo/master/examples
MIT License
135 stars 87 forks source link

Size of WMS requests on mobile devices #2654

Closed gnerred closed 7 years ago

gnerred commented 7 years ago

With NGEO mobile application, the size parameters of WMS (internal or external) requests are very high...

For example, with a Galaxy S6, we have WIDTH=2160&HEIGHT=3354,

while on a big desktop screen (24''), we have something like WIDTH=2400&HEIGHT=900

I imagine this is related to high resolution of mobile devices... but this has 2 consequences : 1°/ Requests speed are low on mobile devices 2°/ Size of labels defined in pixels for external WMS layers is too small and not readable on the device

sbrunner commented 7 years ago

first for 2°:

for 1°:

I purpose that we fix 2°, then see what we will do with 1°.

PS: the links are wrong :-)

gnerred commented 7 years ago

Ok with your proposal, so I wait next 2.1 release to test. Do you have already planned the next 2.1 release ?

fredj commented 7 years ago

See also #2544

fredj commented 7 years ago

About the labels size: the dpi parameter is correctly passed to mapserver (MAP_RESOLUTION=270 in my case). Maybe something is missing in the mapserver configuration? (http://mapserver.org/ru/development/rfc/ms-rfc-55.html)

gnerred commented 7 years ago

It is not related to mapserver, but to QGIS server. How do you see this MAP_RESOLUTION ? Here is an example of request sent

https://preprod.cartoriviera.ch/preprod/wsgi/mapserv_proxy?ogcserver=source+for+https%3A%2F%2Fpreprod.cartoriviera.ch%2Fqgis%2Fqgis_mapserver.fcgi%3Fmap%3D%2Fvar%2Fsig%2Fqgis%2Fexport.qgs%26transparent%3Dtrue+image%2Fpng&cache_version=d9970d141dd5433e9cf0591259f37c5d&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=export_reach&SERVERTYPE=mapserver&CRS=EPSG%3A21781&STYLES=&WIDTH=2520&HEIGHT=827&BBOX=553543%2C145287.375%2C554803%2C145700.625

sbrunner commented 7 years ago

@fredj In this case the DPI parameter is missing ...

fredj commented 7 years ago

@gnerred in the admin interface, can you check if this OGCServer "Server type" is QGISserver ?

gnerred commented 7 years ago

No it was mapserver... I changed to QGISserver and now it works fine, thanks :O) !

gnerred commented 7 years ago

Oh sorry, the problem of printing remains : https://github.com/camptocamp/c2cgeoportal/issues/2962

sbrunner commented 7 years ago

Finally it an issue when you print a qgis layer with cgxp?

gnerred commented 7 years ago

Yes it is still an issue. To reproduce :

1°/ Go to https://preprod.cartoriviera.ch/s/Hvds 2°/ Do a print on the red lines -> symbols are too small in PDF result

fredj commented 7 years ago

In the data sent to the print server, serverType is still mapserver:

...
{
  baseUrl: "https://preprod.cartoriviera.ch/qgis/qgis_mapserver.fcgi?map=/var/sig/qgis/export.qgs&transparent=true",
  customParams: {...},
  serverType: "mapserver",
  ...
}
...
gnerred commented 7 years ago

I my database, it seems to be configured correcty : image

sbrunner commented 7 years ago

But your using the CGXP interface who don't use this table ...

gnerred commented 7 years ago

So where is it configured ? It seems that it cannot be configured in admin interface, right ? So you have to fix it in the code ?

fredj commented 7 years ago

The problem is that the print in the CGXP interface doesn't use the server type; the value is fixed to mapserver.

See: https://github.com/camptocamp/cgxp/blob/master/core/src/script/CGXP/plugins/Print.js#L344-L347

gnerred commented 7 years ago

So what is the solution ?

fredj commented 7 years ago

Need to be checked with @ger-benjamin and @sbrunner but the following code could be added to the project to set the correct serverType when encoding the wms layer:

printProvider.on('encodelayer', function(printProvider, layer, encodedLayer) {
  if (encodedLayer.baseURL.indexOf('qgis') > -1) {
    Ext.apply(encodedLayer, {
      serverType: 'qgisserver'
    }
  });
});
gnerred commented 7 years ago

Ok thanks @fredj , I wait your next feed-back

sbrunner commented 7 years ago

For me thats looks good :-)

gnerred commented 7 years ago

I've installed latest 2.2.0.dev13, but there is still a problem on mobile device with QGIS layers. Will it be fixed in this issue ? image

ybolognini commented 7 years ago

@sbrunner will check if ngeo sends the right dpi parameters to QGIS

ybolognini commented 7 years ago

Now print issue has been added here: https://github.com/camptocamp/ngeo/issues/2793

This issue concerns mobile dpi issue only.

sbrunner commented 7 years ago

@gnerred in the admin interface I change the server type to QGIS, and it seem working :-)

This should be done manually after running the themev1tov2 script.

gnerred commented 7 years ago

OK fine thanks ! So it will be great if script themev1tov2 could be adapted to automatically set server type to QGIS if base URL of layer V1 contains "qgis_mapserver.fcgi". What do you think ? Because each manual step if one more chance to have problems...

sbrunner commented 7 years ago

Replaced by https://github.com/camptocamp/c2cgeoportal/issues/3015