Hi Jan,
In MapInfo you can learn a lot from the Mapbasic window. Goto Settings->Show
Mapbasic window
Most of the work you do will be displayed in the window. If you want to make
apps for MI you'll have to buy Mapbasic.

If you select e.g. several polygons from a layer, you have a
'Selection'-table. If you browse (F2 or Window->New browser) or add the the
selection as a layer to your map window,  a new temporary table is created.
This table is called Query# where # is a number starting from 1 in the
current session. 

Do this:
Have some tables open in a map window. Select an object (or several holding
shift). Open the Mapbasic window. Open Layer Control and click "Add". Choose
'Selection' and hit OK twice.

In the MB-window this occurs:
set map redraw off
Add Map Layer Query1
followed by some 'Set map Layer' statements and 'set map redraw on'.

Now try to replace Query1 with the word 'Selection' and make another
selection from your map. Then place your cursor in the line 'Add Map Layer
Selection' (highlighting text in several lines also works) and hit enter.
If you now open your layer control you'll see a new layer called Query2.
Temporary tables contains all attributes from the base table and can be
converted to base tables through a Commit Table Query# (or Selection) As...
and then reopened: File->Commit Table As...
Try to do this manually and watch the MB window.

The style part:
You can alter the general style settings with the three buttons in the
Drawing Toolbar. But if you want to control the display of your new layer
then you can do it through the Layer Control by doubleclicking the layer.
Watch the MB window. (And use MB help for the style settings)

If you've got Mapbasic you now have sufficient information to make an app
(or script as you call it):

***************example**************
Include "mapbasic.def"
Include "icons.def"
Declare Sub Main
Declare Sub SelAdd

Sub Main
OnError GoTo OOPS
Create Buttonpad "SelAdd" as
PushButton  
                
                HelpMsg "Add the current selection as a new layer\nAdd the
current selection as a new layer"
                Calling SelAdd
                Icon  236
Title "SelAdd"
                Fixed
                show
Exit Sub
OOPS:
Print Error$() 
End Sub

Sub SelAdd
OnError GoTo OOPS
  If  SelectionInfo(SEL_INFO_NROWS) <  1 Then 
        print "No selection"
        Exit Sub 
  End If 

  If FrontWindow() Then
        If WindowInfo(FrontWindow(),WIN_INFO_TYPE) = WIN_MAPPER 
                Then    
                Add Map Layer Selection 
                Set Map Layer 1 Display Global Global Symbol
(33,16711935,12) Global Line (1,3,16711680) Global Brush (4,16776960) 
        End If
  end if
Exit Sub
OOPS:
Print Error$() 
End Sub

***************example end**************
And now some good advice: Use this list and browse the DirectionMag's
library of code examples and apps. Many problems are solved without one line
of your own code because many share their apps and code. Especially the KGM
Utilities (something like that) that Kevin Mahoney uploaded several years
ago are an excellent start.
Try also to browse the code examples that are shipped with Mapbasic

Soren Breddam
GIS- og IT-koordinator
Teknik og Erhvervsforvaltningen
Stevns Kommune - www.stevns.dk 
*      Tlf.:   5656 1800
*      Dir.:   5656 1891



-----Oprindelig meddelelse-----
Fra: Jan [mailto:[EMAIL PROTECTED]
Sendt: 29. juni 2004 21:44
Til: [EMAIL PROTECTED]
Emne: MI-L MapInfo polygon extraction and automation


Dear all
 
i have some questions to make:
 
1. How can i automate in MapInfo the extraction of a specific polygon or
polygons and create new layer?
2.In the same script could i input information about the display of the
layer
3. is it possible to create automatically as well the output?
4. does anyone have any similar script?
 
I am using mostly ESRI products. Any help would be much appreciated.
 
Best Regards
 
Jan



---------------------------------
Do You Yahoo!?
?p??t?ste t?? d??e?? [EMAIL PROTECTED] d?e????s?  st? Yahoo! Mail.

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

Reply via email to