camptocamp / ngeo

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

Text from Drawing Tools is Rendered with a too large Buffer when Printed #3065

Closed marionb closed 6 years ago

marionb commented 7 years ago

Project:

Permalink directly where we can reproduce the issue:

Steps to reproduce the issue:

Result: Text elements are rendered with a buffer that is too large compared to what we actually see on the map.

Expected result: The print should look like what we see on the map. With a smaller buffer.

The issue concern the following environment:

The following environment is working as expected:

ger-benjamin commented 7 years ago

I'm not sure if the error is in Openlayers or in MapFish Print.

In the example below, I've made a text with some different value. Each time, we set the haloradius of MapFish Print with the stroke value from ol3.

the report spec: selection_054

The OpenLayers ("on web") result selection_050

The MapFish Print ("on pdf") result: selection_053

(Permalink parameters to reproduce the text: ?debug&lang=en&baselayer_ref=OSM map&tree_group_layers_Transport&rl_features=Fa(hc8yGkvyg!.1n9-hxO..zm9-~rtrue'nRectangle%25201'c%2523DB4436'a0'o0.25'mfalse's10'k1.5)p(9bjyG3n2j!~ttrue'nStroke%2520value%2520%253D%25201'c%2523000000'a0'o0.2'mfalse's10'k1)p(15jyGkjwh!~ttrue'nStroke%2520value%2520%253D%25202'c%2523000000'a0'o0.2'mfalse's10'k2)p(9bjyG3xph!~ttrue'nStroke%2520value%2520%253D%25203'c%2523000000'a0'o0.2'mfalse's10'k3)p(9bjyG3beh!~ttrue'nStroke%2520value%2520%253D%25204'c%2523000000'a0'o0.2'mfalse's10'k4)p(hhjyGkb5h!~ttrue'nStroke%2520value%2520%253D%25205'c%2523000000'a0'o0.2'mfalse's10'k5)&map_x=627801&map_y=183958&map_zoom=4&tree_groups=Transport)

Stroke is slightly different. Text size is also slightly different (see the length of the text compared to the size of my red square). Probably due to the Font.

Nothing to do in NGEO I think.

ger-benjamin commented 7 years ago

@sbrunner What should we do with this issue ? (I think, that concern more MapFish Print)

sbrunner commented 7 years ago

Are we sure that's an issue in mapfish print, and not in openlayers?

ger-benjamin commented 7 years ago

In OpenLayers, we want a stroke of 3 pixels, we get a stroke of 3 pixels.

In MapFish Print, 3 pixels is not 3 pixels, OR the value "3" doesn't use the unit "pixel*. I don't know, I don't see any mention to the unit they use in the documentation: http://mapfish.github.io/mapfish-print-doc/styles.html#haloproperties

sbrunner commented 7 years ago

OK, then it should be reported on MapfishPrint

ger-benjamin commented 7 years ago

Reported: https://github.com/mapfish/mapfish-print/issues/605

sbrunner commented 7 years ago

Thanks :-)

pvalsecc commented 6 years ago

IMHO, the problem is in ngeo:

To me, https://github.com/camptocamp/ngeo/blob/master/src/services/print.js#L790 should be:

symbolizer.haloRadius = width / 2.0;
yjacolin commented 6 years ago

ping @ger-benjamin what do you think about this?

ger-benjamin commented 6 years ago

Make sens. I'll re-open this issue and close the other

ger-benjamin commented 6 years ago

Done