POST
|
Hi folks, Our GIS server is already upgraded to the ArcGIS 10.1 SP1 from ArcGIS 10.0. When I tried to add existing toolbox model (created from ArcGIS 10.0) to the new ArcMap table of content, the Warning "A selected item could not be added to the Map" is popup. I also noticed that drag-drop item from Arcmap 10.1 catalog to the TOC is not functioning. Anybody know how to get around this? I tried make a new model on ArcMap 10.1 SP, but it also failed to be added into the map. Help me!
... View more
02-15-2013
11:12 PM
|
0
|
1
|
2290
|
POST
|
Cast? http://www.codeproject.com/Articles/5044/Cheat-Sheet-Casting-in-VB-NET-and-C Thanks Richard, it's help! Below are the change that I made and it work pretty well. Add 'Option Strict Off' on top of code as shown below.
Option Strict Off
Imports System.Data.OleDb
Imports System.Drawing
.....
The correct casting Private Sub SelectFeatureZoom(ByVal NAM As String)
Dim pQueryFilter As ESRI.ArcGIS.Geodatabase.IQueryFilter = New ESRI.ArcGIS.Geodatabase.QueryFilterClass
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureSelection As IFeatureSelection
Dim pLayer As ILayer
Dim intCount As Integer
For intCount = 0 To AxMapControl1.LayerCount - 1
pLayer = AxMapControl1.Map.Layer(intCount)
If TypeOf pLayer Is IFeatureLayer Then
pFeatureLayer = pLayer
pFeatureSelection = pFeatureLayer
If pFeatureLayer.Name = "DistrictBoundary" Then
'Create the query filter & select feature
pQueryFilter.WhereClause = " NAM = " & "'" & ComboBox1.Text & "'"
AxMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing)
pFeatureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, False)
End If
End If
Next
'Then Zoom
Dim pFeature As IFeature
Dim pEnvelope As IEnvelope
Dim pArea As IArea
Dim pEnumFeat As IEnumFeature
pEnumFeat = AxMapControl1.ActiveView.FocusMap.FeatureSelection
pFeature = pEnumFeat.Next
pEnvelope = pFeature.Shape.Envelope.Envelope
If pFeature.Shape.GeometryType = esriGeometryType.esriGeometryPoint Or (pEnvelope.Width = 0 And pEnvelope.Height = 0) Then
If AxMapControl1.ActiveView.FocusMap.ReferenceScale <> 0.0 Then
AxMapControl1.ActiveView.FocusMap.MapScale = AxMapControl1.ActiveView.FocusMap.ReferenceScale / 3
pEnvelope = AxMapControl1.ActiveView.Extent
pArea = pFeature.Shape.Envelope
pEnvelope.CenterAt(pArea.Centroid)
Else
pEnvelope = AxMapControl1.ActiveView.Extent
pArea = pFeature.Shape.Envelope
pEnvelope.CenterAt(pArea.Centroid)
pEnvelope.Expand(2, 2, True)
End If
AxMapControl1.ActiveView.Extent = pEnvelope
AxMapControl1.ActiveView.Refresh()
Else
AxMapControl1.ActiveView.Extent = pFeature.Extent
AxMapControl1.ActiveView.Refresh()
End If
End Sub Thanks again and have a great weekend everyone!
... View more
07-07-2012
02:10 AM
|
0
|
0
|
272
|
POST
|
Hey folk of greater ArcObjects Wisdom than I, how can I handle the errors regarding the implicit conversion? Below is example of code that I working at right now. Please help me 😞 Private Sub zoomFeature(ByVal objectID As String) Dim pQueryFilter As IQueryFilter Dim pFeatureLayer As IFeatureLayer Dim pFeatureSelection As IFeatureSelection Dim pLayer As ILayer Dim intCount As Integer For intCount = 0 To AxMapControl1.LayerCount - 1 pLayer = AxMapControl1.Map.Layer(intCount) If TypeOf pLayer Is IFeatureLayer Then pFeatureLayer = pLayer '<---Implicit conversion from 'ESRI.ArcGIS.Carto.ILayer' to 'ESRI.ArcGIS.Carto.IFeatureLayer' pFeatureSelection = pFeatureLayer '<---Implicit conversion from 'ESRI.ArcGIS.Carto.IFeatureLayer' to 'ESRI.ArcGIS.Carto.IFeatureSelection' If pFeatureLayer.Name = "DistrictBoundary" Then 'Create the query filter pQueryFilter = New QueryFilter '<---Implicit conversion from 'ESRI.ArcGIS.Geodatabase.QueryFilterClass' to 'MapControlApplication1.QueryFilter' pQueryFilter.WhereClause = "OBJECTID = " & objectID '<--- 'WhereClause' is not a member of 'MapControlApplication1.QueryFilter' AxMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing) pFeatureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, False) '<---Implicit conversion from 'MapControlApplication1.QueryFilter' to 'ESRI.ArcGIS.Geodatabase.IQueryFilter' End If End If End Sub
... View more
07-05-2012
07:47 PM
|
0
|
2
|
720
|
POST
|
Thanks xjwang. I'll try Hello, Please use ESRI.ArcGIS.AxControls assembly if you are using the Engine controls; use ESRI.ArcGIS.ADF Assembly to replace the utilities assembly. Details please refer to the links: How to migrate ArcGIS 9.3 Desktop and Engine stand-alone applications to ArcGIS 10 http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/How_to_migrate_ArcGIS_9_3_Desktop_and_Engine_stand_alone_applications_to_ArcGIS_10/0001000002ns000000/ ESRI.ArcGIS.ADF Assembly http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Overview/000200002pnn000000/ Regards, Chelsea
... View more
07-01-2012
06:44 PM
|
0
|
0
|
441
|
POST
|
G'day all, I have my 9.3 code that using above library and want to convert it using MS C# 2010 and ESRI ArcGIS Engine 10. I'm stuck to add correct assembly reference for using the above library, please help me 😞 ESRI.ArcGIS.MapControl; ESRI.ArcGIS.MapControl.AxMapControl; ESRI.ArcGIS.TOCControl; ESRI.ArcGIS.ToolbarControl; ESRI.ArcGIS.Utility; ESRI.ArcGIS.Utility.BaseClasses; ESRI.ArcGIS.Utility.CATIDs;
... View more
06-28-2012
07:22 PM
|
0
|
2
|
3288
|
POST
|
Did you install the ESRI SDK? If so, did you install the SDK after installing Visual Studio? Yes, I also installed ESRI SDK after installing Visual Studio Express 2008. Any ideas how to solve this problem?
... View more
03-20-2012
12:18 AM
|
0
|
0
|
269
|
POST
|
I installed ArcGIS Desktop 10 and Visual Basic 2008 Express Edition on my other workstation that running on Windows XP SP3. When I expand the Visual Basic project and ArcGIS node and click Desktop Add-Ins, the error 'The type initializer for ' module ' threw an exception' popped up. I already uninstalled and re-installed Visual Basic 2008 Express Edition, but this error still occurred. Help me!
... View more
03-18-2012
08:00 PM
|
0
|
2
|
2911
|
POST
|
Hi all, Is it possible to modify the Weather Underground Widget to create a dynamic/real time symbology of point sensor? I want my sensor point on arcgis web map to change the color or symbology when the sensor detects the triggered events.
... View more
01-12-2012
05:40 PM
|
0
|
1
|
710
|
POST
|
Hi, I'm trying to build ArcMap Add-Ins by using ArcGIS 10 and MS VB.NET Express 2008. How to use or replace application.hwnd as shown in code below? Sub SaveFirstLayerAsShapefile()
Dim pMxDoc As IMxDocument
Set pMxDoc = My.ArcMap.Document
Dim pFeatureLayer As IFeatureLayer
Set pFeatureLayer = pMxDoc.FocusMap.Layer(0)
SaveShapeFileDialog pFeatureLayer.FeatureClass, Application.hwnd
End Sub
Public Function SaveShapeFileDialog(ByRef pFeatureClass As IFeatureClass, Optional lParentWindow As Long = 0)
On Error GoTo SaveShapefileDialog_ERR
Dim pGxBrowser As IGxDialog
Set pGxBrowser = New GxDialog
Dim pFilter As IGxObjectFilter
Set pFilter = New GxFilterShapefiles
Set pGxBrowser.ObjectFilter = pFilter
Dim sShapefile As String
Dim sDir As String
Dim pGxObject As IGxObject
If Not pGxBrowser.DoModalSave(lParentWindow) Then Exit Function
sShapefile = pGxBrowser.name
sDir = pGxBrowser.FinalLocation.FullName
If Right(sDir, 1) <> "\" Then sDir = sDir & "\"
Dim pWorkspaceName As IWorkspaceName
Set pWorkspaceName = New WorkspaceName
With pWorkspaceName
.PathName = sDir
.WorkspaceFactoryProgID = "esriCore.ShapefileWorkspaceFactory.1"
End With
Dim pOutDatasetName As IDatasetName
Set pOutDatasetName = New FeatureClassName
Set pOutDatasetName.WorkspaceName = pWorkspaceName
pOutDatasetName.name = sShapefile
'Delete the shapefile, if existing
Dim pOutName As IName
Set pOutName = pOutDatasetName
Dim pOutDataset As IDataset
On Error Resume Next
Set pOutDataset = pOutName.Open
If Not pOutDataset Is Nothing Then
pOutDataset.Delete
End If
Set pOutDataset = Nothing
Dim pInDataset As IDataset
Set pInDataset = pFeatureClass
Dim pExportOp As IExportOperation
Set pExportOp = New ExportOperation
pExportOp.ExportFeatureClass pInDataset.FullName, _
Nothing, _
Nothing, _
pFeatureClass.Fields.Field(pFeatureClass.Fields.FindField(pFeatureClass.ShapeFieldName)).GeometryDef, _
pOutDatasetName, _
Application.hwnd
Exit Function
SaveShapefileDialog_ERR:
Debug.Print "SaveShapefileDialog_ERR: " & Err.Description
Debug.Assert 0
End Function
... View more
02-10-2011
05:55 PM
|
0
|
1
|
2758
|
POST
|
In your OnClick sub, try this:
Dim activeview As ESRI.ArcGIS.Carto.IActiveView = GetActiveViewFromArcMap(My.ArcMap.Application)
Also, you might want to look at the IGxDialog interface. This gives you the ability to load or save many different types of data sets. Thanks Ken, it's working now 😉
... View more
02-09-2011
09:12 PM
|
0
|
0
|
271
|
POST
|
ESRI.ArcGIS.System :- The System library is the lowest level library in the ArcGIS architecture. The library contains components that expose services used by the other libraries composing ArcGIS. ESRI.ArcGIS.esriSystem :- The Display library contains the components that support drawing symbology to an output device. Screen displays, symbols, colors and feedback objects, along with their supporting objects are all defined in the library. Noted. Thanks Venkat Tammineni 😄
... View more
02-07-2011
10:35 PM
|
0
|
1
|
457
|
POST
|
G'day all, I am trying to build ArcMap Add-Ins to Add Shapefile Using OpenFileDialog. I am stuck on "name m_application is not declared" Anybody can help me? Below is my code:
Imports System
Imports System.Runtime.InteropServices
Imports System.Drawing
Imports ESRI.ArcGIS.ADF.BaseClasses
Imports ESRI.ArcGIS.ADF.CATIDs
Imports ESRI.ArcGIS.Framework
Imports ESRI.ArcGIS.ArcMapUI
Public Class ZoomToLayerButton
Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Public Sub New()
End Sub
Protected Overrides Sub OnClick()
'TODO: Add AddShapefile.OnClick implementation.
Dim activeview As ESRI.ArcGIS.Carto.IActiveView = GetActiveViewFromArcMap(m_application)
AddShapefileUsingOpenFileDialog(activeview)
End Sub
Protected Overrides Sub OnUpdate()
Enabled = My.ArcMap.Application IsNot Nothing
End Sub
#Region "Add Shapefile Using OpenFileDialog"
' ArcGIS Snippet Title:
' Add Shapefile Using OpenFileDialog
'
' Long Description:
' Add a shapefile to the ActiveView using the Windows.Forms.OpenFileDialog control.
'
' Add the following references to the project:
' ESRI.ArcGIS.Carto
' ESRI.ArcGIS.DataSourcesFile
' ESRI.ArcGIS.Display
' ESRI.ArcGIS.Geodatabase
' ESRI.ArcGIS.Geometry
' ESRI.ArcGIS.System
' System
' System.Windows.Forms
'
' Intended ArcGIS Products for this snippet:
' ArcGIS Desktop (ArcEditor, ArcInfo, ArcView)
' ArcGIS Engine
'
' Applicable ArcGIS Product Versions:
' 9.2
' 9.3
' 9.3.1
' 10.0
'
' Required ArcGIS Extensions:
' (NONE)
'
' Notes:
' This snippet is intended to be inserted at the base level of a Class.
' It is not intended to be nested within an existing Function or Sub.
'
'''<summary>Add a shapefile to the ActiveView using the Windows.Forms.OpenFileDialog control.</summary>
'''
'''<param name="activeView">An IActiveView interface</param>
'''
'''<remarks></remarks>
Public Sub AddShapefileUsingOpenFileDialog(ByVal activeView As ESRI.ArcGIS.Carto.IActiveView)
'parameter check
If activeView Is Nothing Then
Return
End If
' Use the OpenFileDialog Class to choose which shapefile to load.
Dim openFileDialog As System.Windows.Forms.OpenFileDialog = New System.Windows.Forms.OpenFileDialog
openFileDialog.InitialDirectory = "c:\"
openFileDialog.Filter = "Shapefiles (*.shp)|*.shp"
openFileDialog.FilterIndex = 2
openFileDialog.RestoreDirectory = True
openFileDialog.Multiselect = False
If openFileDialog.ShowDialog = System.Windows.Forms.DialogResult.OK Then
' The user chose a particular shapefile.
' The returned string will be the full path, filename and file-extension for the chosen shapefile. Example: "C:\test\cities.shp"
Dim shapefileLocation As String = openFileDialog.FileName
If shapefileLocation <> "" Then
' Ensure the user chooses a shapefile
' Create a new ShapefileWorkspaceFactory CoClass to create a new workspace
Dim workspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass
' System.IO.Path.GetDirectoryName(shapefileLocation) returns the directory part of the string. Example: "C:\test\"
Dim featureWorkspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace = CType(workspaceFactory.OpenFromFile(System.IO.Path.GetDirectoryName(shapefileLocation), 0), ESRI.ArcGIS.Geodatabase.IFeatureWorkspace) ' Explicit Cast
' System.IO.Path.GetFileNameWithoutExtension(shapefileLocation) returns the base filename (without extension). Example: "cities"
Dim featureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = featureWorkspace.OpenFeatureClass(System.IO.Path.GetFileNameWithoutExtension(shapefileLocation))
Dim featureLayer As ESRI.ArcGIS.Carto.IFeatureLayer = New ESRI.ArcGIS.Carto.FeatureLayerClass
featureLayer.FeatureClass = featureClass
featureLayer.Name = featureClass.AliasName
featureLayer.Visible = True
activeView.FocusMap.AddLayer(featureLayer)
' Zoom the display to the full extent of all layers in the map
activeView.Extent = activeView.FullExtent
activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeography, Nothing, Nothing)
Else
' The user did not choose a shapefile.
' Do whatever remedial actions as necessary
' System.Windows.Forms.MessageBox.Show("No shapefile chosen", "No Choice #1", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation)
End If
Else
' The user did not choose a shapefile. They clicked Cancel or closed the dialog by the "X" button.
' Do whatever remedial actions as necessary.
' System.Windows.Forms.MessageBox.Show("No shapefile chosen", "No Choice #2", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation)
End If
End Sub
#End Region
#Region "Get ActiveView from ArcMap"
' ArcGIS snippet title:
' Get ActiveView from ArcMap.
'
' Long description:
' Get ActiveView from ArcMap.
'
' Add the following references to the project:
' ESRI.ArcGIS.ArcMapUI.
' ESRI.ArcGIS.Carto.
' ESRI.ArcGIS.Framework.
' ESRI.ArcGIS.System.
'
' Intended ArcGIS products for this snippet:
' ArcGIS Desktop (ArcEditor, ArcInfo, ArcView).
'
' Applicable ArcGIS product versions:
' 9.2.
' 9.3.
'
' Required ArcGIS extensions:
' (None)
'
' Notes:
' This snippet is intended to be inserted at the base level of a class.
' It is not intended to be nested within an existing function or sub.
'
'''<summary>Get ActiveView from ArcMap</summary>
'''
'''<param name="application">An IApplication interface that is the ArcMap application.</param>
'''
'''<returns>An IActiveView interface.</returns>
'''
'''<remarks></remarks>
Public Function GetActiveViewFromArcMap(ByVal application As ESRI.ArcGIS.Framework.IApplication) As ESRI.ArcGIS.Carto.IActiveView
If application Is Nothing Then
Return Nothing
End If
Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument = TryCast(application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument) ' Dynamic Cast
Dim activeView As ESRI.ArcGIS.Carto.IActiveView = mxDocument.ActiveView
Return activeView
End Function
#End Region
End Class
... View more
02-07-2011
07:06 PM
|
0
|
2
|
3101
|
POST
|
Does anyone know the difference "ESRI.ArcGIS.System" and "ESRI.ArcGIS.esriSystem" ?
... View more
02-06-2011
10:47 PM
|
0
|
6
|
1261
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|