This now sounds more like a OpenLayers question and you should be asking
in that list. My OL file look like this and they work:
var map;
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
var epsg900913 = new OpenLayers.Projection("EPSG:900913");
function init(){
map = new OpenLayers.Map('map', {
maxResolution: 156543.0339/2,
numZoomLevels: 18,
units: 'm',
maxExtent: new OpenLayers.Bounds(-20037508.34,
-20037508.34, 20037508.34, 20037508.34),
sphericalMercator: true,
projection: epsg900913,
displayProjection: epsg4326,
controls:[
new OpenLayers.Control.LayerSwitcher(),
// new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.Permalink('permalink'),
new OpenLayers.Control.MouseToolbar(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Scale(),
new OpenLayers.Control.ScaleLine()
]
});
var wms = new OpenLayers.Layer.WMS(
"Guatemala WMS",
"http://imaptools.com:8080/cgi-bin/mapserv?",
{ map: "/u/data/maps/somemapfile.map",
format: "image/png",
layers: "MapFileName"
},
{
sphericalMercator: true,
transitionEffect: 'resize',
singleTile: true,
ratio: 1.0
});
wms.addOptions({isBaseLayer: true});
wms.setVisibility(false);
...
On 8/24/2011 7:23 PM, jjwang wrote:
After I set the projection of the map as epsg:900913, on client-side,
Openlayers still tells me that the projection of this layer is "EPSG:4326".
map file:
MAP
PROJECTION
"init=epsg:900913"
END
........
........
WEB
TEMPLATE global.html
IMAGEPATH "/ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"wms_title" "My Global Map WMS Server"
"wms_srs" "EPSG:900913"
"ows_enable_request" "*"
END
END
LAYER
PROJECTION
"init=epsg:4326"
END
......
......
END
......
......
END
Js code:
var propertydata_layer = new OpenLayers.Layer.WMS(
'Property Data',
'http://localhost:9999/cgi-bin/mapserv.exe?map=c:/ms4w/Apache/htdocs/global.map&',
{layers: 'nsw', transparent:true},
{opacity: .5}
);
this.map.addLayers([propertydata_layer]);
Result: map.layers[5]
div: HTMLDivElement
events: Class
grid: Array[3]
id: "OpenLayers.Layer.WMS_77"
inRange: true
isBaseLayer: false
map: Class
maxExtent: Class
maxResolution: 0.1
maxScale: 480.6248291015625
minResolution: 0.00000152587890625
minScale: 31498228.8
name: "Property Data"
numLoadingTiles: 0
numZoomLevels: 17
opacity: 0.5
options: Object
origin: Class
params: Object
projection: "EPSG:4326"
resolutions: Array[17]
scales: Array[17]
tileSize: Class
units: "degrees"
url:
"http://localhost:9999/cgi-bin/mapserv.exe?map=c:/ms4w/Apache/htdocs/global.map&"
__proto__: Object
Is this a Mapserver issue or Openlayers?
JJ
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Map-projection-not-right-in-Openlayers-tp6722667p6722667.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users