0

I have a project and trying to implement the OS API WMTS, previously we used the OpenSpace approach but now we need to migrate.

In OpenSpace there was a method call GetMap but this does not exist in the OS API v1, however GetTile does but I need to specify the row and column for the tile along with the Zoom level.

The problem is I do not know what tile I need since I am using an extent.

Does anyone know a way of working out how I might be able to achieve this or offer an alternative?

3

1 Answer 1

1

Applied the same logic in first linked provided by Mapperz. It relates to OpenSpace but applied the same logic.

To calculate which tile cell in the XYZ grid you need to call, first find the resoltuion of the layer (shown in the table linked above) and the tile size for that layer (either 250px or 200px). To calculate the frid cell from this take the x coordinate and divide it by the tile size in meters (which is resolution * tile size in pixels) and round it. For the y coorinate you need to subtract this from the most northerly line in the national grid - 1344000 - and then divide it as before and round it.

So to get the tile in an XYZ format for point 400000 400000 and product Miniscale (MS) the following would be needed:

X = 400000 / 20000 Y = (1344000 - 400000) / 20000

So X = 20 and Y = 47.2 (rounded to 47)

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.