
Set the Tick, SubTick, and Label Visibility along the four sides of the grid. IGridLabel gridLabel=mapGrid.LabelFormat MapGrid.SubTickLineSymbol=cartographicLineSymbol as ILineSymbol MapGrid.TickLineSymbol=cartographicLineSymbol as ILineSymbol Set the Tick properties.ĬartographicLineSymbol= new CartographicLineSymbolClass() MapGrid.Border= null // Clear the default frame border. MapGrid.LineSymbol=cartographicLineSymbol as ILineSymbol ICartographicLineSymbol cartographicLineSymbol= new CartographicLineSymbolClassĬartographicLineSymbol.Cap=esriLineCapStyle.esriLCSButt Set the line symbol used to draw the grid. Dim map As IMap=activeView.FocusMapĪctiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, Nothing, Nothing)Įnd Sub public void CreateGrid(IActiveView activeView, IPageLayout pageLayout)Ĭolor.RGB=0XBBBBBB // -> Gray. MeasuredGrid.YIntervalSize=10 'Parallel interval. MeasuredGrid.XIntervalSize=10 'Meridian interval. Dim measuredGrid As IMeasuredGrid= Tr圜ast(mapGrid, IMeasuredGrid) MapGrid.Visible= True 'Set the IMeasuredGrid properties. 'Make the map grid visible so it gets drawn when Active View is updated. MapGrid.SetLabelVisibility( True, True, True, True)

MapGrid.SetSubTickVisibility( True, True, True, True) MapGrid.SetTickVisibility( True, True, True, True) 'Set the Tick, SubTick, and Label Visibility along the four sides of the grid. Dim gridLabel As IGridLabel=mapGrid.LabelFormat MapGrid.SubTickLineSymbol= Tr圜ast(cartographicLineSymbol, ILineSymbol) MapGrid.TickMarkSymbol= Nothing 'Set the SubTick properties. MapGrid.TickLineSymbol= Tr圜ast(cartographicLineSymbol, ILineSymbol) 'Set the Tick properties.ĬartographicLineSymbol= New CartographicLineSymbolClass MapGrid.Border= Nothing ' Clear the default frame border.

MapGrid.LineSymbol= Tr圜ast(cartographicLineSymbol, ILineSymbol) Dim cartographicLineSymbol As ICartographicLineSymbol= New CartographicLineSymbolClassĬartographicLineSymbol.Cap=esriLineCapStyle.esriLCSButt 'Set the line symbol used to draw the grid. Dim color As IColor= New RgbColorClassĬolor.RGB=&HBBBBBB ' -> Gray. MapGrid.Name= "Map Grid" 'Create a color. Dim mapGrid As IMapGrid= New GraticuleClass Public Sub CreateGrid( ByVal activeView As IActiveView, ByVal pageLayout As IPageLayout) Use cartographic line symbols so the grids lines have square butts.

OCCUPANCY GRID MAPPING VB CODE HOW TO
The following code example shows how to create a custom grid by code, modify its properties and labeling, and add it the map frame. IMapGrids mapGrids=mapFrame as IMapGrids IMapFrame mapFrame=frameElement as IMapFrame IFrameElement frameElement=graphicsContainer.FindFrame(map) IGraphicsContainer graphicsContainer=pageLayout as IGraphicsContainer Public Sub FindMapGrid( ByVal activeView As IActiveView, ByVal pageLayout As IPageLayout)ĭim graphicsContainer As IGraphicsContainer= Tr圜ast(pageLayout, IGraphicsContainer)ĭim frameElement As IFrameElement=graphicsContainer.FindFrame(map)ĭim mapFrame As IMapFrame= Tr圜ast(frameElement, IMapFrame)ĭim mapGrids As IMapGrids= Tr圜ast(mapFrame, IMapGrids)Įnd If End Sub public void FindMapGrid(IActiveView activeView, IPageLayout pageLayout) The MapFrame coclass has an IMapGrids interface where you can get to all map grids for that data frame.
