Question

Generating tile names based on location

  • 21 October 2014
  • 4 replies
  • 4 views

Badge +1
Some time ago I ask a question called Converting MasterMap gz (or TAB) into tiled dwg to which I received some very helpful answers (thanks).  I shelved this for a while and have recently come back to it wanting now to solve the second part of the question which related to how to name the output tiles based on their location.

 

 

I am creating 5km x 5km tiles and want (ideally) to use an Ordnance Survey compatible naming scheme, for example, SH74NW, with four 5km tiles (NE, SE, SW and NW) making up the 10km tile of SH74.

 

 

I'm pretty sure I could do some math and extract a point within each tile and reverse engineer the containing tile reference but surely there is an easier way?  Does FME 'know' what the origin coordinate (bottom left) are of each tile the tiler creates?  If so can these attributes be exposed and used?

 

 

Many thanks in advance.....

4 replies

Userlevel 4
Badge +13
Hi,

 

You could extract the boundingbox of each tile and then extract the bottom left point...

 

Unfortunatly for vector tiles extra computation needs to take place, for rasters the rasterpropertiesextractor will get you the origin point of each raster tile.
Badge +1
I must admit that I'm slightly confused as to the relationship between the original features and the tiles.

 

 

Looking at a (failed) log file of what I have done so far; I have 2,342,500 input features, the tiler then seems to output 2,369,574 features (where I'm assuming the additional features have been created where existing features have been clipped along tile boundaries).  I'm assuming that each feature now also has additional _row and _column attributes created by the tiler.

 

 

So, after being through the tiler do the tiles exist as actual features or are they conceptual in that existing features that have a given _row and _column that make up the 'tile'?

 

 

The log file also contained this summary;

 

Tiler_NUMCOLS               17

 

Tiler_NUMROWS               14

 

Tiler_NUM_TO_CREATE        238

 

Tiler_XINC                5000

 

Tiler_XMIN            250000.0

 

Tiler_XSEED                  0

 

Tiler_YINC                5000

 

Tiler_YMIN            325000.0

 

Tiler_YSEED                  0

 

 

So it looks like FME knows that the blocks of tiles created starts at 250000, 325000 and if this information was accessible within the workflow I could say something like;

 

TileOrigin_x = TILER_XMIN + (5000 * (_column - 1))

 

TileOrigin_y = TILER_YMIN + (5000 * (_row - 1))

 

 

Once I knew the TileOrigin x and y for each feature I could calculate the rest of what I need to generate the desired filename format.
Darren,

 

Simply use a VariableRetriever(Global) for TILER_XMIN and TILER_YMIN !

 

 
Badge +1
Many thanks to ETLS-Itay and Neildan, between your responses I have managed to create a workflow that builds the tile names in the format I require.

Reply