Programmer Question
Hello StackOverFlow,
I have a map with OSM and Google Base layers and EPSG:4326 overlays. Now I am also trying to add overlays with other EPSG's to my map. Overlays which had an EPSG:2333 displayed just fine with no problems. Then I tried to add a layer with EPSG:4008 and nothing showed up. I posted on the openLayers forum and was told to look into the proj4js project (many thanks for that btw!). I have tried using it and it seems promising, but it is just not working for me :(
In my body tag I have the scripts
//I did also try proj4js.js, but the docs said use this one?
Then I have these before my map and layer declaration, also in the body tag
Ext.onReady(function() {
Proj4js.defs["EPSG:4008"] = "+proj=longlat +ellps=clrk66 +no_defs";
Proj4js.defs["SR-ORG:6627"] = "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
...
...
//Map properties
var options = {
controls: [new OpenLayers.Control.Navigation()], //Needed to use GeoExt controls such as the zoomslider
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
units: 'm',
allOverlays: false //Do not display all layers on load
}
var map = new OpenLayers.Map(options);
var borders = new OpenLayers.Layer.WMS(
"Borders", "http://localhost:8080/geoserver/wms", {id: 'borders', layers: 'cite:sedac', transparent: true, projection: new OpenLayers.Projection("EPSG:4008")}, {isBaseLayer: false, displayInLayerSwitcher: true, visibility: true}
);
and have also tried this layer config...after reading this post http://getsatisfaction.com/opengeo/topics/reprojecting_in_openlayers
var borders = new OpenLayers.Layer.WMS(
"Borders", "http://localhost:8080/geoserver/wms", {id: 'borders', layers: 'cite:sedac', transparent: true, srsName: 'EPSG:4326'}, {isBaseLayer: false, displayInLayerSwitcher: true, visibility: true}
);
Still nothing shows up :(. Am I doing something wrong? I'm not seeing the error...
Is it even possible to use layers with various projections??? I can't change my map's projection to be 'EPSG:4008' because it will break my other layers, the advice on the docs was to specify the layer's projection, but as my code shows I have tried this with no luck.
I appreciate your time in looking into this matter for me,
elshae
Find the answer here
No comments:
Post a Comment