I'm not a wizard myself, but I had the same problem a few months ago. In my Openlayers code, I finally put in the code below, and this gave a good result. But perhaps this is of no help.<br>In my Mapfile, I don't have the Google projection (900913), but WGS84 (4326).<br>
<br><br>Best regards,<br><br>Arlen<br><br> function init(){<br> var mapoptions = {<br> projection: new OpenLayers.Projection("EPSG:900913"),<br> displayProjection: new OpenLayers.Projection("EPSG:4326"),<br>
units: "m",<br> maxExtent: new OpenLayers.Bounds(375000,6550000,800000,7100000),<br> tileSize: new OpenLayers.Size(256,256)<br> };<br>(...etc...)<br><br><br>
<br><br><div class="gmail_quote">On Tue, Aug 17, 2010 at 12:04 AM, B. Heath Robinson <span dir="ltr"><<a href="mailto:bheathr@gmail.com">bheathr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<span style="font-family: arial,sans-serif; font-size: 13px; border-collapse: collapse;"><span style="font-family: Helvetica; font-size: medium;">I am having a problem with a WMS layer lining up on top of a Google map. It appears to be about 15mi south of were it needs to be. I am assuming this is because of the fact that spherical mercator ignores the fact the earth is an ellipse. Anyway, I have included my openlayers code and my mapfile as after spending hours search seems to be helpful.</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;">I get the same results using either a shapfile or postgis data each with a different projection.</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;">I am using what I believe to be the best method. If I use "reproject:true" the map does line up, but that causes other known problems and is deprecated. Any help would be greatly appreciated.</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;">--------MAPFILE----------</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;">MAP</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> NAME "Test Map"</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> SIZE 256 256</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> MAXSIZE 40096</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> UNITS feet</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> DEBUG ON</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> DEBUG 5</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> CONFIG "PROJ_LIB" "/usr/local/share/proj"</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> CONFIG "MS_ERRORFILE" "/tmp/mapserver.log"</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> EXTENT -10899765.713460 3586328.494261 -10787636.706166 3654203.662907</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> PROJECTION</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> "init=epsg:900913"</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> IMAGECOLOR 255 255 255</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> IMAGEQUALITY 85</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> IMAGETYPE AGGA</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> OUTPUTFORMAT</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> NAME AGGA</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> DRIVER 'AGG/PNG'</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> MIMETYPE 'image/png'</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> IMAGEMODE RGBA</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> EXTENSION 'png'</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> #FORMATOPTION "QUANTIZE_FORCE=on"</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> #FORMATOPTION "QUANTIZE_COLORS=256"</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> FORMATOPTION "QUANTIZE_NEW=on"</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> LAYER</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> NAME 'cities'</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> TYPE POLYGON</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> DUMP true</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> PROCESSING "CLOSE_CONNECTION=DEFER"</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> CONNECTIONTYPE postgis</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> CONNECTION "dbname='regnumvisum' host=localhost port=5432 user='ecweb' password='tklM3E1m0' sslmode=disable"</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> DATA 'limits FROM "maps_city" USING UNIQUE id USING srid=4326'</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> METADATA</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> 'ows_title' 'parcels'</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> 'wms_srs' 'EPSG:900913 EPSG:3785'</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> 'wms_format' 'image/png'</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> STATUS ON</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> TRANSPARENCY 50</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> PROJECTION</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> "init=epsg:4326"</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> CLASSITEM 'id'</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> CLASS</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> NAME 'default'</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> STYLE</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> SYMBOL 0</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> SIZE 7.0</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> OUTLINECOLOR 255 255 255</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> COLOR [color]</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> ANTIALIAS TRUE</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> LAYER</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> NAME 'cities-shp'</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> TYPE POLYGON</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> DUMP true</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> DATA /Users/bheathr/EdenicConfluence/sample_files/Unified</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> METADATA</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> 'ows_title' 'parcels'</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> 'wms_srs' 'EPSG:900913 EPSG:3785'</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> 'wms_format' 'image/png'</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> STATUS ON</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> TRANSPARENCY 50</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> PROJECTION</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> "init=epsg:2277"</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> CLASSITEM 'OBJECTID'</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> CLASS</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> NAME 'default'</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> STYLE</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> SYMBOL 0</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> SIZE 7.0</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> OUTLINECOLOR 255 255 255</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> COLOR 0 0 0</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> ANTIALIAS TRUE</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> END</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;">END</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;">---------MAPFILE-------------</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;">---------Open Layers---------</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;">function init(){</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> var options = {</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> projection: "EPSG:900913",</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> units: "ft",</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> maxResolution: 156543.0339,</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> maxExtent: new OpenLayers.Bounds(-20037508, -20037508,</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> 20037508, 20037508)</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> };</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> map = new OpenLayers.Map('map', options);</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> var gmap = new OpenLayers.Layer.Google(</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> "Google Streets",</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> {'sphericalMercator': true}</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> );</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> cities = new OpenLayers.Layer.WMS("Bell Cities",</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> "<a href="http://localhost/cgi-bin/mapserv" style="color: rgb(6, 88, 181);" target="_blank">http://localhost/cgi-bin/mapserv</a>",</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> {'map': '/Users/bheathr/EdenicConfluence/regnumvisum/etc/test.map',</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"> </span><span style="font-family: Helvetica; font-size: medium;">'layers': 'cities-shp',</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> 'format':'png'},</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> {'reproject': false,</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> 'opacity': 0.4,</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> 'isBaseLayer': false,</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> 'wrapDateLine': true});</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> // create a vector layer for drawing</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> vector = new OpenLayers.Layer.Vector("Editable Vectors");</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"> map.addLayers([gmap, cities]);</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> map.addControl(new OpenLayers.Control.LayerSwitcher());</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"> </span><span style="font-family: Helvetica; font-size: medium;">centerMap(-97.67112,30.974599,-97.18326,31.18982);</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"> }</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"> </span><span style="font-family: Helvetica; font-size: medium;"> function centerMap(top,left,bottom,right) {</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"> </span><span style="font-family: Helvetica; font-size: medium;"> var proj = new OpenLayers.Projection("EPSG:4326");</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"> </span><span style="font-family: Helvetica; font-size: medium;"> var bounds = new OpenLayers.Bounds(top,left,bottom,right);</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"> </span><span style="font-family: Helvetica; font-size: medium;"> bounds.transform(proj, map.getProjectionObject());</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"> </span><span style="font-family: Helvetica; font-size: medium;"> if (!map.getCenter()) map.zoomToExtent(bounds);</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><span style="white-space: pre-wrap;">        </span></span><span style="font-family: Helvetica; font-size: medium;"> </span><span style="font-family: Helvetica; font-size: medium;"> }</span><span style="font-family: Helvetica; font-size: medium;"><br>
</span><span style="font-family: Helvetica; font-size: medium;"><br></span><span style="font-family: Helvetica; font-size: medium;">---------Open Layers---------</span></span>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br>