Skip to main content
Solved

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

  • May 31, 2019
  • 3 replies
  • 84 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

jdh
Contributor
Forum|alt.badge.img+37
  • Contributor
  • 2002 replies
  • 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+37
  • Contributor
  • 2002 replies
  • 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

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
  • 1 reply
  • June 3, 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

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