[gdal-dev] gdal_polygonize losing the projection info?

Tyler Erickson tyler.erickson at mtu.edu
Tue Oct 14 12:46:09 EDT 2008


I have been trying to use gdal_polygonize to convert a TIF to an ESRI
Shapefile, but it seems to be losing the projection information (i.e. no
*.prj file is created). 

The following output illustrates the loss of projection information. 
I'm currently using gdal trunk revision 15512.

Any suggestions on how to keep the projection info?

-------------------------------------------------------

$ gdalinfo testimage.tif

Driver: GTiff/GeoTIFF
Files: testimage.tif
Size is 5233, 1966
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.2572235629972,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-130.538185630190014,39.997456711953717)
Pixel Size = (0.005086568914294,-0.005086568914294)
Metadata:
  AREA_OR_POINT=Point
  TIFFTAG_SOFTWARE=MODIS Reprojection Tool  v4.0 February 2008
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-130.5381856,  39.9974567) (130d32'17.47"W, 39d59'50.84"N)
Lower Left  (-130.5381856,  29.9972622) (130d32'17.47"W, 29d59'50.14"N)
Upper Right (-103.9201705,  39.9974567) (103d55'12.61"W, 39d59'50.84"N)
Lower Right (-103.9201705,  29.9972622) (103d55'12.61"W, 29d59'50.14"N)
Center      (-117.2291781,  34.9973595) (117d13'45.04"W, 34d59'50.49"N)
Band 1 Block=5233x1 Type=Int16, ColorInterp=Gray

$ /usr/local/gdal/trunk/bin/gdal_polygonize.py testimage.tif -f 'ESRI
Shapefile' test.shp

Creating output test.shp of format ESRI Shapefile.
0...10...20...30...40...50...60...70...80...90...100 - done.

$ ogrinfo test.shp test -so

INFO: Open of `test.shp'
      using driver `ESRI Shapefile' successful.
Layer name: test
Geometry: Polygon
Feature Count: 5592
Extent: (-130.538186, 29.997262) - (-103.920171, 39.997457)
Layer SRS WKT:
(unknown)
DN: Real (11.0)


-- 
Tyler A. Erickson, Ph.D.
Research Scientist, Michigan Tech Research Institute, and 
Adjunct Assistant Professor, Dept. of Civil & Environmental Engineering
Michigan Technological University
3600 Green Court, Suite 100
Ann Arbor, MI 48105
W 83.6889°, N 42.3021° (WGS84) 
tyler.erickson at mtu.edu 
(734) 913-6846
www.mtri.org
www.michiganview.org



More information about the gdal-dev mailing list