hi all,

I am implementing a function for change the SRS but I'm not how to do it.
Then explain how I'm developing but I think it is not appropriate:

First,  with this fuction I'm try to change the SRS, where I manage to make
the new request of the layers with a new EPSG, but the coordinates system
not change.

The line "window.parent.config.objects.mainMap.proj = destProj;" is where I
update the projection map, but I did not make the coordinates passing from
grade and minute to meters automatically, there is a step that it has failed
to perform.

This is the fuction:

function changeView(epsg){

      // epsg = "EPSG:23029";

       window.parent.config.objects.mainMap.setSRS(epsg);
       window.parent.config.objects.mainMap.setParam("srs",epsg);

        var bbox=window.parent.config.objects.mainMap.getBoundingBox();
        var ul = new Array(bbox[0],bbox[3]);
        var lr = new Array(bbox[2],bbox[1]);


        var ptUL=new Proj4js.Point(ul[0],ul[1]);
        var ptLR=new Proj4js.Point(lr[0],lr[1]);

        var proj = window.parent.config.objects.mainMap.proj;

        Proj4js.defs["EPSG:23029"] = "+title=ED50 / UTM zone 29N +proj=utm
+zone=29 +ellps=intl +units=m +no_defs ";

        var destProj = new Proj4js.Proj("EPSG:23029");

        Proj4js.transform(proj, destProj, ptUL);
        Proj4js.transform(proj, destProj, ptLR);



        window.parent.config.objects.mainMap.proj = destProj;
        window.parent.config.objects.mainMap.map.baseLayer.reproject = true;

        window.parent.config.objects.mainMap.map.baseLayer.projection =
"EPSG:23029";
        window.parent.config.objects.mainMap.map.baseLayer.maxExtent = new
OpenLayers.Bounds(ptUL.x, ptLR.y, ptLR.x, ptUL.y);

window.parent.config.objects.mainMap.refresh(window.parent.config.objects.mainMap);


}

The other function can be found at OpenLayers, in Class
"OpenLayers.Layer.WMS", is just preparing the request of the layer so that
it return the image reproject.

Here, I can't save change of projection and coordinate system, and I have to
made the transformation of the BoundingBox degrees to meters to make the
request properly.

getURL:function(bounds) { // AƱadido JJ

    if (config.objects.mainMap.getSRS() == "EPSG:23029"){

        var bbox = config.objects.mainMap.getBoundingBox();
        var ul = new Array(bbox[0],bbox[3]);
        var lr = new Array(bbox[2],bbox[1]);

        var ptUL=new Proj4js.Point(ul[0],ul[1]);
        var ptLR=new Proj4js.Point(lr[0],lr[1]);

        var proj = config.objects.mainMap.proj;

        Proj4js.defs["EPSG:23029"] = "+title=ED50 / UTM zone 29N +proj=utm
+zone=29 +ellps=intl +units=m +no_defs ";

        var destProj = new Proj4js.Proj("EPSG:23029");


        Proj4js.transform(proj, destProj, ptUL);
        Proj4js.transform(proj, destProj, ptLR);

        bounds = new OpenLayers.Bounds(ptUL.x, ptLR.y, ptLR.x, ptUL.y);

    }

    bounds = this.adjustBounds(bounds);

    var imageSize = this.getImageSize();

    //window.frames['iframVImprimirImagen'].document.open();


//window.frames['iframVImprimirImagen'].document.write(this.getFullRequestString({BBOX:this.encodeBBOX
? bounds.toBBOX() :
bounds.toArray(),WIDTH:imageSize.w,HEIGHT:imageSize.h}));

    //window.frames['iframVImprimirImagen'].document.close();

    return this.getFullRequestString({BBOX:this.encodeBBOX ? bounds.toBBOX()
: bounds.toArray(),WIDTH:imageSize.w,HEIGHT:imageSize.h});

}


Please show me how I can do it.
Thank you so much.
Oscar
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
mapbuilder-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-devel

Reply via email to