TransWikia.com

WMTS Trying to get list of OS tiles based on extent using OS API

Geographic Information Systems Asked on September 4, 2021

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?

One Answer

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.

Answered by spj_uk on September 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP