POST
|
I made a mistake and I tried to change the Checkmark, but it didn't allowed me. What was I suppose to do?
... View more
06-18-2012
09:33 AM
|
0
|
0
|
387
|
POST
|
Can someone tell me what I'm doing wrong, please? I'm just trying to select the first layer for a selection, in ArcMap, and I'm using the SelectMapFeaturesByAttributeQuery snippet, as a starting point. Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Carto
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'MsgBox(Me.TextBox1.Text)
Dim pMap = My.ArcMap.Document.ActiveView
SelectMapFeaturesByAttributeQuery(pMap, pMap.Layer(0), "PID = '55144133'") <-- something is wrong here
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Public Sub SelectMapFeaturesByAttributeQuery(ByVal activeView As IActiveView, ByVal featureLayer As IFeatureLayer, ByVal whereClause As System.String)
If activeView Is Nothing OrElse featureLayer Is Nothing OrElse whereClause Is Nothing Then
Return
End If
Dim featureSelection As IFeatureSelection = TryCast(featureLayer, IFeatureSelection) ' Dynamic Cast
' Set up the query
Dim queryFilter As IQueryFilter = New QueryFilterClass
queryFilter.WhereClause = whereClause
' Invalidate only the selection cache. Flag the original selection
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)
' Perform the selection
featureSelection.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
' Flag the new selection
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)
End Sub
End Class
... View more
06-18-2012
09:17 AM
|
0
|
3
|
596
|
POST
|
Sorry, but he did give me a valid answer, but it wasn't the solution to my problem. I just make a difference between the two, but I guess this forum works differently. I can remove it, if that's the reason why I don';t get replies.
... View more
06-18-2012
09:11 AM
|
0
|
0
|
387
|
POST
|
No takers, eh? I just need to know how to select the first layer, then I'm done!
... View more
06-18-2012
09:04 AM
|
0
|
0
|
387
|
POST
|
Thanks Alexander. I understand what you are saying, but I have no idea how to do it (yet). I just started to learn VS2010 and ArcGIS 10. I'm familiar with VBA , but I'm not familiar with ArcGIS Development kit. I'll try to get it to work, nontheless! Let's assume there's only one layer (Feature Class), loaded in ArcMap. What would be the argument, then? Dim pMap = My.ArcMap.Document SelectMapFeaturesByAttributeQuery(pMap.ActiveView, pMap.Layer(0), "PID = '00000000'")
... View more
06-18-2012
07:27 AM
|
0
|
0
|
387
|
POST
|
Iâ??m trying to create a simple Query, with VS2010. All I want to do is have a Selection by Attribute, using a Geodatabase Feature Class in the ActiveView. Iâ??m using the SelectMapFeaturesByAttributeQuery Snippet, but the code is a little unclear as to how I invoke the Feature Class by it's name, and not by order (Layer(0))
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Carto
Public Class Button1
Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Public Sub New()
End Sub
Protected Overrides Sub OnClick()
SelectMapFeaturesByAttributeQuery(My.ArcMap.Document.ActiveView, ??????, "PID = '00000000'")
My.ArcMap.Application.CurrentTool = Nothing
End Sub
Protected Overrides Sub OnUpdate()
Enabled = My.ArcMap.Application IsNot Nothing
End Sub
Public Sub SelectMapFeaturesByAttributeQuery(ByVal activeView As IActiveView, ByVal featureLayer As IFeatureLayer, ByVal whereClause As System.String)
If activeView Is Nothing OrElse featureLayer Is Nothing OrElse whereClause Is Nothing Then
Return
End If
Dim featureSelection As IFeatureSelection = TryCast(featureLayer, IFeatureSelection) ' Dynamic Cast
' Set up the query
Dim queryFilter As IQueryFilter = New QueryFilterClass
queryFilter.WhereClause = whereClause
' Invalidate only the selection cache. Flag the original selection
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)
' Perform the selection
featureSelection.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
' Flag the new selection
activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)
End Sub
... View more
06-18-2012
05:48 AM
|
0
|
9
|
2976
|
POST
|
Thanks again, Ken, but it's still not working. I'm not going to waste anymore time with this snippet. I've tried other snippets and I didn't have any problems. Maybe I'm missing a Reference, or something, to get this one to work.
... View more
06-15-2012
10:38 AM
|
0
|
0
|
393
|
POST
|
Thanks Ken, that took care of the errors. However, when I click the button, nothing happen and the button turns grey (disabled), after clicking on it. Any thoughts?
... View more
06-15-2012
09:51 AM
|
0
|
0
|
393
|
POST
|
Thanks for the reply, Leo, but I have already tried that and I get the following error: error BC30201: Expression expected I think my problem is getting the active view to work, in the first argument. I'm not sure what to put there, but I know the second argument should be the path of the layer file: AddLayerToActiveView(????, "D:\Contours.lyr")
... View more
06-15-2012
08:19 AM
|
0
|
0
|
393
|
POST
|
I just had VS2010 installed with ArcGIS 10. I???m trying to learn how the snippet works and I'm using the AddLayerToActiveView snippet, as a test subject. I seem to have problems invoking it, in a button. What am I doing wrong? Imports ESRI.ArcGIS.SystemUI Imports ESRI.ArcGIS.esriSystem Imports ESRI.ArcGIS.Geodatabase Imports ESRI.ArcGIS.Catalog Imports ESRI.ArcGIS.Carto Namespace CustomUIElements Public Class AddLayer Inherits ESRI.ArcGIS.Desktop.AddIns.Button Public Sub New() End Sub Protected Overrides Sub OnClick() WHAT SHOULD I PUT HERE???? My.ArcMap.Application.CurrentTool = Nothing End Sub Protected Overrides Sub OnUpdate() Enabled = My.ArcMap.Application IsNot Nothing End Sub Public Sub AddLayerToActiveView(ByVal activeView As IActiveView, ByVal layerPathFile As System.String) If activeView Is Nothing OrElse layerPathFile Is Nothing OrElse (Not layerPathFile.EndsWith(".lyr")) Then Return End If ' Create a new GxLayer Dim gxLayer As IGxLayer = New GxLayerClass Dim gxFile As IGxFile = CType(gxLayer, IGxFile) 'Explicit Cast ' Set the path for where the layerfile is located on disk gxFile.Path = layerPathFile ' Test if we have a valid layer and add it to the map If Not (gxLayer.Layer Is Nothing) Then Dim map As IMap = activeView.FocusMap map.AddLayer(gxLayer.Layer) End If End Sub End Class End Namespace
... View more
06-15-2012
08:07 AM
|
0
|
7
|
1914
|
POST
|
Thanks Robert; it did resolved the problem - we just forgot to restart the REST.
... View more
02-14-2012
03:33 AM
|
0
|
0
|
211
|
POST
|
For some reasons, our features in Flex Viewer are being displayed with a white Halo (lines, texts and symbols). We don???t have any Halo setup in our MXD, but they do appear after publishing the MXD to an MSD. However, when viewing the MSD in the JavaScript viewer, there???s no Halo. We called the ESRI Tech Support and they said that they never encounter this issue before and perhaps, the issue resides in one of the XML files ??? but, we can???t seem to find which one. Anyone else had that issue before?
... View more
02-14-2012
02:59 AM
|
0
|
3
|
1626
|
POST
|
Thanks, I got it! I also forgot to include: import os, sys, arcgisscripting self.GP = arcgisscripting.create()
... View more
04-05-2011
06:12 AM
|
0
|
0
|
233
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|