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.


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)

  • start with empty project
  • use OpenLayers plugin to display OSM as before
  • install the Georeferencer plugin
  • start it up with Raster > Georeferencer
  • load in your png raster (first icon)
  • find some landmark on your png as close as possible to one corner- a building, for example, or a road junction
  • click on add point, and in the dialog check 'from map canvas'. If you have a mouse wheel you can pan with that. Click on the corresponding place in the OSM map.
  • repeat for the other 3 corners
  • see the GCP table? Those are your coordinates ('ground control points')
  • click on Transformation settings, and set up where you want to save the raster. You might want to change the crs to EPSG:4326 if you want lat,lon.
  • click on the Run icon (green arrow)
  • you'll now have a georeferenced tiff.

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.

  • I appreciate your response. But suppose I need to find out lat/long at a zoom level without using an external application, how do I do it? I have with me : static image.png, known zoom level, bounding box, image width and height at the highest zoom level. – suhas bhairav Aug 4 '15 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.