Scale and Zoom

閲覧: 681 回
最初の未読メッセージにスキップ

MrChimp

未読、
2009/10/06 6:07:262009/10/06
To: MapInfo-L
I am trying to store the position and scale of a map so that I can
move/zoom somewhere else and then go back to that position.

I think it's going to a mixture of the MapperInfo() function to get
the values to save and then Set Map to apply the values using Scale
rather than Zoom so that even if you resize the window any layout
windows based on that map window will retain the same size map.

I've managed to get the map to re-center correctly but the values for
the scale that MapperInfo() returns seem kind of arbitrary. I can't
see how they relate to the values shown in MapInfo.

As always any help is much appreciated!

Gamiz Ribelles, Sergi (Regsa)

未読、
2009/10/06 6:11:272009/10/06
To: mapi...@googlegroups.com
Use "Named Viwes" built-in tool.


Sergi Gàmiz Ribelles (627481954)
REGS DE CATALUNYA S.A. ( www.regsa.cat <http://www.regsa.cat> )
Unitat de Promoció de Regadius i Concentració Parcel·lària
c/General Brito, 6, 5è
25007 Lleida
tel. 973222838 fax 973222627
sga...@regsa.cat <mailto:sga...@regsa.cat>


-----Mensaje original-----
De: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] En nombre de MrChimp
Enviado el: martes, 06 de octubre de 2009 12:07
Para: MapInfo-L
Asunto: [MI-L] Scale and Zoom

MrChimp

未読、
2009/10/06 6:21:162009/10/06
To: MapInfo-L
Oh...





...thanks!


On Oct 6, 11:11 am, "Gamiz Ribelles, Sergi \(Regsa\)"
<sga...@regsa.cat> wrote:
> Use "Named Viwes" built-in tool.
>
> Sergi Gàmiz Ribelles (627481954)
> REGS DE CATALUNYA S.A. (www.regsa.cat<http://www.regsa.cat> )

Bill Thoen

未読、
2009/10/06 7:53:022009/10/06
To: mapi...@googlegroups.com
MrChimp wrote:
> Oh...

>
> On Oct 6, 11:11 am, "Gamiz Ribelles, Sergi \(Regsa\)"
> <sga...@regsa.cat> wrote:
>
>> Use "Named Viwes" built-in tool.
>>
>> -----Mensaje original-----

>> I am trying to store the position and scale of a map so that I can move/zoom somewhere else and then go back to that position.
>>
>> I think it's going to a mixture of the MapperInfo() function to get the values to save and then Set Map to apply the values using Scale rather than Zoom so that even if you resize the window any layout windows based on that map window will retain the same size map.
>>
>> I've managed to get the map to re-center correctly but the values for the scale that MapperInfo() returns seem kind of arbitrary. I can't see how they relate to the values shown in MapInfo.
>>
No, you were on the right track. NamedViews is built-in, and therefore
handy, but it's got the problem you mentioned--it uses 'zoom' rather
than 'scale.' And 'scale' isn't arbitrary, it's just that it's not
dimensionless. It depends on your map's world and window's paper units.

For example, I've got a map window open here and when I enter into the
MapBasic window: "Print MapperInfo( FrontWindow(), 1)"
(MAPPER_INFO_ZOOM), I get 371.6 (miles). When I enter: "Print
MapperInfo( FrontWindow(), 2)" (MAPPER_INFO_SCALE), I get 70.2305.
Finally, when I enter: "Print WindowIInfo( FrontWindow(), 4)"
(WIN_INFO_WIDTH), I get 5.29167 (inches). So, divide the zoom (distance
of miles) by the window width (distance of inches) and you get 371.6 /
5.292 = 70.224. The slop is probably due to rounding, but I haven't
checked that.

It's a weird way to calculate map scale (which IMHO should be the
dimensionless ratio of map distance to world distance), but there seems
to be a human mental problem about scale. It's like the phenomenon of
our understanding the concept of up vs down before we get the one about
left vs right. The scale parameter was also botched the first time
around in UMN MapServer and that's been a point of confusion ever since,
and if you ask me, too many people who work with maps still don't know
the difference between small scale and large scale. I've worked with
maps for years and I still have to mentally check myself before I say
"small / large scale." I wonder what Freud would think about that?

- Bill Thoen


Eric Blasenheim

未読、
2009/10/06 8:47:132009/10/06
To: MapInfo-L
I am pretty sure that the window width and height are exactly that;
window size. The map area within the window is slightly smaller given
the window style of the edge. So the slight correction is probably due
to the fact that the map is slightly smaller in image size than
WindowInfo() reports.

Eric Blasenheim
PBBI (MapInfo)

MrChimp

未読、
2009/10/06 11:58:052009/10/06
To: MapInfo-L
When i was reading about the Pan command (part of Set Map) it
mentioned something about moving multiples of 8 pixels so maybe it's
something to do with that?

The Named Views tools is ok, but I'd rather store the views in a table
that's attached to the work space, that way my colleague can view them
as well and vice versa.

Thanks for the explanation, Bill. I'll look at it in more detail
tomorrow.

Cinda Graubard

