QGIS Rasterization – Handling N/A Data in Shapefile Rasterization

qgisrasterization

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

Best Answer

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.

Related Question