I am working with both EPSG:4326 and EPSG:4230 in OpenLayers 3 and I am using my WMS service which only supports EPSG:4326 maps. What I need to do is show a map in EPSG:4326 and transform it to EPSG:4230 whenever needed and vice-versa.
Now, I get maps from WMS in EPSG:4326 and define the EPSG:4230 projection with proj4js, then create a view with this newly defined projection. Then I set the map's view. So I expect to see the map in EPSG:4230. Am I doing the right thing by only setting the views projection to EPSG:4230?
My other question is: when I do it this way and perform a zoom in, the map view request maps from my WMS server in EPSG:4230. However my server does not support this projection and, so, I get errors server side and it does not work. What should I do in that situation? Is there any request projection type parameter for zooming?
Here is my code:
EPSG:4230 define;
proj4.defs("EPSG:4230", "+proj=longlat +ellps=intl +towgs84=-87,-98,-121,0,0,0,0 +no_defs");
EPSG:4326 to EPSG:4230
$( "#ed50" ).click(function() {
var extentTransform = ol.proj.transformExtent(extentOriginal, 'EPSG:4326', 'EPSG:4230');
var projection2 = ol.proj.get('EPSG:4230');
projection2.setExtent(extentTransform);
var view2 = new ol.View({
projection: projection2,
center: ol.extent.getCenter(extentTransform)
zoom: 1
});
map.setView(view2);
});
EPSG:4230 to EPSG:4326
$( "#wgs84" ).click(function() {
var projection2 = ol.proj.get('EPSG:4326');
projection2.setExtent(extentOriginal);
var view2 = new ol.View({
projection: projection2,
center: ol.extent.getCenter(extentOriginal),
zoom: 1
});
map.setView(view2);
});
Best Answer
Anyone who wants to learn answer, there are 2 options for my problem;
For further reading, https://groups.google.com/forum/#!topic/ol3-dev/YmBOj623jHo