Hi List,<br><div class="gmail_quote"><br>I'm trying to put 2 baselayers in my OpenLayers web object. One layer is my political map of Minnesota, which has data in epsg:26915. The other object I want to use is a Google Maps street view layer. What I am having trouble doing is making them agree on the projection and having Google Maps use that projection to render it's layer. I thought the code below (at end of email) should work, but I am obviously missing something.<br>
<br>If I use the ol_ms layer with the map object without the gmap layer, it renders fine. If I use the gmap layer by itself, and define map like:<br><br> map = new OpenLayers.Map('map');<br><br>that is, same as the first one but with no configuration information, that too works fine.<br>
<br>However, putting them as base layers on the same map as laid out below doesn't work. When I switch to the google map, I get some gray rectangle and the standard google branding stuff at the bottom, but no real map. I would like it so the same bounds that were being used for the mapserver map were used.<br>
<br>I suspect it is a projection thing that I am not understanding that is in the way. I note that the Bounds object I use for the mapserver map has bounds like:<br><br>new OpenLayers.Bounds(184056.505,4809728.25,767381.245,5478975.75)<br>
<br>which is obviously in meters. But when I dump out the bounds for the working google map by itself, the 4 numbers are in latlon (-180,-90,180,90). I suspect it is trying to read the epsg:26915 bounds, which are in meters, as latlon bounds, and making the display with the map as some orders of magnitude large scale map that has the entire world mapped to a pixel on my screen.<br>
<br>Question: how do I make Google realize that the map is in epsg:26915 and give me its map in commensurate units? I thought that by defining the projection of the map with epsg:26915, that when I added the google layer to the map that it would know to project itself correctly. Do I have to somehow manually coerce these things, and if so, how?<br>
<br>Thanks for your time and help,<br>Matt<br>
<br><br>========================================================================<br><html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>"><br> <head><br>
<title>OpenLayers Example</title><br>
<!-- <script src="<a href="http://www.openlayers.org/api/OpenLayers.js" target="_blank">http://www.openlayers.org/api/OpenLayers.js</a>"></script> --><br> <script src="<a href="http://localhost/_common//OpenLayers-2.6/OpenLayers.js" target="_blank">http://localhost/_common//OpenLayers-2.6/OpenLayers.js</a>"></script><br>
<script src="<a href="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAytPEybOjkPfSINF9aqMnSRRV_Z48x51l4m6KiJWs2Yue7BruuxS9q420SXqAbRhYk8GzmgwCugf2Fw" target="_blank">http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAytPEybOjkPfSINF9aqMnSRRV_Z48x51l4m6KiJWs2Yue7BruuxS9q420SXqAbRhYk8GzmgwCugf2Fw</a>"<br>
type="text/javascript"></script><br> <script type="text/javascript"><br> var map = null;<br> function init(){<br><br> map = new OpenLayers.Map(<br> 'map',<br>
{<br> maxResolution: 'auto'<br> , maxExtent: new OpenLayers.Bounds(184056.505,4809728.25,767381.245,5478975.75)<br> , units: 'm'<br>
, projection: "EPSG:26915"<br> }<br> );<br><br> var ol_ms = new OpenLayers.Layer.MapServer(<br> "Mapserver Untiled"<br> , "<a href="http://localhost/cgi-bin/mapserv.exe?map=C:%5C%5Cms4w%5C%5CApache%5C%5Chtdocs%5C%5Col%5C%5Cmap.map" target="_blank">http://localhost/cgi-bin/mapserv.exe?map=C:\\ms4w\\Apache\\htdocs\\ol\\map.map</a>"<br>
, {layers: 'state'}<br> , {singleTile: true}<br> );<br> map.addLayer(ol_ms);<br><br> var gmap = new OpenLayers.Layer.Google("Google Streets");<br>
map.addLayer(gmap);<br><br> map.zoomToMaxExtent();<br> map.addControl(new OpenLayers.Control.LayerSwitcher());<br><br> }<br> </script><br> </head><br><br> <body onload="init()"><br>
<div id="map" class="smallmap" style="width:400;height:300"></div><br> </body><br><br></html><br>========================================================================<br>
<font color="#888888">
</font></div><br>-- <br>It is from the wellspring of our despair and the places that we are broken that we come to repair the world.<br>-- Murray Waas