Hi All,
This is quick post to demonstrate a useful tool for changing map projections based on a layer. By default MapInfo will assign a map projection based on the dominant raster layer. If you change raster layers the map projection may, but not always change. This tool will allow you to select a layer in the layer control, right click and set projection from layer.
Include "Mapbasic.def"
Include "Menu.def"
Declare Sub Main
Declare Sub SetMapWinProjection
'----------------------------------------------------------------
Sub Main
OnError Goto CatchEx
Alter Menu ID M_SHORTCUT_LC_LAYERS Add
"(-",
"Set Map Projection From Layer"
Calling SetMapWinProjection
Done:
Exit Sub
CatchEx:
Note Error$()
Resume Done
End Sub
'----------------------------------------------------------------
Sub SetMapWinProjectionOnError Goto CatchEx
If LayerControlInfo(LC_INFO_SEL_COUNT) = 0 then
Note "Please select a layer!"
Goto Done
End If
If LayerControlInfo(LC_INFO_SEL_COUNT) > 1 then
Note "Please select one layer you want to set the map projection from"
Goto Done
End If
Dim strLayerAlias as String
strLayerAlias = LayerControlSelectionInfo(1,LC_SEL_INFO_NAME)
Print("Layer Name: " & strLayerAlias)
Print("Layer Type: " & LayerControlSelectionInfo(1,LC_SEL_INFO_TYPE))
Dim iMapWinID as integer
iMapWinID = LayerControlSelectionInfo(1,LC_SEL_INFO_MAPWIN_ID)
Print("Layer's Map Window ID: " & iMapWinID)
Dim strCmd as String
strCmd = "Set Map " & TableInfo(strLayerAlias,TAB_INFO_COORDSYS_CLAUSE)
Print "strCmd = " & strCmd
Run Command strCmd
Done:
Exit Sub
CatchEx:
Note Error$()
Resume Done
End Sub
Top 10 best slots casinos for 2021 - SOL.EU
ReplyDeleteBest Slots Casino: Best Real Money Slots communitykhabar Sites 2021 · Red Dog Casino: Best Overall Slots Casino sol.edu.kg For jancasino.com USA Players · Ignition Casino: casino-roll.com Best Casino For febcasino.com Roulette