jramm <jamessramm <at> gmail.com> writes: > > > I'm running gdal_rasterize, trying to make it create a new tif from polygons, using an attribute field as the burn value. Here is my command: > > gdal_rasterize -tr 5 5 -a SOP -l test -a_nodata 0 test.shp test.tif > > > I end up with an image that is all 0's. The shapefile is correct and can be read by OGR...what am I missing?
Hi, We are not exactly lazy but the easier it is to study and reproduce the issue the more probable it is that someone really does it. Next time try to share a small sample of data as well. Without having access to your data I digitized two polygons, added an integer attribute "SOP" and inserted values "10" and "110". I modified your command gdal_rasterize -tr 5 5 -a SOP -l burntest -a_nodata 0 burntest.jml test.tif I was awaiting that one polygon would be burned with value 10, the other with 110. Quit test with gdalinfo suggests that it did happen: gdalinfo test.tif -stats Driver: GTiff/GeoTIFF Files: test.tif Size is 100, 64 Coordinate System is `' Origin = (487.000000000000000,632.000000000000000) Pixel Size = (5.000000000000000,-5.000000000000000) Image Structure Metadata: INTERLEAVE=BAND Corner Coordinates: Upper Left ( 487.000, 632.000) Lower Left ( 487.000, 312.000) Upper Right ( 987.000, 632.000) Lower Right ( 987.000, 312.000) Center ( 737.000, 472.000) Band 1 Block=100x10 Type=Float64, ColorInterp=Gray Minimum=10.000, Maximum=110.000, Mean=68.598, StdDev=49.255 NoData Value=0 Metadata: STATISTICS_MAXIMUM=110 STATISTICS_MEAN=68.597662771285 STATISTICS_MINIMUM=10 STATISTICS_STDDEV=49.255255505085 Notice that datatype is Float64 which means that data range 10-110 is very narrow when compared to full 64-bit scale. Here is my test data in OpenJUMP JML format which is understood by GDAL 2.0. <?xml version='1.0' encoding='UTF-8'?> <JCSDataFile xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" > <JCSGMLInputTemplate> <CollectionElement>featureCollection</CollectionElement> <FeatureElement>feature</FeatureElement> <GeometryElement>geometry</GeometryElement> <ColumnDefinitions> <column> <name>SOP</name> <type>INTEGER</type> <valueElement elementName="property" attributeName="name" attributeValue="SOP"/> <valueLocation position="body"/> </column> </ColumnDefinitions> </JCSGMLInputTemplate> <featureCollection> <feature> <geometry> <gml:Polygon> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates>487.0,631.0 875.0,632.0 636.0,361.0 487.0,631.0 </gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon> </geometry> <property name="SOP">10</property> </feature> <feature> <geometry> <gml:Polygon> <gml:outerBoundaryIs> <gml:LinearRing> <gml:coordinates>894.0,575.0 668.0,313.0 988.0,355.0 894.0,575.0 </gml:coordinates> </gml:LinearRing> </gml:outerBoundaryIs> </gml:Polygon> </geometry> <property name="SOP">120</property> </feature> </featureCollection> </JCSDataFile> -Jukka Rahkonen- _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev