[OpenLayers-Users] Using layer with different crs
gabriel
gpetricek at gmail.com
Fri Mar 22 02:10:27 PDT 2013
Hi List,
I was reading may posts about that problematic. But i cant figure it out. My
problem is simple. I have OSM layer (EPSG:900913) and many other layers in
EPSG:102067. I put to my code proj4js library. I can transform bbox from
102067 to 900913 with a little correction
Proj4js.defs["EPSG:900913"] = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";
Proj4js.defs["EPSG:102067"] = "+title=Krovak +proj=krovak +lat_0=49.5
+lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0
+ellps=bessel +pm=greenwich +units=m +no_defs
+towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56";
Normally are bounds in 102067 defined
new ol.bounds(-591311.3125083154, -1334769.2498741073, -165436.87499168637,
-1132697.3751259022); Entire Slovak Republic
but if i want to transform it, i need to delete "-" sign.
Then is the transformation correct.
bbox.transform(new OpenLayers.Projection('EPSG:102067'), new
OpenLayers.Projection('EPSG:900913'));
But how can i transform WMS layer? Im using geoserver and in documantation
is written, that geoserver support by default all CRS for all published
layers.
Here is the rest of my code:
map = new OpenLayers.Map({
maxExtent:bbox,
div: "map",
projection: new o.Projection("EPSG:900913")
// displayProjection:new o.Projection("EPSG:102067")
});
var osm = new OpenLayers.Layer.OSM();
var kuz = new o.Layer.WMS("kuz", "http://<URL>/geoserver/wms",
{layers:"<layer>"}, {singleTile:true});
map.addLayers([osm, kuz]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new o.Control.MousePosition());
map.zoomToExtent(bbox);
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Using-layer-with-different-crs-tp5042296.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list