[GRASS-user] Apply arbitrary edit to all coordinates in a vector

Dear GRASS list,

I’m working with data in a rotated pole projection. I’m able to convert any (lon,lat) pair from its “real” coordinates to its rotated pole coordinates by piping it through the following proj command:

invproj -f “%f” +proj=ob_tran +o_proj=latlon +o_lon_p=-200 +o_lat_p=18 +lon_0=180 -m 57.295779506

In order to maintain the integrity of the data, I’d like to keep working in its native coordinates. Is there a way to take an arbitrary vector from GRASS and apply an arbitrary transformation to each element? v.edit has a move feature, but this is not what I want.

I think I can access all points and lines and boundaries with “v.out.ascii Z layer=-1 -c format=standard”. But if I go this route I’ll need to parse apart the output, pipe only the coordinates through the invproj command, and then re-assemble. I hope there is an easier way.

Thanks,

-k.

Ken Mankoff wrote

Dear GRASS list,

I'm working with data in a rotated pole projection. I'm able to convert
any
(lon,lat) pair from its "real" coordinates to its rotated pole coordinates
by piping it through the following proj command:

invproj -f "%f" +proj=ob_tran +o_proj=latlon +o_lon_p=-200 +o_lat_p=18
+lon_0=180 -m 57.295779506

In order to maintain the integrity of the data, I'd like to keep working
in
its native coordinates. Is there a way to take an arbitrary vector from
GRASS and apply an arbitrary transformation to each element? v.edit has a
move feature, but this is not what I want.

I think I can access all points and lines and boundaries with "v.out.ascii
Z layer=-1 -c format=standard". But if I go this route I'll need to parse
apart the output, pipe only the coordinates through the invproj command,
and then re-assemble. I hope there is an easier way.

Thanks,

v.transform - Performs an affine transformation (shift, scale and rotate) on
vector map.
https://grass.osgeo.org/grass74/manuals/v.transform.html

not sure it is what you're looking for.

-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Users-f3884509.html

On Tue, Mar 13, 2018 at 12:21 PM, Helmut Kudrnovsky <hellik@web.de> wrote:

Ken Mankoff wrote
> Is there a way to take an arbitrary vector from
> GRASS and apply an arbitrary transformation to each element? v.edit has a
> move feature, but this is not what I want.
>

v.transform - Performs an affine transformation (shift, scale and rotate)
on
vector map.
https://grass.osgeo.org/grass74/manuals/v.transform.html

not sure it is what you're looking for.

Yes that would do it just fine. Unfortunately I'm not sure how to get the
transformation matrix that invproj uses. I'll try to figure this out...

  -k.

On Tue, Mar 13, 2018 at 1:05 PM, Ken Mankoff <mankoff@gmail.com> wrote:

On Tue, Mar 13, 2018 at 12:21 PM, Helmut Kudrnovsky <hellik@web.de> wrote:

Ken Mankoff wrote
> Is there a way to take an arbitrary vector from
> GRASS and apply an arbitrary transformation to each element? v.edit has
a
> move feature, but this is not what I want.
>

v.transform - Performs an affine transformation (shift, scale and rotate)
on
vector map.
https://grass.osgeo.org/grass74/manuals/v.transform.html

not sure it is what you're looking for.

Yes that would do it just fine. Unfortunately I'm not sure how to get the
transformation matrix that invproj uses. I'll try to figure this out...

Actually this does not work because I'm in EPSG:4326 (lon,lat) location and
there are scaling issues. I think I need to access proj directly for all
vertices...

  -k.

One solution is to export, pipe through invproj, and re-import:

v.out.ascii Z layer=-1 -c format=standard output=Zproj --o

rm Zrot
regex=“[-]\d*.\d*\s*\d*.\d*”
while read line; do
if [[ $line =~ $regex ]]; then

echo $line | invproj -f “%f” +proj=ob_tran +o_proj=latlon +o_lon_p=-200 +o_lat_p=18 +lon_0=180 -m 57.295779506 >> Zrot
else
echo $line >> Zrot
fi
done < Zproj

-k.

···

On Tue, Mar 13, 2018 at 3:06 PM, Ken Mankoff <mankoff@gmail.com> wrote:

On Tue, Mar 13, 2018 at 1:05 PM, Ken Mankoff <mankoff@gmail.com> wrote:

Actually this does not work because I’m in EPSG:4326 (lon,lat) location and there are scaling issues. I think I need to access proj directly for all vertices…

-k.

On Tue, Mar 13, 2018 at 12:21 PM, Helmut Kudrnovsky <hellik@web.de> wrote:

Ken Mankoff wrote

Is there a way to take an arbitrary vector from
GRASS and apply an arbitrary transformation to each element? v.edit has a
move feature, but this is not what I want.

v.transform - Performs an affine transformation (shift, scale and rotate) on
vector map.
https://grass.osgeo.org/grass74/manuals/v.transform.html

not sure it is what you’re looking for.

Yes that would do it just fine. Unfortunately I’m not sure how to get the transformation matrix that invproj uses. I’ll try to figure this out…