[Qgis-user] vector point grid to raster grid -- pixel size does not work
Nicolas Cadieux
nicolas.cadieux at archeotec.ca
Wed May 13 09:00:34 PDT 2020
Hi,
You can also correct this 5x5 problem by using gdal grid with Nearest neighbour interpolation. You could use the point data to do this.
I also post a small presentation that can help go from vector to raster with point data. Sometimes, keeping it simple is better.
https://www.slideshare.net/shencoop/qgis-raster-to-point
If you do decide to make a shapefile with the csv, make sure to store the coordinates in a text field. Placing the coordinates in a $x and $y object fields will lead to rounding. Any rounding would corrupt the raster therefore you need to original coordinates for this to work. This may explain your problems also.
I used this method to change the geoids of a thousands of rasters because the program I was using was designed to change the z value for texte files only and not rasters (NRCAN GPS-H).
Nicolas Cadieux
Ça va bien aller!
> Le 13 mai 2020 à 11:25, chris hermansen <clhermansen at gmail.com> a écrit :
>
>
> Maria and list,
>
>> On Tue, May 12, 2020 at 7:00 PM Priv.-Doz. Dr. Maria Shinoto <maria.shinoto at zaw.uni-heidelberg.de> wrote:
>> Hi,
>>
>> Thanks for helping. -- Thanks to you and Chris Hermansen I got a result, but it could be better.
>>
>> For the records, a short explanation:
>>
>> *****
>> Well, I checked the properties, jgd2011 is in Meters, the raster is said to be 5m. In the official Japanese viewer, which creates a beautiful raster image without white pixels, the pixels are exactly 5m*5m.
>>
>> Today I tried the export to .xyz since the shapefile looked ugly, and after realising that the Japanese xyz is indeed yxz, everything looked fine, and I could store it in a Geopackage. But the grid is now 5,276m * 6,146m. But it fits well on top of the basemap. The basemap is of the same special Japanese GML format, but QGIS could read it all without problem. I do not understand why QGIS does not read the point data from the GML fille, but that is an aside, I am amazed by what QGIS actually can do.
>>
>> From the Geopackage I could rasterize. It is as Chris Hermansen said, thanks. Unfortunately, I did not get it done from the shapefiles, they always looked weird or like nothing, even with identical settings. But the geopackages from xyz tiles are fine.
>>
>> For resolution, I chose georeferenced units as Chris suggested, and since the measurement tool got some different length, I put it to 5,276m by 6,146m. A 5m by 5m resolution created a weird layer with horizontally expanding white pixels.
>>
>> It seems that tweaking with the resolution might lead to an even better result, but for the time being, it is OK as it is.
>> *****
>>
>>
> Upon reflection I think the basic problem here is that the point data should be interpolated to create a raster if you want a precise 5x5m resolution.
>
> For this, rather than use the Raster > Rasterize tool, the approach should be:
> open the processing toolbox Processing > Toolbox
> in the toolbox open Interpolation > TIN interpolation
> in the TIN Interpolation screen:
> select the Vector layer
> select the Interpolation attribute
> click the + to add to the vector layer panel
> choose the interpolation method - probably best to use cubic
> click on the ... next to extent and set it to the layer extent
> set the pixel size to 5.0 and 5.0
> click Run
> This way you won't have the odd sizes you mentioned. This may give you a smoother surface in the end as well.
>
>
> --
> Chris Hermansen · clhermansen "at" gmail "dot" com
>
> C'est ma façon de parler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200513/7f5cce38/attachment.html>
More information about the Qgis-user
mailing list