You are talking about two domains that do not communicate. The "global" one
is used for the internal working of MapInfo and is accessed by the MapBasic
window. The "application" domain is totally independent and several coordsys
can thus exist in parallel.
If you were to add at the end of your NewCoord sub "print
centroidx(selection.obj)" and open a table and select one object before
running the mbx, you will see that the measure is in the new coordsys, but
that the "global" one has not changed.
That may indeed look strange given the fact that it is said that the "run
command" is processed outside the application domain...
But if you were to run from the MB window the following lines
Dim a as string
a=coordsys$()
run command "set "+a
the "global" coordsys will be changed
One way to do it without writing it each time would be to prepare a wor and
use a
run application "fullpath\changeglobalcoordsys.wor". That wor would look
something like
!Workspace
!Version 600
!Charset WindowsLatin1
Dim a as string
a="set "+chooseprojection$("",1)
run command a
undim a
You can of course use that wor-based function from within a compiled mbx
with the "run application"
Jacques Paris
e-mail [EMAIL PROTECTED]
MapBasic-MapInfo support http://www.paris-pc-gis.com
-----Original Message-----
From: Nicolas Muszynski [mailto:[EMAIL PROTECTED]
Sent: 6-Aug-04 12:00
To: [EMAIL PROTECTED]
Subject: MI-L Changing projections with MapBasic
Hello,
I am trying to make a very simple MapBasic program to change the
"Global" MapInfo projection, the equivalent of typing: "Set Coordsys
Earth projection (whatever the projection may be)" In the MapBasic
Window.
When I execute the line:
Run Command "Set Coordsys Earth projection "whatever the projection may
be"
It changes the current application Projection but does not change the
"global" Mapinfo projection.
The reason I want to do this is that when objects are labelled with the
function CentroidX or CentroidY they automatically take the "Global"
MapInfo Projection and do not use the table projection, Layout
Projection or map projection. The same happens when you want to update
a column with the same CentroidX or CentroidY Functions.
I included the program below for reference,
Include "MapBasic.def"
Declare Sub Main
Declare Sub NewCoord
Sub Main
Dialog
Title "Set a Global Projection"
Control StaticText
Title "Choose a Projection"
Control Button
Title "Choose Projection"
Calling NewCoord
End Sub
Sub NewCoord
Dim NewSys as String
NewSys=ChooseProjection$("",True)
NewSys="Set " + NewSys
Dialog Remove
Note NewSys
Run Command NewSys
End Sub
Thank you for taking the time to at least read,
Nicolas Muszynski
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12867
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12872