[OpenLayers-Dev] Custom Projections

fitz5487 fitz5487 at hotmail.com
Mon Sep 14 09:26:56 EDT 2009


Hi,

I my map uses a Zoomify layer as the baselayer (from a patch), which uses a
coordinate system of 0 to whatever for both x and y.

I am working with data from a chunk of the British Grid (for arguements
sake, just the square: TF).

All my data is in the coordinate system for this grid, and I wish to project
it onto my map, and I think I need to set something similar to 'bounds' for
the KML layer I am using. When i used a test .kml file with coordinates
within the bounds of the Zoomify layer, it drew the correct points, so I
need to tell it somehow that that layer uses a different coordinate system.

I have experimented with using transform projections etc (thinking that this
might be an answer to the problem), but I am unsure how to create a custom
project. I have worked out a formula for transforming the points, but
obviously I need to put this into the system some how.


The relevent code is as follows:

Thanks in Advance.

Lee



var zoomify_width = 81919;
         var zoomify_height = 65535;  
         var zoomify_url = "mapServer/";

         var map, zoomify; 
         
            
         function init(){  
            /* First we initialize the zoomify pyramid (to get number of
tiers) */
             var zoomify = new OpenLayers.Layer.Zoomify("Zoomify",
zoomify_url, 
                 new OpenLayers.Size( zoomify_width, zoomify_height ) );  
   
            /* Map with raster coordinates (pixels) from Zoomify image */  
             var options = {  
                 controls: [],  
                   maxExtent: new OpenLayers.Bounds(0, 0, zoomify_width,
zoomify_height),
                 maxResolution: Math.pow(2, zoomify.numberOfTiers-1 ),  
                 numZoomLevels: zoomify.numberOfTiers, 
                 units: 'pixels'  
             };  
   
             map = new OpenLayers.Map("map", options);
             map.addLayer(zoomify);

             
             //Harborough
             var halpuLayer = new OpenLayers.Layer.GML("halpu",
"kml/south/halpu.kml",
            {   format: OpenLayers.Format.KML,
                formatOptions: {
                    extractStyles: true,
                    extractAttributes: true,
                    maxDepth: 2
                }
            });
             map.addLayer(halpuLayer);
-- 
View this message in context: http://n2.nabble.com/Custom-Projections-tp3642262p3642262.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.



More information about the Dev mailing list