Re: [Viking-devel] Calculating UTM coordinate from screen position

2020-04-09 Thread Greg Troxel
Robert Norris  writes:

> The projection is done based on the zone at the center position.
>
> The zone is for the east<->west, whereas the designation letter is the 
> latitude band, being 8 degrees wide, which Viking currently shows as part of 
> the UTM readout.
>
> This use of the from screen position is most likely for the UTM
> position readout of the mouse pointer location, so when viewing on a
> sufficiently zoomed out manner (e.g. around country / US state levels)
> the coverage will cross these bands.

What I meant is that looking at projected coordinates (screen position)
in a scheme like this, one will get values in the same zone as the
center.  These are valid, but are not necessarily the values that would
be obtained by converting to geodetic and back, choosing a zone anew.

Either approach seems legitimate in terms of display.


___
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/


Re: [Viking-devel] Calculating UTM coordinate from screen position

2020-04-09 Thread Robert Norris
> If the screen projection really is UTM, then it is in some zone as
> determined somehow, arguably best by the proper zone for the central
> point.  This lets you convert lat/lon to UTM even if you end up in the
> wrong zone.  Most conversion code lets you force the zone, as opposed to
> finding out the natural zone.

The projection is done based on the zone at the center position.

The zone is for the east<->west, whereas the designation letter is the latitude 
band, being 8 degrees wide, which Viking currently shows as part of the UTM 
readout.

This use of the from screen position is most likely for the UTM position 
readout of the mouse pointer location, so when viewing on a sufficiently zoomed 
out manner (e.g. around country / US state levels) the coverage will cross 
these bands.

--
Be Seeing You - Rob.
If at first you don't succeed,
then skydiving isn't for you.


___
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/


Re: [Viking-devel] Calculating UTM coordinate from screen position

2020-04-08 Thread Greg Troxel
Robert Norris  writes:

> I don't think Viking is used much in UTM as a general purpose viewer -
> since there aren't many if any tile sources in UTM projections. More
> typical is probably using a GeoRef layer to view an existing map image
> (this is the way I use it in order to test it's working); although I
> suppose one could get a image that goes across letter boundaries.
>
> I don't know what the solution is, in working in purely UTM coordinates.
> Also the current screen conversion doesn't take into account the UTM 
> 'anomalies' around Svalbard.
>
> A possible way around it would be convert the center into Lat/Lon,
> workout the input screen position in Lat/Lon and then convert back
> into UTM.

If the screen projection really is UTM, then it is in some zone as
determined somehow, arguably best by the proper zone for the central
point.  This lets you convert lat/lon to UTM even if you end up in the
wrong zone.  Most conversion code lets you force the zone, as opposed to
finding out the natural zone.


___
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/


Re: [Viking-devel] Calculating UTM coordinate from screen position

2020-04-08 Thread Robert Norris
>I would like to ask a question regarding calculation of UTM letter in 
>vikviewport.c/vik_viewport_screen_to_coord() >function.

>However the code doesn't seem to consider a case where the input screen 
>position may be located in another >latitude band. The band letter in 
>resulting utm variable is always set to be the same as band letter of 
>viewport's >center coordinate. I think that the letter of resulting utm should 
>be calculated in some way.

>Please let me know your opinion.

Yes I agree the code is not ideal.

However there are couple factors here:

I don't think Viking is used much in UTM as a general purpose viewer - since 
there aren't many if any tile sources in UTM projections. More typical is 
probably using a GeoRef layer to view an existing map image (this is the way I 
use it in order to test it's working); although I suppose one could get a image 
that goes across letter boundaries.

I don't know what the solution is, in working in purely UTM coordinates.
Also the current screen conversion doesn't take into account the UTM 
'anomalies' around Svalbard.

A possible way around it would be convert the center into Lat/Lon, workout the 
input screen position in Lat/Lon and then convert back into UTM.



___
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/


[Viking-devel] Calculating UTM coordinate from screen position

2020-04-06 Thread Kamil Ignacak
Hello,

I would like to ask a question regarding calculation of UTM letter in
vikviewport.c/vik_viewport_screen_to_coord() function.

The following code is recognizing a possibility that input screen position
passed as function's argument may be located in neighbouring UTM zone,
therefore a zone_delta is calculated and the zone itself is adjusted
(together in easting in that zone).

However the code doesn't seem to consider a case where the input screen
position may be located in another latitude band. The band letter in
resulting utm variable is always set to be the same as band letter of
viewport's center coordinate. I think that the letter of resulting utm
should be calculated in some way.

utm->zone = vvp->center.utm_zone;
utm->letter = vvp->center.utm_letter;
utm->easting = ( ( x - ( vvp->width_2) ) * vvp->xmpp ) +
vvp->center.east_west;
zone_delta = floor( (utm->easting - EASTING_OFFSET ) /
vvp->utm_zone_width + 0.5 );
utm->zone += zone_delta;
utm->easting -= zone_delta * vvp->utm_zone_width;
utm->northing = ( ( ( vvp->height_2) - y ) * vvp->ympp ) +
vvp->center.north_south;

Please let me know your opinion.

Best regards,
Kamil
___
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/