Page 1 of 1
[resolved] Give a layer an shift / offset via .AQX
Posted: Mon Apr 26, 2021 7:02 pm
by jidanni
I need to shift / offset a layer in my .AQX file.
I want to move it a few meters (or DMS) southeast, as seen:
Can I somehow add a tweak via some
https://www.alpinequest.net/en/help/v2/ ... parameters
in <zoom-levels ...>
maybe in <server><...{$z}/{$y}/{$x} ?
I.e., y=real y but with a false input of real y minus .000123 degrees of latitude etc.? Thanks!
P.S., the map server is owned by enemy troops. Any contact (asking them to fix the map) would
result in world destruction so I am sure there is a way to just fake it via parameter recompilation.
Re: Give a layer an shift / offset via .AQX
Posted: Mon Apr 26, 2021 7:12 pm
by jidanni
Maybe if I tried these two, with just a few meters...
Code: Select all
<projection-offset-x>-450000.0</projection-offset-x><!-- optional, default is 0 -->
<projection-offset-y>-800000.0</projection-offset-y><!-- optional, default is 0 -->
Re: Give a layer an shift / offset via .AQX
Posted: Mon Apr 26, 2021 7:20 pm
by jidanni
In
http://forum.psyberia.net/viewtopic.php?t=999 I found
Code: Select all
<projection-name>mercator</projection-name>
<projection-geoid>sphere</projection-geoid>
<projection-origin-x>0</projection-origin-x>
<projection-origin-y>0</projection-origin-y>
<projection-factor-x>nb_tiles / 360</projection-factor-x>
<projection-factor-y>nb_tiles / 360</projection-factor-y>
<projection-offset-x>nb_tiles / 2</projection-offset-x>
<projection-offset-y>nb_tiles / 2</projection-offset-y>
So maybe as the layer is .../EPSG:3857/... I can do ...?
Re: Give a layer an shift / offset via .AQX
Posted: Mon Apr 26, 2021 7:31 pm
by jidanni
In
viewtopic.php?t=2616#p10113 we see:
Code: Select all
<projection-false-origin-x>-203224.0</projection-false-origin-x>
<projection-false-origin-y>5429184.0</projection-false-origin-y>
Re: Give a layer an shift / offset via .AQX
Posted: Tue Apr 27, 2021 1:57 pm
by Psyberia-Support
Hi Dan,
In fact you can use those tags to shift your map:
Code: Select all
<projection-false-origin-x>10.0</projection-false-origin-x>
<projection-false-origin-y>10.0</projection-false-origin-y>
Those tags must be inside the "<zoom-levels> ... </zoom-levels>" tags, not outside.
The values are expressed in meters, but if you use the default map projection (mercator), depending on where you are on the Earth the values will not exactly be meters.
Re: [resolved] Give a layer an shift / offset via .AQX
Posted: Thu Apr 29, 2021 10:52 am
by jidanni
OK! And I think I figured out exactly what the difference is:
https://en.wikipedia.org/wiki/Longitude ... _longitude
I.e., the false Y stays the same. But the false X,, let's say 10 meters at the equator, will become around 9 meters around the Tropic of Cancer. Therefore if one wants 10 meters at the Tropic of Cancer one has to specify 11 meters. I got it!
And indeed, I found that specifying positive numbers indeed moves the layer in question Northeast and not the map underneath it thankfully.
Okay, as this tag pair is not documented, I guess this discussion will have to be its document for now.
Re: [resolved] Give a layer an shift / offset via .AQX
Posted: Sun May 02, 2021 11:28 pm
by jidanni
OK I made a shell script that runs on Android to adjust the offset dynamically:
Code: Select all
case $1 in
a) #shift AQX
m=$1
shift
set -e
if test $# -ne 2; then echo 1>&2 $0: Usage: $m X Y; exit 86; fi
for i do
case $i in
*[!-0-9]*)
echo 1>&2 $0: $m: $i: [-]digits only.
exit 81
;;
esac
done
: ${aqx=/sdcard/Android/data/net.psyberia.offlinemaps/files/datastore/custom-maps/dan01.aqx}
if ! test -f $aqx; then echo 1>&2 No $aqx.; exit 87; fi
pfo=projection-false-origin
cp $aqx $aqx.bak
sed "
s@<$pfo-x>..*</$pfo-x>@<$pfo-x>$1</$pfo-x>@;
s@<$pfo-y>..*</$pfo-y>@<$pfo-y>$2</$pfo-y>@;
/<name>/s@\[..*,..*\]@[$1,$2]@; #..*: for portability
" $aqx > $aqx.tmp
mv $aqx.tmp $aqx
set $aqx.bak $aqx
ls -og $@
#if which diff > /dev/null; then diff -U0 $@||:; fi
;;
aj) #shift AQX back to jidanni default X, Y
if test $# -ne 1; then echo 1>&2 $0: Usage: $1; exit 86; fi
exec sh $Z a 10 -5
;;
az) #shift AQX back to 0,0
if test $# -ne 1; then echo 1>&2 $0: Usage: $1; exit 86; fi
exec sh $Z a 0 0
;;
esac