Hi Lars, thanks for that tip.
I had thought along those lines as well, but I used the mapper info scale
function. Now I made the following code snippet, possible to run in the
MapBasic window for a test.

************************
dim wid as integer
dim scale as float
wid=Frontwindow()
Set Paper Units MapperInfo(wid,12)
scale = MapperInfo(wid,1) / WindowInfo(wid,4)
Print "Computed Scale is 1:" + scale
Print "MAPPER_INFO_SCALE is 1:"+MapperInfo(wid,2)
undim wid
undim scale
************************
Screen size is measured and set in system settings. Map is set by 'change
view' to 1 cm = 10 km. And it is still confusing. Because the result is this
(oh why can't you cut from the message window?):

Computed Scale is 1:621286.84
MAPPER_INFO_SCALE is 1:621371.19

1: It should be 1:1 000 000. Why is it not?
2: Why are the two values different?

Regards, Mats.E
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:Email/ [EMAIL PROTECTED]                            ICQ#9517386:
:---------------------------------------------------------------------:
:Mail/ GISKRAFT, Mats Elfstroem, Vaepplingv 21, SE-227 38 LUND, SWEDEN:
:Phones: +46 46 145959, +46 70 595 3935                               :
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


-----Ursprungligt meddelande-----
Fr�n: Lars Nielsen [mailto:[EMAIL PROTECTED]]
Skickat: den 1 oktober 2002 22:35
Till: Mats Elfstr�m
Kopia: MAPINFO-L Mailinglist
�mne: Sv: MI-L Displaying map scale in Windows Title


Hi Mats,

If you're getting confused about handling two units, just set them to be the
same in your MBX.

Set Paper Units MapperInfo(wid,MAPPER_INFO_DISTUNITS)
scale = MapperInfo(wid,MAPPER_INFO_ZOOM) / WindowInfo(wid,WIN_INFO_WIDTH)
Print "Scale is 1:" + scale

Best regards / Med venlig hilsen
Lars V. Nielsen
Odense, Denmark
----- Original Message -----
From: Mats Elfstr�m <[EMAIL PROTECTED]>
To: MapInfo User Listing E-mail <[EMAIL PROTECTED]>
Sent: Tuesday, October 01, 2002 9:47 PM
Subject: MI-L Displaying map scale in Windows Title


>
> Hi All!
>
> I thought it would be a good idea to display the current scale of a mapper
> window in the window title.
> Then I would use the WinChangedHandler to rewrite the title if the user
> zooms in or out.
> But I am unable to figure out the math involved, or more precisely the way
> MI defines scale.
>
> MB help tells me that MapperInfo(window_id,MAPPER_INFO_SCALE) will display
:
> The Map window's current scale, defined in terms of the number of map
> distance units (e.g. Miles) per paper unit (e.g. Inches) displayed in the
> window. This returns a value in MapBasic's current distance units.
>
> I've gotten so far as to get a decimal fraction value written to the
title,
> but I cannot relate this number to the scale I know the map to be.
> I've set (I think) all affected Units right, i e "cm" for paper and "km"
for
> map distance but the problem persists.
> Please, you MB gurus out there, provide a few lines of code to enlighten
me.
>
> Regards, Mats.E
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> :Email/ [EMAIL PROTECTED]                            ICQ#9517386:
> :---------------------------------------------------------------------:
> :Mail/ GISKRAFT, Mats Elfstroem, Vaepplingv 21, SE-227 38 LUND, SWEDEN:
> :Phones: +46 46 145959, +46 70 595 3935                               :
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
>
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> Message number: 3342
>
>


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 3344

Reply via email to