Skip to main content
Solved

How to set reference system for {x},{y},{z} PNG raster images


I have a set of PNG images downloaded from a service like:

 

http://tile.openstreetmap.org/{z}/{x}/{y}.png

 

The images are named:

 

09_118_180.PNG

 

09_119_180.PNG

 

etc.

How can I combine these image in FME and project them correctly?

Best answer by jdh

OSM uses a slippy map.

 

 

To go from tile numbers to lat long use the following equations:
n = 2 ^ zoom lon_deg = xtile / n * 360.0 - 180.0 
lat_rad = arctan(sinh(π * (1 - 2 * ytile / n))) 
lat_deg = lat_rad * 180.0 / π

This returns the NW corner of the image. You can use xtile+0.5 and ytile+0.5 to get the center of the tile

View original
Did this help you find an answer to your question?

3 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • May 31, 2019

OSM uses a slippy map.

 

 

To go from tile numbers to lat long use the following equations:
n = 2 ^ zoom lon_deg = xtile / n * 360.0 - 180.0 
lat_rad = arctan(sinh(π * (1 - 2 * ytile / n))) 
lat_deg = lat_rad * 180.0 / π

This returns the NW corner of the image. You can use xtile+0.5 and ytile+0.5 to get the center of the tile


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • May 31, 2019
jdh wrote:

OSM uses a slippy map.

 

 

To go from tile numbers to lat long use the following equations:
n = 2 ^ zoom lon_deg = xtile / n * 360.0 - 180.0 
lat_rad = arctan(sinh(π * (1 - 2 * ytile / n))) 
lat_deg = lat_rad * 180.0 / π

This returns the NW corner of the image. You can use xtile+0.5 and ytile+0.5 to get the center of the tile

Personally I would calculate all four corners and use the RasterGeoreferencer  and then the RasterMosaicker, then use a CoordinateSystemSetter to define the projection as EPSG 3857.


  • Author
  • June 3, 2019
jdh wrote:

OSM uses a slippy map.

 

 

To go from tile numbers to lat long use the following equations:
n = 2 ^ zoom lon_deg = xtile / n * 360.0 - 180.0 
lat_rad = arctan(sinh(π * (1 - 2 * ytile / n))) 
lat_deg = lat_rad * 180.0 / π

This returns the NW corner of the image. You can use xtile+0.5 and ytile+0.5 to get the center of the tile

Works like a charm, thank you!

 

I ended up not using the RasterMosaicker as it opened too many files which would require to use the Mosaicker in two steps. Instead I vectorized each raster individually and combined the results at the end, which probably also is faster for my scenario.

0684Q00000ArMR9QAN.png


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings