Skip to main content
Tweeted twitter.com/#!/StackGIS/status/204666614262677504
improved formatting
Source Link
urcm
  • 22.6k
  • 4
  • 58
  • 109

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

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

EPSG:32633

<SRS>EPSG:32633</SRS>
<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"/>
WMS mapvar map; function init(){{var mapoptions ={maxExtent: new OpenLayers.Bounds(-1700000, 3800000, 2300000, 8000000),numZoomLevels:14,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"},{});map.addLayer(wms);if(!map.getCenter()){ map.zoomToMaxExtent();}}
<!DOCTYPE html>
<html>
  <head>
    <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),
      numZoomLevels:14,
      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"}, 
   {} 
); 
map.addLayer(wms); 
if(!map.getCenter()){ map.zoomToMaxExtent(); } } 
</script>
</head>

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

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

EPSG:32633

WMS mapvar map; function init(){{var mapoptions ={maxExtent: new OpenLayers.Bounds(-1700000, 3800000, 2300000, 8000000),numZoomLevels:14,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"},{});map.addLayer(wms);if(!map.getCenter()){ map.zoomToMaxExtent();}}

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

<SRS>EPSG:32633</SRS>
<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"/>
<!DOCTYPE html>
<html>
  <head>
    <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),
      numZoomLevels:14,
      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"}, 
   {} 
); 
map.addLayer(wms); 
if(!map.getCenter()){ map.zoomToMaxExtent(); } } 
</script>
</head>

<body onload='init();'>
    <div id='map' style='width: 1000px; height: 1000px;'>
</div>
</body>
</html>
Source Link
Max
  • 31
  • 1
  • 2

Openlayers + WMS layer. Use scale or resolution + DPI

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:

EPSG:32633

My code:

WMS map var map; function init() { { var mapoptions = { maxExtent: new OpenLayers.Bounds(-1700000, 3800000, 2300000, 8000000), numZoomLevels:14, 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"}, {} ); map.addLayer(wms); if(!map.getCenter()){ map.zoomToMaxExtent(); } }