0

I have a 256x256 tile from OpenStreetMap tile server. Lets say 5/11/18.png

And I have a X,Y pixel from this reference tile (not global) where 0 < x < 256 and 0 < y < 256.

Is there any way to find the EPSG:4326 coordinates from this pixel?

Already try this but can't get the explanation.

Actually every time I ask "Convert x,y" to google I get "x,y" as being the entire tile coordinate from the grid not the pixel from the tile.

EDIT: Just to illustrate here is the image at 5/11/18.png. It is all I have. I have no way to know anything about the resolution or grids...

enter image description here

Magno C
  • 2,140
  • 3
  • 24
  • 63
  • once you know the top left corner it is simple maths of dpiscalenumber of pixels, though the answer is likely to be in EPSG:3857 rather than EPSG:4326 – Ian Turton Oct 11 '22 at 15:50
  • Huh... almost got it. So... need I to know the DPI ? How can I guarantee this? I need to calculate this from many different sources not only OSM. – Magno C Oct 11 '22 at 16:41
  • Should be defined in the tile matrix definition – Ian Turton Oct 11 '22 at 18:26
  • Sorry.. you're making assumptions. What matrix definitions? I have only a URL to a tile that's not mine. – Magno C Oct 11 '22 at 18:54
  • Then assume 96 DPI and hope for the best – Ian Turton Oct 11 '22 at 19:13
  • You'll find all the necessary info here https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames and here https://wiki.openstreetmap.org/wiki/Zoom_levels – TomazicM Oct 11 '22 at 19:20
  • @Ian Turton sorry I'm not a Geographer. I'm a programmer. Hope is not an option here. – Magno C Oct 12 '22 at 00:06
  • @TomazicM thanks. I think I may take the "Tile bounding box" part here ( https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Java ) then divide border difference by 256 to take each pixel and then sum pixel position... I'll start from here and post results. – Magno C Oct 12 '22 at 00:14
  • if you don't know the scale or resolution then there is nothing to do - you just have a picture not data – Ian Turton Oct 12 '22 at 07:29
  • @Ian Turton according to links pointed by TomazicM if I have an image 256x256 and I know the borders coordinates then I can know the coordinate of a given pixel: ( ( lonWest - lonEast ) / 256 ) * x. You may say "this is resolution" but I need to calculate by myself it was not given. – Magno C Oct 13 '22 at 12:52

0 Answers0