[OpenLayers-Users] OpenLayers Question: Google Physical Projections and epsg:26915

Paul Spencer pagameba at gmail.com
Sat Jun 28 10:46:27 EDT 2008


Take a look at the spherical_mercator.html example in the OpenLayers  
examples.  I'm not sure, but I think you should be adding a projection  
and units to your map options

map = new OpenLayers.Map(
   'map',
   {
     maxResolution: 'auto',
     maxExtent: new  
OpenLayers.Bounds(184056.505,4809728.25,767381.245,5478975.75),
     projection: new OpenLayers.Projection("EPSG:900913"),
     units: "m"
   }
);

Note that your mapserver WMS will then need to be set up to serve EPSG: 
900913 correctly too, see the mapserver WMS Server how to for metadata  
relating to this.

The other thing you should confirm is that your maxExtent is defined  
in spherical mercator units and not in the UTM coordinates of your  
data (assuming this is the same example as your postgis question on  
the mapserver list) - it looks okay to me but it is very hard to tell :)

Cheers

Paul


On 27-Jun-08, at 7:23 PM, Matthew Pettis wrote:

> Hi All,
>
> I added the projection from http://spatialreference.org/ref/user/google-projection/mapfile/ 
>  into my mapfile.  I then used the file below.  The weird thing is  
> that I am getting a google maps projection, but instead of for  
> Minnesota (which is where my ol_ms layer gets me, I get some region  
> of Europe between Barcelona, Sp and Marseilles, Fr.  Any further  
> suggestions?
>
> Thanks,
> Matt
>
> = 
> = 
> = 
> ======================================================================
> <html xmlns="http://www.w3.org/1999/xhtml">
>   <head>
>     <title>OpenLayers Example</title>
> <!--    <script src="http://www.openlayers.org/api/OpenLayers.js"></ 
> script> -->
>     <script src="http://localhost/_common//OpenLayers-2.6/OpenLayers.js 
> "></script>
>     <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAytPEybOjkPfSINF9aqMnSRRV_Z48x51l4m6KiJWs2Yue7BruuxS9q420SXqAbRhYk8GzmgwCugf2Fw 
> "
>       type="text/javascript"></script>
>     <script type="text/javascript">
>         var map = null;
>         function init(){
>
>             map = new OpenLayers.Map(
>                 'map',
>                 {
>                       maxResolution: 'auto'
>                     , maxExtent: new  
> OpenLayers.Bounds(184056.505,4809728.25,767381.245,5478975.75)
>                 }
>             );
>
>             var ol_ms = new OpenLayers.Layer.MapServer(
>                 "Mapserver Untiled"
>                 , "http://localhost/cgi-bin/mapserv.exe?map=C:\\ms4w\ 
> \Apache\\htdocs\\ol\\map.map"
>                 , {layers: 'state'}
>                 , {singleTile: true}
>             );
>             map.addLayer(ol_ms);
>
>             var gmap = new OpenLayers.Layer.Google(
>                 "Google Streets"
>               , {sphericalMercator: true}
>             );
>             map.addLayer(gmap);
>
>             map.zoomToMaxExtent();
>             map.addControl(new OpenLayers.Control.LayerSwitcher());
>
>         }
>     </script>
>   </head>
>
>   <body onload="init()">
>     <div id="map" class="smallmap" style="width:400;height:300"></div>
>   </body>
>
> </html>
> = 
> = 
> = 
> ======================================================================
>
> -- 
> It is from the wellspring of our despair and the places that we are  
> broken that we come to repair the world.
> -- Murray Waas _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list