I'm looking at either gdal_contour or gdal_polygonize.py to create a vector layer file from a raster file. I can create the vector file using either method, but it's upside down when I plot it using QGIS. Another list indicated this has to do with the world file.

I use gdal_translate and gdalwarp when transforming the orginal raster in lambert conformal to spherical mercator (for use in OpenLayers) and understand that the world file could be created using one of those utilities (probably when using gdalwarp). However, I'm really unsure after that about the next step using either of the raster to vector utilities where the world file comes into play. Do I have to also use ogr2ogr as well? I'd appreciate a detailed list of steps as the GDAL documentation is a bit fuzzy here.

Just to note my current steps are:

  1. Use gdal_translate to first geo reference the original raster in lambert conformal
  2. Use gdalwarp to reproject the resulting raster image to spherical mercator
  3. Use gdal_translate to create a PNG at a reduced size. Becomes an Image Layer in OpenLayers.
  4. Use either raster to vector utility on the raster produced in step 3.

I see where -co for the world file can be included in gdal_translate or gdalwarp. And like I said, I can create the vector file once the original raster has been warped to spherical mercator. Really just unclear here how the world file comes into play for the resulting vector file in step 4 so the image will be rightside up.


1 Answer 1


As Matthew asked and then I commented on, I apparently was confused about the world file creation and in which step to do that in.

Adding -co WORLDFILE=YES in step 3 above created a .wld file for the resulting PNG image. I then used gdal_contour, brought into QGIS, and it worked!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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