2

Currently my rules for styling point Icons bound to scale look like this:

:mark{
  mark: url("file:./icon.svg");
  mark-mime: "image/svg+xml";
}

[atrib='xyz'][@scale > 600 ][@scale < 1000] {
  mark-size:10;
}

[atrib='xyz'][@scale > 400 ][@scale < 600]  {
  mark-size:60;
}

[atrib='xyz'][@scale < 400]  {
  mark-size:120;
}

It´s hard to guess the correct icon size compared to scale. (Trial and error).

Questions:

  • is there a best practice like "between scale 600 and 1000 mark size X is appropriated" (or a formular?)
  • which unit is "mark-size"? pt, px,em?

closed as too broad by PolyGeo Jul 1 '17 at 22:17

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

Your first question is essentially unanswerable by anyone but you who can see your mark and the type of map you are creating. Personally I usually go for small rather than big unless the whole point of the map is the markers.

For your second question the default unit of measure is pixels (px) but it could also be feet (ft) or metres (m) which would allow your mark to grow or shrink as the user zooms the map. See the CSS documentation for details of how to set these and which size value determines the units of an object.

  • thanks again iant, one more related question. does openlayer getScale() tell the same scale calculation as min-maxScaleDenominator used in SLDs ? I´m asking because checking console.log(map.getScale()); a SLD rule should grip but does not. To make a long story short: Can I log current OL scaleDenominator to see if I´m "inside" a SLD min-maxScaleDenominator? This would be useful for working on mark-size. – t Book Jul 24 '15 at 14:10
  • You need to set OpenLayers.DOTS_PER_INCH to match your server - check the image preview of a GeoServer site to see an example – Ian Turton Jul 24 '15 at 14:15
  • Uff, seems you know what I´m looking for hours now. But I´m a bit to inexperienced to follow your advise. with "check the preview …" do you mean to check an Openlayers layerpreview of geoserver, if so where do I get correct Dots_Per_inch from. Or do you mean the general examples? dev.openlayers.org/examples/zoomLevels.html thanks a lot! – t Book Jul 24 '15 at 14:21
  • I meant one of the GeoServer layer previews - but you can just set it to the OGC standard output resolution of 90 DPI. – Ian Turton Jul 24 '15 at 14:25
  • Ok so by creating the OL map setting OpenLayers.DOTS_PER_INCH to 90 should work? – t Book Jul 24 '15 at 14:27

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