Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-dev] WMS rendering and dpi

Comments below

On Tue, Nov 5, 2013 at 7:16 PM, Jody Garnett <jody.garnett@xxxxxxxxx> wrote:
I find the WMS and DPI relationship to be difficult, we already did an calculation adjustment to fix relative font sizes due to difference between the two specs. We want DPI to mimic the screen (so that we get the correct line width and an support units of measure correctly); at the same time we want the font sizes calculated in "points" (which requires a guess at 72 DPI for java font metrics calculations).

So when you say "not correctly styled" can you be a bit more specific?

My main issue is that the server-side styles that contain a scale rule sld:MaxScaleDenominator/sld:MinScaleDenominator do not render correctly.
And raster layers that should be visible depending on the scale, also do not render correctly.
I gave an example above, I'll be more specific:

Example 1:
Let's say that you have a layer in Geoserver backed by some features in Postgis.
That layer has an SLD which has a rule to display labels in scales 0-19999 and no labels in scale 20000 and above. 
You add it in uDig as wms layer. Set the scale to 20000. The result image contains labels and it should not.

Example 2:
Let's say that you have a raster layer in MapServer which is invisible in scales 0-99999 and visible in scale 100000 and above. 
You add it in uDig as wms layer. Set the scale to 100000. The result image is blank, the rule is not respected.

I can attach some screenshots too.

As I mentioned above, the problem is that the server uses a default dpi value depending on the specs (90 usually).
And uDig uses the desktop dpi settings (96 usually).
The result is that the scale in the server has different value than in uDig.

 
I would also like if you can try images in GeoServer by passing in a DPI setting; just so you can be sure what you are working with and compare how both systems handle the problem..

 I use both Geoserver and MapServer and I had problems with layers coming from both. 
By passing the dpi in the request, everything renders as it should (fonts appear ok too).
Unfortunately each server implementation has its own custom dpi parameter:
Geoserver needs &FORMAT_OPTIONS=dpi:VALUE
MapServer needs & MAP_RESOLUTION=VALUE



On 6 November 2013 at 1:45:54 am, Panagiotis Skintzos (p@xxxxxxxxxxxxx) wrote:

Hi list,

Currently there is a problem with the WMS rendering: The server-side scale rules in SLDs are not applied properly. 
This is because the scale calculation in uDig differs from the scale calculation in WMS server.
The difference is the DPI setting.  In uDig it is usually 96 (depending on desktop settings).
But in WMS servers the default is rather 90 or 72 or something different.
The result is that the image coming from the server to uDig is not correctly styled.

Let's say that you view a wms layer in scale 1:20000 in uDig. 
And in the SLD on the server (Geoserver) you have a rule with maximum scale denominator 19999 for some labels. So, normally you should not see the labels in the result image. 
But the labels do appear. Because the scale denominator in the server is calculated with its default dpi value of 90. And results in something lower thean 20000

To the rescue comes the GetMapRequest.setVendorSpecificParameter(String name, String value)

So, to resolve this I modified the WMS renderer (BasicWMSRenderer2) to supply vendor specific parameters to send the correct dpi on the server  (out of the wms spec). See my comment in related JIRA bug:
http://jira.codehaus.org/browse/UDIG-1734

Furthermore I needed to supply some other vendor specific parameters for each layer separately, namely "maxfeatures".
I modified the  WMS renderer and the WMS metrics (BasicWMSMetrics2) to query these parameters from the layer's IGeoResource persistent properties.
I set some persistent properties per layer when I create the IService (like  IGeoResource.getPersistentProperties().put("wms:maxfeatures", 1000).

The result works fine and all server styles are rendered properly in any uDig dpi/scale.

If you think that's a good solution I can make a patch.
I'm just kind of lost atm with the versions/branches.

Regards,
Panagiotis
_______________________________________________
udig-dev mailing list
udig-dev@xxxxxxxxxxxxxxxx
https://locationtech.org/mailman/listinfo/udig-dev


Back to the top