2

I'm trying to rasterize shapefile on QGIS. However, I got blank image whose max and min value are N/A.

Could someone give advice to me?

I took the following two steps.

  1. make field with field calculator via 'open field calculator' icon
    I made int field from a string column as following image enter image description here
  2. rasterize image via 'raster' tab -> 'conversion' -> rasterize
    I set the field made in previous step and configured image size: image size units, width and height, then determined its output extent.
    enter image description here

However I got a blank image and its image has somehow N/A numbers.

enter image description here


P.S.

Here is the output log I got.

QGIS version: 3.10.12-A Coruña
QGIS code revision: 75c848ffb1
Qt version: 5.11.2
GDAL version: 3.1.4
GEOS version: 3.8.1-CAPI-1.13.3
PROJ version: Rel. 6.3.2, May 1st, 2020
Processing algorithm…
Algorithm 'Rasterize (vector to raster)' starting…
Input parameters:
{ 'BURN' : 0, 'DATA_TYPE' : 5, 'EXTENT' : '130.65232439272694,130.82848516072687,32.93750724266676,33.06257376193944 [EPSG:4612]', 'EXTRA' : '', 'FIELD' : 'class', 'HEIGHT' : 100, 'INIT' : None, 'INPUT' : 'C:/Users/noguchi_yoshiyuki/Desktop/L03-b-16_4930-jgd_GML/L03-b-16_4930.shp', 'INVERT' : False, 'NODATA' : 0, 'OPTIONS' : '', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'UNITS' : 0, 'WIDTH' : 100 }

GDAL command:
gdal_rasterize -l L03-b-16_4930 -a class -ts 100.0 100.0 -a_nodata 0.0 -te 130.65232439272694 32.93750724266676 130.82848516072687 33.06257376193944 -ot Float32 -of GTiff C:/Users/XXX/L03-b-16_4930-jgd_GML/L03-b-16_4930.shp C:\Users\XXX\AppData\Local\Temp/processing_5a931e90d0804ebbac791342cdfb5f28/e6a9b2d9826343dcbb88bff6c329a942/OUTPUT.tif
GDAL command output:
ERROR 1: Failed to find field class on layer L03-b-16_4930, skipping.

Execution completed in 0.45 seconds
Results:
{'OUTPUT': 'C:\\Users\\XXX\\AppData\\Local\\Temp/processing_5a931e90d0804ebbac791342cdfb5f28/e6a9b2d9826343dcbb88bff6c329a942/OUTPUT.tif'}

Loading resulting layers
Algorithm 'Rasterize (vector to raster)' finished

P.S. No.2

Here is Type of field I made.

enter image description here

10
  • 1
    Interesting. I see no flaws in your workflow. Will you copy the output of GDAL/OGR console, and the log message? Btw, your QGIS may be older than the latest 3.22 (from the look of Rasterize panel, which lacks Burn value option ("Z")). Could you add QGIS version information, too?
    – Kazuhito
    Commented Dec 29, 2021 at 6:47
  • 1
    The coordinate system units are in degrees. What if you try projecting you data in a crs with units in meters, then try rasterizing again
    – Bera
    Commented Dec 29, 2021 at 9:24
  • Can you share your data for testing - at least a sample?
    – Babel
    Commented Dec 29, 2021 at 11:47
  • Could it be that your class field does not really contain integers (maybe they were not correctly generated)?
    – Babel
    Commented Dec 29, 2021 at 11:54
  • 1
    Looking at an error message ERROR 1: Failed to find field class, I am now in the same opinion with @Babel that somehow class field was not correctly generated. However, QGIS will not allow you to choose class field as burn-in value if its type was string. Um ... I have no idea.
    – Kazuhito
    Commented Dec 31, 2021 at 22:06

1 Answer 1

2

Tested a file from the suggested link https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-L03-b.html

Rasterize function went on and on ... quite a long time, and it finally produced a raster, just a partial one.

enter image description here

Looking at the original data, I realized it was a Multipolygon layer!

enter image description here

Used Multipart to Singleparts tool (in the Processing Toolbox > Vector geometry), and re-run Rasterize on the resultant Single part layer. It went smooth and produced a raster quickly.

enter image description here

You should make a complaint against the data provider (Japanese GSI) for the lack of information.

1
  • Thanks to your help, I ultimately solved my problem! Commented Jan 7, 2022 at 11:56

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.