Background: I have generated a static map (map.png) of a particular city using mapnik and osm data of the highest zoom level. I am able to zoom in and zoom out successfully using my Java program. It is an offline desktop application.
Question: I want to represent a point at a particular latitude and longitude on this map. How do I do it?
I went through the following references:
http://wiki.openstreetmap.org/wiki/Zoom_levels
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Resolution_and_Scale
How to plot a point on a static Google map [png]?
I'm still not able to understand how to plot it on a static map by calculating a specific latitude and longitude at a particular zoom level with the image having a specific pixel width and height.
Best Answer
from what I understand, you have a single ungeoreferenced image, and you want to find the extent.
This can be done in QGIS
QGIS - Using Capture Coordinate
If this is an urban map with details in the corners, you can manually match up the corners using the Capture coordinate plugin.
start with an empty project
Install the OpenLayers plugin (this goes in the Web menu), and use this to show OSM for the region around your city
Install the "Capture coordinate" capture plugin, and bring up the Capture coordinate panel using the Vector > Coordinate Capture. You might want to set the sampling to EPSG:4326 to get traditional latitude, longitude coordinates
For two corner points on your png (diagonally opposite), look at the corner of your png and find its position in OSM, panning and zooming as required.
click on 'start capture', then click on the point corresponding to the corner of your image
once you have two diagonally opposite corners' coordinates, it's now simple maths to interpolate a pixel position to/from lat, lon
QGIS - Using georeferencing
This is a little more advanced, but will give you results if it's not possible to exactly pick out where the corners are (for example, if it's empty ground or in the sea)
There's quite a good step-by-step guide here, although it's a bit out of date.
Now if you open this geotiff (add as a raster layer) you go into properties and you'll see your extent.