Skip to main content
2 of 3
gdal expects .pgw for a worldfile extension, not .pnw

The tile image is already in EPSG:3857. Why not just create a world file to reference it?

http://en.wikipedia.org/wiki/World_file

For the tile that covers N. America at zoom 1, you'd be looking at the following worldfile contents:

78271.517
0
0
-78271.517
-19998372.6
19998372.6

Where those numbers came from:

  • Line 1: width of an image pixel in world coordinates = 20037508.342789244 meters / 256 pixels.
  • Line 2 and 3: rotation, so n/a.
  • Line 4: height of an image pixel in world coordinates. Same as line 1 but negative, because in image files increasing y corresponds to 'down' while in the coordinate system, increasing y corresponds to 'up'.
  • Line 5: X coordinate in world coordinates of the center of the top-left pixel. This is -20037508.342789244, as reported by the tiles a la carte link, plus 1/2 of a pixel to bring it to the center.
  • Line 6: Ditto, only Y coordinate of the top left.

GDAL ought to pick up your worldfile (.pgw for the png); you'll still have to tell it EPSG:3857 on the command line.

(Note: didn't have time to test this, so it's all off the cuff... but hopefully correct on the first try anyway! ;) (Needed a minor edit on the worldfile extension: s/pnw/pgw/ )

Dan S.
  • 3.6k
  • 18
  • 20