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 Arnd Wippermann wrote: > > Hi Eoinyp, > > You have no navigation control added to your map. > > map.addControl(new OpenLayers.Control.Navigation()); > > If you want use EPSG:26986, http://spatialreference.org/ref/epsg/26986/ > shows the standard extent for that projection. > > You can't mix layers with different projections in one map. You declare a > projection for your map and the layers will requested for this projection. > OpenLayers can't reproject raster layers. > > In mymap2.html you should choose sphericalMercator (EPSG:900913) for the > projection of the map. As you have choosen for the google layer. See the > OL > examples for the bounds of EPSG:900913 and resolution. > > You try to compound a map with three different projections. I think, the > map > projection is set to sphericalMercator by the google layer. > > Regards, > Arnd > > -----Ursprüngliche Nachricht----- > Von: [email protected] [mailto:[email protected]] Im > Auftrag von eoinyp > Gesendet: Dienstag, 25. August 2009 14:05 > An: [email protected] > Betreff: [OpenLayers-Users] map bounds or projection problem? > > > Hi list, > I am just getting started with openlayers and geoserver. > I have two simple wms layers being served by geoserver: a layer of US > states, and a layer of town boundaries in Massachusetts. Each of the > layers > display fine on their own. Showing the full extent of the mapped area. > When > I put them both together however, only a section of the States layer is > shown, while the full Mass layer is shown. It is not possible to pan and > see > the rest of the States layer. > I am not entirely sure what the problem is, so im not sure how to fix it! > The map with the states and the Mass towns layers here: > http://www.eoinmaca.com/maps/OpenLayers/mymap3.htm > I think it is a problem with the extent of the bounds of the layers > defined. What should it be set to? > currently it is: > > var bounds = new OpenLayers.Bounds( > 19012.0201171875, 768402.5875, > 345695.3353515625, 968859.1625); > > The layers have different EPSGs - is this a problem? > > The problem is compounded when I add in a googleEarth baselayer. It shows > the full extent of the google layer, but when I zoom in I cant pan to the > Mass area. The pan functionality seems to be constrained to a small area. > The map with the google base layer is available here: > http://www.eoinmaca.com/maps/OpenLayers/mymap2.htm > > > If the bounds is the problem, is there a simple way of figuring out what > the > bounds of my map need to be? > > Many thanks, > > Eoinyp > > > -- > View this message in context: > http://n2.nabble.com/map-bounds-or-projection-problem-tp3509317p3509317.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users > > -- View this message in context: http://n2.nabble.com/map-bounds-or-projection-problem-tp3509317p3511181.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
