[OpenLayers-Users] International date line and bounds

Craig Stanton c.stanton at niwa.co.nz
Thu Mar 26 17:47:26 EDT 2009


Hi all,
    I'm trying to display points centered around New Zealand, some of which are on the other side of the -180/180 line. Therefore I'd like to set the bounds of my OpenLayers map to go from 0 to 360 instead of -180 to 180, or better yet, have no bounds at all and let people move the map as they see fit. All the things I've tried so far have the same result, the map won't scroll beyond 180 degrees east. When I leave out the MaxExtent paremter it seems to get stuck at (0,0) and won't allow me to to scroll anywhere, just zoom in and out.


This is my current code, perhaps someone could tell me if and how this is possible.


	displayProjection = new OpenLayers.Projection("EPSG:4326");
	googleProjection = new OpenLayers.Projection("EPSG:900913");

        var bounds = new OpenLayers.Bounds(0, -85, 360, 85);
	bounds.transform(displayProjection, googleProjection);

	
	var options = {
			  projection:"EPSG:900913",
			  displayProjection:displayProjection,
			  units: "m",
			  numZoomLevels: 18,
			  maxResolution: 156543.0339,
			  maxExtent: bounds
			};	


Cheers,
  Craig
NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.



More information about the Users mailing list