POST
|
Hi i have this code to intersect 2 layers but i want to intersect the selected features in one layer. Public Sub Intersect()
' Get the input layer and feature class.
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Dim pLayer As ILayer
Set pLayer = pMxDoc.FocusMap.Layer(0)
Dim pInputFeatLayer As IFeatureLayer
Set pInputFeatLayer = player
' Use the Itable interface from the Layer (not from the FeatureClass)
Dim pInputTable As ITable
Set pInputTable = player
' Get the input feature class.
' The Input feature class properties, such as shape type,
' will be needed for the output.
Dim pInputFeatClass As IFeatureClass
Set pInputFeatClass = pInputFeatLayer.FeatureClass
' Get the overlay layer
' Use the Itable interface from the Layer (not from the FeatureClass)
Set pLayer = pMxDoc.FocusMap.Layer(1)
Dim pOverlayTable As ITable
Set pOverlayTable = pLayer
' Error checking
If pInputTable Is Nothing Then
MsgBox "Table QI failed"
Exit Sub
End If
If pOverlayTable Is Nothing Then
MsgBox "Table QI failed"
Exit Sub
End If
' Define the output feature class name and shape type (taken from the
' properties of the input feature class)
Dim pFeatClassName As IFeatureClassName
Set pFeatClassName = New FeatureClassName
With pFeatClassName
.FeatureType = esriFTSimple
.ShapeFieldName = "Shape"
.ShapeType = pInputFeatClass.ShapeType
End With
' Set output location and feature class name
Dim pNewWSName As IWorkspaceName
Set pNewWSName = New WorkspaceName
pNewWSName.WorkspaceFactoryProgID = "esriCore.ShapeFileWorkspaceFactory.1"
pNewWSName.PathName = "C:\temp"
Dim pDatasetName As IDatasetName
Set pDatasetName = pFeatClassName
pDatasetName.Name = "Intersect_result"
Set pDatasetName.WorkspaceName = pNewWSName
' Set the tolerance. Passing 0.0 causes the default tolerance to be used.
' The default tolerance is 1/10,000 of the extent of the data frame???s spatial domain
Dim tol As Double
tol = 0#
' Perform the intersect
Dim pBGP As IBasicGeoprocessor
Set pBGP = New BasicGeoprocessor
Dim pOutputFeatClass As IFeatureClass
Set pOutputFeatClass = pBGP.intersect(pInputTable, False, pOverlayTable, False, tol, pFeatClassName)
' Add the output layer to the map
Dim pOutputFeatLayer As IFeatureLayer
Set pOutputFeatLayer = New FeatureLayer
Set pOutputFeatLayer.FeatureClass = pOutputFeatClass
pOutputFeatLayer.Name = pOutputFeatClass.AliasName
pMxDoc.FocusMap.AddLayer pOutputFeatLayer
End Sub
i change this line false for true but the code ignore the selection. I hope somebody can help me i need this code so mucho thanks!! Set pOutputFeatClass = pBGP.intersect(pInputTable, False, pOverlayTable, False, tol, pFeatClassName)
... View more
06-10-2011
10:26 AM
|
0
|
0
|
389
|
POST
|
Hi I have a visual basic code that adds items to the layout view as north, legend, scalable bar. and also images, then select a state then zoom to selected features and then create a layer from selected features and the latter is exported as a. pdf I need is to have a button that when clicking generate. pdf files of each state Eg Mexico has 32 ??????states must generate 32. pdf. I have the code ready but do one by one. I write in a textbox key state i add items and make a layoutview generated. pdf but I need something like a "for" to generate all states by simply clicking a button. someone who can help me?
... View more
05-17-2011
03:38 PM
|
0
|
0
|
411
|
POST
|
hi, I need to create an application in ArcMap, I have a. mxd with a scale bar, legend and north and I want to open when you click on a botton. If I open a layer eg countries.shp and after clicking on the botton to open the. mxd generate a new. mxd that already contains countries.shp and legend can see the name of the state that already gives by default. or if not someone help me with the code to open a. mxd thanks!
... View more
05-16-2011
09:22 AM
|
0
|
1
|
403
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|