未読、
2009/10/06 12:25:332009/10/06
To: mapi...@googlegroups.com
Years ago we wrote a MBX called "set view" to do just this. It
captures and saves the view (window size, center and scale) and
button click returns to the view of choice.

Contact us if you are interested in a copy of it.

Cinda Graubard
GeoMax

MrChimp

未読、
2009/10/08 7:41:392009/10/08
To: MapInfo-L
Bill - I'm still not quite sure how to get it working.
You can use the Set Map statement to set the scale to e.g. 1:4000. but
unless I'm missing something there's no way get the 4000 figure.
Am I missing something?

I'm so close! I've got it working but it's currently using the Zoom
statement which close but never gives quite the right values (even if
you don't resize the windows etc...I'm not sure where the inaccuracy
comes from...the rounding maybe?)

Any ideas anyone?

Cinda - Any chance of getting a copy of that source code?

Cheers!

Driver, Greg 9434

未読、
2009/10/08 7:56:022009/10/08
To: mapi...@googlegroups.com
If you use MapperInfo(winID, MAPPER_INFO_SCALE) to return the scale, you need to use Set Distance Units to match the paper units you want to work in so the value returned is in a ratio. So, if you're working in cms then Set Distance Units "cm" will return a scale of 1 cm : scale value. If you don't set the distance units then it uses the MapBasic default, which is miles.

HTH

Greg Driver

System Administrator
Applications Support
ICT
Surrey Police
NOT PROTECTIVELY MARKED
Information about this E-mail
This email and any files or attachments with it are intended solely for the use of the individual(s) or organisation(s) to whom it is addressed.
It may contain information that is confidential or subject to legal and/or professional privilege.
If you have received this email in error please notify the sender and delete it including any files or attachments from your e-mail account or computer.
Any opinions expressed in this email are those of the individual and not necessarily those of Surrey Police.
Surrey Police monitor incoming and outgoing e-mail.

MrChimp

未読、
2009/10/08 10:46:322009/10/08
To: MapInfo-L
I'm just getting even more confused now! Time to recap...

_UNITS_

Using the SessionInfo() function you can get the current distance
units, area units and paper units.

You can set these using "Set Distance Units", "Set Area Units" and
"Set Paper Units" respectivey.

These also appear to be seperate to the "paper and layout units",
"distance units" and "area units" set in the options > preferences >
system preferences menu.

As well as these there is also the MAPPER_INFO_XYUNITS which seems to
be meters (MAPPER_INFO_XYUNITS returns "m"; everything in the menus is/
has always been set to degrees/longitude/latitude).

_MEASUREMENTS_

MAPPER_INFO_ZOOM returns the distance displayed east-west in the map
window in the current DIST_UNITS unit type.

MAPPER_INFO_SCALE returns zoom divided by width although how a ratio
represented as a single value based on two seperate values of varying
units makes any sense is point I have yet to get my head around.

WIN_INFO_WIDTH returns the width of the map window in paper units

_AND SO:_

The Scale clause of the Set Map function takes four arguments - two
values and two unit types. I thought this would work...

Set Distance units "cm"
Set Paper Units "cm"
Set Map
Scale map_zoom Units dist_units For map_scale Units dist_units

...but it doesn't.

Arg! I think my brains stuck in an infinite loop on this one!



On 8 Oct, 12:56, "Driver, Greg 9434" <9...@surrey.pnn.police.uk>
wrote:

MrChimp

未読、
2009/10/28 7:53:472009/10/28
To: MapInfo-L
Well, I never got it to be fully accurate, but it's good enough.
Still saves me a lot of time and effort.
I've posted the source code to my blog in case anyone wants to use it.

Any comments/criticism/improvements welcome!

http://chimpy.wordpress.com/2009/10/28/mapinfo-viewport-tool/

Steven Evans

未読、
2009/10/28 20:25:242009/10/28
To: mapi...@googlegroups.com
Very useful tool Mr Chimp!
Love the disclaimer :)
-----------------------------------------------------------------------
ATTENTION: This e-mail is privileged and confidential. If you are not
the intended recipient please delete the message and notify the sender.
Any views or opinions presented are solely those of the author.
-----------------------------------------------------------------------

Gentreau

未読、
2009/10/29 5:23:252009/10/29
To: mapi...@googlegroups.com

Mr Chimp, are you able to quantify the error which you get when re-loading a
view?
Is it constant?

MrChimp

未読、
2009/10/30 12:19:222009/10/30
To: MapInfo-L
Steven - thanks for the comments!

Gentreau -
I've just done some experimenting. It's weird.

1:100 becomes 1:101 (+1%)
1:1000 becomes 1:1010 (+1%)
1:10000 becomes 1:10100 (+1%)

This all seems logical until...

1:4000 becomes 1:4007 (+0.17469%)
and 1:5000 becomes 1:4983 (-0.3411599% !!)
...which doesn't make any sense to me! hopefully it will to someone
else...

If, like me, you usually mainly use round figure scales (1:2000,
1:4500 etc) then this tool is good enough to get you in the right
place, and close enough that you can look at the scale and at least
see what it's supposed to be and correct it. This might save a lot of
time but should be used with care.
全員に返信
投稿者に返信
転送
新着メール 0 件