[GRASS-dev] how to reproject a raster map with absolute numbers without losing data

Markus Metz markus.metz.giswork at gmail.com
Wed Nov 30 23:49:46 PST 2016


On Wed, Nov 30, 2016 at 7:35 PM, Moritz Lennert <
mlennert at club.worldonline.be> wrote:
>
>
>
> Le 29 novembre 2016 22:33:39 GMT+01:00, Markus Metz <
markus.metz.giswork at gmail.com> a écrit :
> > For
> >reprojection, something like r.in.xyz could work:
>
> I'm currently going through this process and it raises a series of issues:
>
>
> >
> >1. convert raster cells to vector points with raster cell value as
> >vector z
> >value.
>
> I use r.to.vect for this. The -b flag allows +/- fast conversion, but it
takes into account all cells. It would be great to have a flag telling it
to only convert non-null cells. Or at least a hint to set a mask, which
seems to have the desired effect.

r.to.vect converts only non-null cells, no mask needed, at least for me in
trunk.
>
>
> >2. reproject these vector points to the target location
>
> I locally modified v.proj to add a 'Don't build topology' flag.
>
> Is there any indication against this ?

No.
>
> >3. export the vector points with v.out.ascii format=point
> >4. import the exported points with r.in.xyz method=sum
>
> This works nicely.
>
> Thanks ! If I find the time I will wrap this into a r.proj.aggregate (?)
script...
>
>
>
> >
> >The method options of r.in.xyz could be added to r.proj for spatial
> >aggregation, but that would mean that most of the code of r.in.xyz
> >would
> >need to be copied to r.proj, then adapted. That would be an interesting
> >enhancement, also considering that gdalwarp offers as resampling
> >methods
> >near, bilinear, cubic, cubicspline, lanczos, average, mode, max, min,
> >med,
> >Q1, Q3.
>
> But it doesn't offer sum....

True, but it offers statistical aggregates. And for average, you need to
have the sum internally anyway, then divide by the cell count (number of
source cells falling into the current target cell), at least this is how I
imagine how average would be calculated.

Markus M
>
> Moritz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20161201/90832ace/attachment-0001.html>


More information about the grass-dev mailing list