[OpenLayers-Users] What layer type to use, and how to use it?

Dylan Parry me at dylanparry.com
Mon Feb 1 07:56:08 EST 2010


Hi,

I’m working on a project that has an existing tile server that generates and serves map tiles of the UK based on the British National Grid projection (EPSG:27700). The tiles are based on the following principles:

Tile x=0, y=0 begins at the UK origin, ie. 0,0 at the bottom-left of the map. The server accepts parameters for x, y and resolution. The coordinates for each tile can be calculated by by applying the following calculations:

// Min X Coordinate
x1 = x > 0 ? x * width * resolution : 0;

// Max X Coordinate
x2 = x * width * resolution + (width * resolution);

// Min Y Coorinate
y1 = y > 0 ? y * height * resolution : 0;

// Max Y Coordinate
y2 = y * height * resolution + (height * resolution);

The X and Y values are always greater than or equal to zero.

Now what I’m unsure of is what sort of layer I should use in order to implement a map viewer for this tile server. Any ideas? If so, how would I go about setting it up? My current experiments have all resulted in lots of maps of the sea when they should have been of land!! I know that the tile server is working correctly as it already works in other contexts.

>From what I’ve seen, the XYZ layer numbers tiles from the top-left, which is obviously different to how the tile server I’m using does it, so I’ve ruled that layer type out already. Am I going to have to define something from scratch or does another existing type already fit the bill?

Cheers,

-- 
Dylan Parry



More information about the Users mailing list