[OpenLayers-Users] map bounds or projection problem?

Arnd Wippermann arnd.wippermann at web.de
Tue Aug 25 17:09:52 EDT 2009


Hi Eoinyp,

if you want to see the whole USA, then your bounds are something like this:
var bounds = new OpenLayers.Bounds(-6906850,-2055250,3160850,3805350);
and 
maxResolution:10000

http://gis.ibbeck.de/ginfo/apps/OL27Client/OL27ClientGis.asp?WMC=./data/WMC/
EPSG_26986.wmc.xml


if you use google layer with sphericalMercator, then you have to set the
options for the map in the right way. You have taken the same as for
EPSG:26986. Your extent describes something in Togo, Benin.

try this:

var options = {
    projection: new OpenLayers.Projection("EPSG:900913"),
    displayProjection: new OpenLayers.Projection("EPSG:4326"),
    units: "m",
    numZoomLevels: 18,
    maxResolution: 156543.0339,
    maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                     20037508, 20037508.34)
};
map = new OpenLayers.Map('map', options);

http://gis.ibbeck.de/ginfo/apps/OL27Client/OL27ClientGis.asp?WMC=./data/WMC/
EPSG_900913_Mass.wmc.xml 

Good luck
Arnd


-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von eoinyp
Gesendet: Dienstag, 25. August 2009 18:27
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] map bounds or projection problem?


Thanks Arnd,
I made some progress, but Im not quite there yet.
Adding in the navigation control made a small difference. It works well when
I have 2 layers (no google)
see: http://www.eoinmaca.com/maps/OpenLayers/twolayers.htm
However the bounds of the area shown is still constrained. There is data
there for all US states so I think it is the line:
var bounds = new OpenLayers.Bounds(
19012.0201171875, 768402.5875,
345695.3353515625, 968859.1625);
that constrains the display of information. I just dont know how to figure
out what the correct bounds should be! 
Again, this problem is compounded with the addition of the third layer
see: http://www.eoinmaca.com/maps/OpenLayers/threelayers.htm
I cannot zoom in on the area where the layers are overlaid on the google
map, It always brings me to north Africa! :(

Thanks for the help on the epsg. When I have only 2 layers I used
EPSG:26986, the local projection, and when I add the google layer, I define
the map projection to be EPSG:900913, google spherical mercator.

Really puzzeled as to why it always zooms in on North africa and doesnt let
me pan to the Northeren USA.
Thanks again,

Eoinyp




More information about the Users mailing list