I have a problem with displaying map with WMS layer in Openlayers. I'm able to display it but the image of the map is not sharp especially at higher zooms.

I have a documentation from the map provider and below is part of description: The data scale set is:

1:20 mil., 1:6 200 000, 1:3 000 000, 1:1mil., 1:500 000, 1:200 000, 1:75 000, 1:25 000, 1:12 500 , 1:6 250

For the best quality of displayed data while zooming is recommended to count with recalculation 96dpi/200dpi (Map DPI = 200), it means 0,48 x default scale set.

I'm not sure if this DPI setting that is wrong in my code. I found out that Openlayers standard DPI is 72 DPI.

Can you suggest anything how can I fix it?

WMS getcapabilities:

<LatLonBoundingBox minx="-8.060897" miny="32.143274" maxx="56.352488" maxy="66.324824"/>
<BoundingBox SRS="EPSG:32633" minx="-1700000" miny="3800000" maxx="2300000" maxy="8000000"/>

My code:

<!DOCTYPE html>
    <title>WMS map</title>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>

<script type='text/javascript'> 

var map; function init() {

   var mapoptions = {
      maxExtent: new OpenLayers.Bounds(-1700000, 3800000, 2300000, 8000000),
      scale: [20000000, 6200000, 3000000, 1000000, 500000, 200000, 75000, 
      25000, 12500, 6250],
      maxResolution: "auto",
      projection: "EPSG:32633",
      displayProjection: new OpenLayers.Projection("EPSG:32633")

    map = new OpenLayers.Map( 'map',mapoptions );

   var wms = new OpenLayers.Layer.WMS( "layer_name" ,'https://wms.dot.com', 
   {layers: 'layer_name',
   format: "image/png"}, 
if(!map.getCenter()){ map.zoomToMaxExtent(); } } 

<body onload='init();'>
    <div id='map' style='width: 1000px; height: 1000px;'>

This article should help you Configuring ZoomLevels in OpenLayers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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