1

I have a very standard OpenLayers setup, and the map shows up fairly blurry compared to normal enter image description here

Of note, when I zoom the page (Note: not zoom the map) with the browser it looks good: enter image description here

I'm not sure what to do here, I have pixelRatio of the map set to 1, I have my viewport tag setup as follows

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, shrink-to-fit=no, user-scalable=no">
user37309
  • 597
  • 5
  • 14
  • How were you able to use browser zoom with user-scalable=no set? Presumably shrink-to-fit=no is overriding and causing the problem, so try removing it from the meta. – Mike Sep 20 '18 at 14:13
  • Makes no difference, removing the whole tag, just having the "width" and "initial-scale" values, etc. – user37309 Sep 21 '18 at 02:34
  • Was able to zoom by opening chrome menu and using the buttons there but yes strange that it actually worked given that. Still though, result is the same regardless – user37309 Sep 21 '18 at 02:35
  • `` is a standard setting and works on everything I have used. Suggest you try other browsers and devices in case it's a configuration setting on what you are using now. Also try leaving pixelRatio undefined and let it default to the device's pixel ratio. – Mike Sep 21 '18 at 09:35
  • Definitely not a config problem, consistent across all devices, even mobile. Including the meta tag was just to stop answers recommending that I do it, as it isn't the issue. – user37309 Sep 21 '18 at 13:45
  • I've just realised from the background mapping that you must be doing a google maps integration of some kind, so it's not going to be a standard OpenLayers setup. Unless you are hotlinking tiles (which google will detect and block) openlayers will simply be a wrapper for a gmap and settings for that may take precedence. – Mike Sep 21 '18 at 19:17
  • I did have it running OSM at some point and it did the same thing; Given that zooming out seems to fix it this is not just 'how it is'? – user37309 Sep 22 '18 at 11:47
  • There must something non-standard in your code. You will need to include that in the question. – Mike Sep 22 '18 at 12:29
  • @Mike This is reproducible with or without non-standard code. If you did any testing at all, you'd be able to see that. Same issue with the meta tag appears whether you're loading the OSM map, Mapbox maps, or anything else you throw at it. This is an OL issue, not a use-case issue. – HelpingHand Jul 30 '19 at 19:14
  • @HelpingHand I have dozens of OpenLayers maps with no blurring problems in normal use. None of OpenLayers' own examples have any problems. Raster reprojection will reduce quality, as does using view resolution settings which don't match the tile resolutions, but those are not a standard setup. If you can see problems in the OpenLayers examples it might be a device or browser setup issue at your end. – Mike Jul 30 '19 at 20:19
  • @Mike Do you happen to know how to get the tile resolution? Because all I can find is the tilegrid.getResolution() but I'm using ol.source.tile not tilegrid. – HelpingHand Jul 30 '19 at 21:24
  • 1
    `source.getTileGrid().getResolutions()` See the Zoomify example https://openlayers.org/en/v4.6.5/examples/zoomify.html which sets the view resolutions to match the source. You can also constraint the mousewheel and drag zoom to integer zoom levels to always match those resolutions with `interactions: ol.interaction.defaults({ constrainResolution: true }),` in the map options. – Mike Jul 30 '19 at 22:19

0 Answers0