[OpenLayers-Users] WMS layer overlay on google map

Subha Ramakrishnan subha at gslab.com
Thu Feb 5 01:23:21 EST 2009


Hi,

I got it working. Thanks a lot for the help.
Now I've a problem with the position where the image appears on the map.
The image shows up somewhere near "Dresden" instead of "Stockholm".
I guess i'm missing something. Should be a silly mistake.
Can someone please point where I am going wrong?

This is my map file:
map
  size 725 800
  imagetype png
  imagecolor 225 225 225
  projection
    "init=epsg:900913"
  end
  extent 1610000 6568500 16380000 6594000
  maxsize 4096
  units m
  web
    metadata
      "wms_feature_info_mime_type" "text/html"
      "wms_srs" "epsg:4326 epsg:2805 epsg:24600 epsg:54004 EPSG:900913"
    end
  end
  outputformat
    name "png"
    driver "GD/PNG"
    imagemode "rgba"
    extension "png"
    mimetype "image/png"
    imagemode RGBA
    TRANSPARENT ON
    FORMATOPTION "INTERLACE=OFF"
  end
  outputformat
    name "jpg"
    driver "GD/JPEG"
    extension "jpg"
    formatoption "QUALITY=85"
  end

  layer
  name Land_use_cover_from_SPOT
  type raster
    group world
    dump true
    METADATA
       "wfs_title" "Factbook Metadata"
       "gml_include_items" "all"
       "wms_feature_info_mime_type" "text/html"
    END
 transparency 65
 status on
 data "Land_use_cover_from_SPOT/Land_use_cover_from SPOT.tif"
end
END

OpenLayers code:
var options = {
                controls: [
                  new OpenLayers.Control.Navigation(),
                  new OpenLayers.Control.PanZoomBar({zoomWorldIcon:true}),
                  new OpenLayers.Control.ScaleLine(),
                ],
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                units: "m",
                maxResolution: 156543.0339,
            };
           map = new OpenLayers.Map('map',options);
           map.addControl(new 
OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')}));
           var twms1 = new OpenLayers.Layer.WMS( 
"Land_use_cover_from_SPOT","http://localhost/cgi-bin/mapserv?",
                { map: "Land_use_cover_from_SPOT.map",
                  transparent: 'true', layers:"Land_use_cover_from_SPOT" ,
                  format: 'image/png',
                  reproject:false,
                  units: "m",
                },{singleTile: 'true'});
            map.addLayer(twms1);
           twms1.setVisibility(false);

Thanks a lot.

Subha

Christopher Schmidt wrote:
> On Wed, Feb 04, 2009 at 03:00:28PM +0530, Subha Ramakrishnan wrote:
>   
>> Hi,
>>
>> I want to overlay a WMS layer on google base map (Google Physical).
>> The image that I have is a raster data and am using MapServer to show 
>> the image.
>> The data is in Transverse Mercator projection.
>>     
>
> Reproject it on the server to spherical mercator.
>
>   http://docs.openlayers.org/library/spherical_mercator
>
> -- Chris  
>
>   
>> I'm able to get the image when I hit the mapserver url in the browser, 
>> provided i give the extent in meters for that particular country but 
>> using OL, i get only a blank image.
>> The projection is 4326 in the map file.
>>
>> OL code:
>> var twms1 = new OpenLayers.Layer.WMS( 
>> "Land_use_cover_from_SPOT","http://localhost/cgi-bin/mapserv?",
>>             { map: "Land_use_cover_from_SPOT.map",
>>             units: "m",
>>               transparent: 'true', layers:"Land_use_cover_from_SPOT",
>>               format: 'image/png',
>>             maxExtent: new 
>> OpenLayers.Bounds(1610000,6568500,1638000,6594000),
>>               //maxExtent: new OpenLayers.Bounds(60,0,100,40)
>>               //maxResolution: 156543.0339,
>>               projection:"EPSG:4326",reproject:false
>>              
>>             },{singleTile: 'true'});
>> map.addLayers([twms1]);
>>
>> Does some one know how to project transverse mercator on Google map??
>>
>> Please help.
>>
>> Thanks & regards,
>> Subha
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>     
>
>   




More information about the Users mailing list