Hello!
I have a raster layer that displays surface currents. Everything works great, but there are some details that I wish to get rid of but dont know how to.
Below, the two pictures show what the layer looks like at a different zoom level. The first one is zoomed out compared to the second one. As you can see, the arrows are smaller on the second one. I wish it wasnt like this. I’m trying to make it so that the arrows stay the same size.
I’ve tried to play around with the wms_scale_denominator property in my sld, but it doesnt seem to do the trick.
Here is my SLD:
<?xml version="1.0" encoding="ISO-8859-1"?>
currents
currents
data
interpolation
InterpolationBilinear
Heading
extshape://narrow
u
u
v
v
#e0e2e6
0.514
#96ade4
1.03
#376AE2
1.542
#249D53
2.056
#F98308
2.57
#F91A08
u
u
v
v
0
0.001
1
1000
0F
u
u
v
v
13
0.514
13
1.03
16
1.542
19
2.056
22
2.57
25
u
v
Thanks a lot for your help!
···
Julien Robitaille
Scientifique de données
Data scientist
En télétravail - Working from home
Visitez notre site web pour en savoir plus sur notre campagne de communication en cours!
Visit our website to learn more about our ongoing communication campaign!
Hello!
I have a raster layer that displays surface currents. Everything works great, but there are some details that I wish to get rid of but dont know how to.
Below, the two pictures show what the layer looks like at a different zoom level. The first one is zoomed out compared to the second one. As you can see, the arrows are smaller on the second one. I wish it wasnt like this. I’m trying to make it so that the arrows stay the same size.
I’ve tried to play around with the wms_scale_denominator property in my sld, but it doesnt seem to do the trick.
Here is my SLD:
<?xml version="1.0" encoding="ISO-8859-1"?>
currents
currents
data
interpolation
InterpolationBilinear
Heading
extshape://narrow
u
u
v
v
#e0e2e6
0.514
#96ade4
1.03
#376AE2
1.542
#249D53
2.056
#F98308
2.57
#F91A08
u
u
v
v
0
0.001
1
1000
0F
u
u
v
v
13
0.514
13
1.03
16
1.542
19
2.056
22
2.57
25
u
v
Thanks a lot for your help!
Julien Robitaille
Scientifique de données
Data scientist
En télétravail - Working from home
Visitez notre site web pour en savoir plus sur notre campagne de communication en cours!
Visit our website to learn more about our ongoing communication campaign!
Hello!
I found out that the difference in size from one zoom level to another one comes from openlayers.
But in any cases, what I would like to do is to increase the sizes of the arrows, so it is easier to see. The problem is that the display of those arrows depends a lot on whether the user uses a computer or a smartphone.
Here is an example. The first picture is from my computer, and the second one is from my phone.
As you can see, the resolution of the arrows is not the same, even at the approximate same zoom level.
As you can see, increasing the size of the arrows would make the app unreadable on the phone.
Does anyone know how to address this problem? Is it something that can be fixed by geoserver, or is it more of an openlayers’ problem?
Thanks a lot for your help!
Julien
···
Julien Robitaille
Scientifique de données
Data scientist
En télétravail - Working from home
Visitez notre site web pour en savoir plus sur notre campagne de communication en cours!
Visit our website to learn more about our ongoing communication campaign!
The challenge faced here is not particular to geoserver - it is a design challenge on how you wish to adapt your map to different environments.
You can supply GeoServer with the dpi of the display used (have openlayers pass this information in as a format option) . GeoSerer will adjust the sizes appropriately. Much of the other information is available as env variables for use when styling.
It could be a DPI problem - I think some phones will ask openlayers to request WMS tiles/images at a higher DPI, so you end up with smaller arrows as there are more pixels per unit length. You could try adding format_option=dpi:96 to stop that - see https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#format-options for more details.
aside: Your messages are being held because of the attached images; here is my reply.
The challenge faced here is not particular to geoserver - it is a design challenge on how you wish to adapt your map to different environments.
You can supply GeoServer with the dpi of the display used (have openlayers pass this information in as a format option) . GeoSerer will adjust the sizes appropriately. Much of the other information is available as env variables for use when styling.
By resolution, do you mean the dpi resolution? Or maybe the “resolution” of my raster layer (size of georeferenced cells)? The best way to play with the concentration of arrows that I found was to play with the wms_scale_denominator. So I thought I could make two different sld styles, one for computers, and another one for smartphones, with different values of wms_scale_denominator. And depending on the screen size and/or resolution of screen of the user, one of the two styles would be applied to the layer.
Thanks again,
Julien
···
Julien Robitaille
Scientifique de données
Data scientist
En télétravail - Working from home
Visitez notre site web pour en savoir plus sur notre campagne de communication en cours!
Visit our website to learn more about our ongoing communication campaign!
I am no expert in OpenLayers but could the OpenLayers option;
OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
help? Can it force the DPI to be the same no matter what the Device DPI is.
···
Julien Robitaille
Scientifique de données
Data scientist
En télétravail - Working from home
Visitez notre site web pour en savoir plus sur notre campagne de communication en cours!
Visit our website to learn more about our ongoing communication campaign!
Thanks for your input. I’ve looked at the DOTS_PER_INCH, but I dont think it is still a valid parameter in openlayers (at least since the version 6).
But I found out that the arrow density seems to depend on the devicePixelRatio of the window. As a matter of fact, if I increase the devicePixelRatio of my browser (to a value similar to the one of my phone) by zooming it in, I get the same arrow density as the layer displayed on a smartphone.
So with that information I will be able to create two different sld styles, one for higher devicePixelRatio (usually smartphones), and one for lower devicePixelRatio (usually computers).
Thanks everyone for your help!
Julien
···
Julien Robitaille
Scientifique de données
Data scientist
En télétravail - Working from home
Visitez notre site web pour en savoir plus sur notre campagne de communication en cours!
Visit our website to learn more about our ongoing communication campaign!
For everyone following this list at home can you share your resulting SLD with the group? I am sure others will run into similar challenges and search the email list.
Hello!
Indeed, this is a great idea!
The issue I faced was that different devices have different pixel ratios (in javascript, you can access this property with the variable window.devicePixelRatio).
So I ended up having two different styles, depending on the pixel ratio of the device.
For a pixel ratio of under 2.3 (usually laptops), here is the SLD:
I have underlined in orange the part that has to be changed for a different pixel ratio. In my case, for generally smartphones, this orange part is replaced in my SLD by: ogc:Literal0.01</ogc:Literal> ogc:Literal500000</ogc:Literal> ogc:Literal0.012</ogc:Literal>
Hope this can help someone in the future!
Julien
···
Julien Robitaille
Scientifique de données
Data scientist
En télétravail - Working from home
Visitez notre site web pour en savoir plus sur notre campagne de communication en cours!
Visit our website to learn more about our ongoing communication campaign!