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?

  • 1
    Image with .jgw is only half georeferenced because world file does not have any information about the projection. Prj file can be used for telling the projection and the content of .prj file is always the same for one projection, for example EPSG:32630 (UTM zone 30N) spatialreference.org/ref/epsg/32630/prj All that your script should do is to copy it by using the name of the image file as base name. However, applications may not read prj file for raster images and your users may still need to set the projection manually. Better still deliver the info than not to deliver. – user30184 Sep 8 '14 at 13:19
  • Thanks @user30184 seems to be a perfect explanation about the completeness of my data. – Aditya Sep 9 '14 at 4:54

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.

| improve this answer | |
  • 1
    Sometimes .prj files are used together with raster world files and Wikipedia is right with it en.wikipedia.org/wiki/World_file. For example GeoServer needs a .prj file when raster image is published as "world image" even it seems that documentation does not mention it docs.geoserver.org/stable/en/user/data/raster/…. Other systems exists too, for example when GDAL writes out a jpeg image it stores georeferencing with projection info into additional .jpg.aux.xml file. GDAL itself can also read this info. – user30184 Sep 8 '14 at 14:57
  • Thank you both. Combined results of your inputs gave me the right info about what needs to be accomplished. – Aditya Sep 9 '14 at 4:56

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.