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

truongpm truong_pham_minh at yahoo.com
Fri Sep 11 12:04:11 EDT 2009


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-tp3626734p3626734.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list