[OpenLayers-Users] Re: Mercator projected Images coordinate problem with layer

kapuch kapusta.marcin at gmail.com
Thu Jul 7 02:56:42 EDT 2011


Thank You very much.

Now I'm using:

var geographic = new OpenLayers.Projection("EPSG:4326");
var mercator = new OpenLayers.Projection("EPSG:900913");
            
var world = new OpenLayers.Bounds(-180, -89, 180, 89).transform(geographic,
mercator);

map = new OpenLayers.Map ("map", { 
  maxExtent: world,
  restrictedExtent: world,
  numZoomLevels:16, 
  maxResolution:156543.0339, 
  units: 'm',
  projection: mercator, 
  displayProjection: geographic
});

And the function to prepare URL is diffrent. I change It to:

getURL: function (bounds) {
  var imageSize = this.getImageSize();
  var newParams = {};
  newParams.xRes=imageSize.w;
  newParams.yRes=imageSize.h;
        
  bounds = this.adjustBounds(bounds);
  var mercator = this.map.getProjectionObject();
  var geographic = this.map.displayProjection;
  bounds = bounds.transform(mercator, geographic);
  newParams.latTopLeft=bounds.top;
  newParams.lonTopLeft=bounds.left;
  newParams.latBottomRight=bounds.bottom;
  newParams.lonBottomRight=bounds.right;
  var requestString = this.getFullRequestString(newParams);
  return requestString;
}

And It works and coordinate system is ok during panning, zooming.
Thanks Again

-----
eDojazd.pl 
Niższe koszty dojazdów dla wszystkich i wszędzie!
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Mercator-projected-Images-coordinate-problem-with-layer-tp6553981p6557272.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list