[GIS] Create Georeferenced Raster For JPEG file with Mapnik Python

gdalgeoreferencingmapnikpythonraster

I am able to use Mapnik generate_image.py to generate image with a BBOX and projection.

Also, I have added a python script to generate a JGW file. But to completely georeference the generated image. I guess I need to add projection information to it.

I found out it can be done via .prj file. But not sure if it can be generated via Python script. Is there any way to do the same? Is only generating .jgw file the way to completely georeference the image?

Best Answer

The .prj file is used only with a shapefile. When you are working with a raster, you also need a distinct file which contains the projection information but it doesn't have the .prj extension.

It has a .jgw, .pgw, .gfw extension and so on. If you are working with JPG, PNG or GIF, you will always need a distinct file.

It is not true for the GeoTIFF format. In fact, it contains all the information in a single file (.gtiff). Maybe can you try this format.

So yes, the .jgw is the only way to georeference a JPG image.

Related Question