I want to convert a shapefile (polygons in WGS84) which contains 3 variables (float values) for each municipality of an area. In fact it contains 1035 municipalities. I want to convert it to a raster file and distribute the values of municipalities to a specific grid with LCC projection .
After the suggestions described below in the answers/comments (to my initial question which I have edited) I reprojected the original shapefile with the municipalities to the final desired grid , I made the calculations with the area and then I rasterised the file as following:
ogr2ogr -t_srs "$outproj" emissions_municip_reproj.shp emissions_municip.shp
ogrinfo -dialect SQLite -sql "SELECT Esye_id, CO,NOx,SOx ST_Area(geometry) as AREA FROM emissions_municip_reproj" emissions_municip_reproj.shp
INFO: Open of $Database_outdir/emissions_municip_reproj.shp
# Add field, calculate and rasterize the shapefile
ogrinfo emissions_municip_reproj.shp -sql "ALTER TABLE emissions_gr_Cday_municip_reproj ADD COLUMN AREA float"
ogrinfo emissions_municip_reproj.shp -dialect SQLite -sql "UPDATE emissions_municip_reproj SET AREA =ST_Area(geometry)"
ogrinfo emissions_municip_reproj.shp -dialect SQLite -sql "UPDATE emissions_municip_reproj SET COarea = CO/ST_Area(geometry) * $RESX * $RESY"
gdal_rasterize -a COarea -ot Float32 -tr $RESX $RESY -te $xmin $ymin $xmax $ymax -a_nodata 0 -l emissions_municip_reproj emissions_municip_reproj.shp emissionsCO.tif
The result is almost correct. The problem is that it seems that values have not been distributed to all cells. In the picture below the municipality is shown with red line. It seems that over some part of the municipality there are no grid cells (no data).Any idea for this?