[OpenLayers-Users] Openlayers map WMS stretched by latitude

qacer qacer8 at gmail.com
Tue Jan 14 06:39:48 PST 2014


Hello.

I am working on a small javascript application for displaying map with WMS
layers from 2 servers. The problem is, that image is stretched by latitude,
it is wider, as it should be.

This is is how it is working now: http://postimg.org/image/pxk8lfnnd/

and this is how it should be, and how it Google maps displaying:
http://postimg.org/image/al321lg6l/

This is javascript code:

/var map = new OpenLayers.Map("map");
var ol_wms = new OpenLayers.Layer.WMS(
"NP Podyjí WMS",
   
"http://mapy.nppodyji.cz/cgi-bin/mapserv.exe?map=f:/mapserv/projects/map/nppodyji_wms.map",
{
   layers: "nppodyji_wms,hranice_npt,hranice_np,cyklo_CR",
   transparent: "true",
  format: "image/png"
},
{ isBaseLayer: false, visibility: true } 
);

var ol_cz = new OpenLayers.Layer.WMS(
"Česká republika",
"http://geoportal.gov.cz/ArcGIS/services/CENIA/cenia_arccr/MapServer/WMSServer",
{layers: "0,3,4,6,7,10,12,13,14,15,16,17,19,20,21,22,23,24"}
);

map.addLayers([ol_cz, ol_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();

setTimeout(function() {
var fromProjection = new OpenLayers.Projection("EPSG:102067");   //
Transform from WGS  1984
var toProjection   = new OpenLayers.Projection("EPSG:900913"); // to
Spherical Mercator Projection
 var position       = new OpenLayers.LonLat(15.8186 + (15.9626 - 15.8186) /
2,48.8027 + (48.8866 - 48.8027) / 2 ).transform( fromProjection,
toProjection); 
 map.setCenter(position, 13);    
}, 100);/

I tried many map.projection and map.displayProjection changes, but I'm not
really sure, if it's projection problem. Projection should be EPSG:102067,
in HTML I have also included proj4js.js.

Thanks a lot for any help!




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Openlayers-map-WMS-stretched-by-latitude-tp5097957.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list