[OpenLayers-Users] wrong location when load map on googlemap

Arnd Wippermann arnd.wippermann at web.de
Fri Sep 11 12:33:28 EDT 2009


Hi,

The parameter SRS and BBOX for the WMS layer are set through OpenLayers, so
you don't need to set them. As you say your WMS is displayed in africa, it
is likely the BBOX=-2200000,-712631,3072800,3840000 the reason therefor. It
is the area of north africa. Delete the two parameters. 

By the way: your wms_onlineresource in the mapfile should be
"http://..../mapserv.exe?map=..."

Arnd

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von truongpm
Gesendet: Freitag, 11. September 2009 18:04
An: users at openlayers.org
Betreff: [OpenLayers-Users] wrong location when load map on googlemap


Hi,
I have small app to load wms map and display on top layer of google.
This is my mapfile and html

NAME "World wms test"
STATUS ON
SIZE 400 300
UNITS METERS
SHAPEPATH "../data"
IMAGECOLOR 255 255 255

WEB
  IMAGEPATH "/ms4w/tmp/ms_tmp/"
  IMAGEURL "/ms_tmp/"
  METADATA
    "wms_title"     "WMS Demo Server For World Map"  ##required
    "wms_onlineresource" "http://localhost:82/cgi-bin/mapserv.exe?" 
    "wms_srs"       "EPSG:4326 EPSG:900913"
  END
END

PROJECTION
  "init=epsg:900913"   
END

LAYER
  NAME "SDE_Province50"
  METADATA
    "wms_title"    "SDE_Province50"   ##required
  END
  TYPE POLYGON
  STATUS OFF
  DATA SDE_Province50
  PROJECTION
	"init=epsg:900913" 
  END
  CLASS
    NAME "SDE_Province50"
    STYLE
      COLOR 200 255 0
      OUTLINECOLOR 120 120 120
    END
  END
END
END #Map

js:
function init(){
			
			var options = { 
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
//EPSG:4326
                units: "m",
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(-20037508,
-20037508,20037508, 20037508.34)
                };
            map = new OpenLayers.Map( 'map', options );
			
			
			physical = new OpenLayers.Layer.Google("google", {
                    type: G_PHYSICAL_MAP,
                    'sphericalMercator': true,
					srs: 'EPSG:900913',
                    'maxZoomLevel': 10
                });
			
			
            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
                    "http://localhost:82/cgi-bin/mapserv.exe?", 
					{
						
						MAP:
'E:/ms4w/apps/test/htdocs/vietnam.map',
						SERVICE: 'wms',
						VERSION: '1.1.1',
						layers: 'SDE_Province50',
						FORMAT: 'image/png',
						//SRS: 'EPSG:42304',
						SRS: 'EPSG:900913',
						BBOX:
'-2200000,-712631,3072800,3840000',
						TRANSPARENT: 'true'
					},{
						'opacity': 0.6,
						'isBaseLayer': false
					});
					
            map.addLayers([layer,physical]);

			map.addControl(new
OpenLayers.Control.LayerSwitcher());
            map.zoomToMaxExtent();
        }
My prolbem is wms layer display in wrong location (some when in africa while
i want to dislay it in asian - vietnam) I had change wms request url in js
file: SRS: 900913 or 42304; BBOX: on to diferences number but nothing change
on the map.
Please help me to change the location display wms layer?

Thanks in advance and apologies about my english skills.
--
View this message in context:
http://n2.nabble.com/wrong-location-when-load-map-on-googlemap-tp3626734p362
6734.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list