[gdal-dev] Can't get gdal_rasterize to work... with anything.

Ari Jolma ari.jolma at gmail.com
Sat Dec 13 15:33:40 PST 2014


Karen,

What is the field with the elevations? I tried with HAEDDYPIME:

  gdal_grid -of GTiff -l is50v_haedarpunktar_24122013 -outsize 1000 1000 
-zfield HAEDDYPIME is50v_haedarpunktar_24122013.shp x.tiff
Grid data type is "Float64"
Grid size = (1000 1000).
Corner coordinates = (248491.242441 674738.882768)-(757263.099390 
311759.059646).
Grid cell size = (508.263593 362.617206).
Source point count = 10298.
Algorithm name: "invdist".
Options are 
"power=2.000000:smoothing=0.000000:radius1=0.000000:radius2=0.000000:angle=0.000000:max_points=0:min_points=0:nodata=0.000000"

0...10...20...30...40...50...60...70...80...90...100 - done.

The result is not very good.

I suggest you install for example QGIS for looking at the result.

Best,

Ari

13.12.2014, 19:32, Karen Pease kirjoitti:
> The problem exists when I output straight to a PNM as well, not just
> with geotiff.
>
> Can you give me an example gdal_grid command which actually works to
> create a heightmap image that your average program can read? Because I'm
> getting nowhere. :( For example, as a test:
>
> gdal_grid -ot Byte -of PNM -l is50v_haedarpunktar_24122013 -outsize 800
> 500 is50v_haedarpunktar_24122013.shp y.pnm
>
> y.pnm comes up as black. od shows that y.pnm is truly blank:
>
> 0000000 032520 034012 030060 032440 030060 031012 032465 000012
> 0000020 000000 000000 000000 000000 000000 000000 000000 000000
> *
> 1415200 000000 000000 000000 000000 000000 000000 000000 000000
> 1415217
>
> 	- kv, Karen
>
>
>
> On lau, 2014-12-13 at 19:09 +0000, Ari Jolma wrote:
>> 13.12.2014, 18:07, Karen Pease kirjoitti:
>>> Okay, so, I think this may be getting me a bit closer to a solution.
>>>
>>> The output image of your command still wasn't viewable to me, either in
>>> gimp or gwenview. However, when I used ImageMagick to convert it to a
>>> PNG or other format, for the first time I saw some detail, so I guess
>>> it's a tif format that the former two can't read. I tried this approach
>>> on the actual dataset I want to use - IS50V_HAEDARGOGN_24122013_ISN2004.
>>> And indeed, the two stage process worked - to get height lines. But what
>>> I actually want is a 3d height map image, where dark colors are low and
>>> bright colors are high and so forth. So I switched from -burn 1 to the
>>> -3d flag. Now it started outputting 64 bit float files, however; convert
>>> couldn't handle them, nor tifftopnm. So I went back to specifying -ot
>>> Byte or -ot UInt16 so I can use convert. However, the images just come
>>> out all black. This is the same result I get if output directly to pnm
>>> with -of PNM.
>> Karen,
>>
>> GeoTIFFs are usually only for GIS programs, not for general image viewers.
>>
>> I downloaded the elevation data (~500 MB) and to me it looks like it is
>> elevation points and lines. To make a DEM (raster where cell values are
>> elevations) you would need to use a tool like gdal_grid with the point file.
>>
>> Best,
>>
>> Ari
>>
>>> 	- kv, Karen
>>>
>>>
>>>
>>> On lau, 2014-12-13 at 09:18 +0000, Ari Jolma wrote:
>>>> Karen,
>>>>
>>>> For example this command on my computer
>>>>
>>>> gdal_rasterize -burn 1 -l is50v_mannvirki_flakar_24122013 -of GTiff -ts
>>>> 1000 1000 is50v_mannvirki_flakar_24122013.shp x.tiff
>>>>
>>>> produces a 1000 x 1000 geotiff which is mostly zeros except ones where
>>>> the polygons are.
>>>>
>>>> Can you tell us what command did you use?
>>>>
>>>> Ari
>>>>
>>>> ps: the website was a bit difficult to use for non-icelanders.
>>>>
>>>> 13.12.2014, 06:18, Karen Pease kirjoitti:
>>>>> Hi all,
>>>>>
>>>>> I'm running Fedora 21 with a fresh built gdal-1.9.2. Try as I might, I
>>>>> can't get gdal_rasterize to output anything other than purely
>>>>> transparent images, purely white images, or purely black images.
>>>>>
>>>>> I want to use it on this dataset - "Elevation data. GDB og SHP.
>>>>> ISN2004":
>>>>>
>>>>> http://atlas.lmi.is/LmiData/index.php?id=1079838344912
>>>>>
>>>>> I've spent maybe 8 hours on this, including trying all sorts of
>>>>> different commandlines. After finding that I couldn't get that to work,
>>>>> I found some sample tutorials that includes a shp file and some command
>>>>> lines to use it with gdal_rasterize:
>>>>>
>>>>> http://disc.sci.gsfc.nasa.gov/dataholdings/?q=recipes/How-to-Obtain-a-Shapefile-based-Data-Subset-with-GrADS
>>>>> http://www.openforis.org/OFwiki/index.php/Special:WhatLinksHere/Example_data_set
>>>>>
>>>>> None of these work for me either (using it exactly as they say to), so I
>>>>> don't think it's my shp files that's the problem; I think it's
>>>>> gdal_rasterize or something it depends on. I know the problem isn't an
>>>>> image viewer problem either - I've tried multiple viewers, and I've
>>>>> tried saving the files to PNM to allow for manual inspection - they all
>>>>> contain only the same data value repeated over and over, no variation,
>>>>> just pure one color.
>>>>>
>>>>> What should I do? I really need to make a heightmap out of this
>>>>> landscape data for inclusion into a 3d model...
>>>>>
>>>>>     - kv, Karen
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> gdal-dev mailing list
>>>>> gdal-dev at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>> _______________________________________________
>>>> gdal-dev mailing list
>>>> gdal-dev at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



More information about the gdal-dev mailing list