|
POST
|
I have complied it. It does not return multiple results. It's only available to be used as a starting point, and it doesn't take you very far.
... View more
01-08-2013
09:58 AM
|
0
|
0
|
1274
|
|
POST
|
Some differences are: I'm displaying the data in a DataGridView, not a RichTextBox I'm specifying which column to enter each field, and only the fields I want. I found this here: C:\Program Files (x86)\ArcGIS\DeveloperKit10.1\Samples\ArcObjectsNet\FindAddress\VBNet\FindAddress2010.sln Private Sub GeocodeAddress()
' Get the locator
Dim obj As System.Object = Activator.CreateInstance(Type.GetTypeFromProgID("esriLocation.LocatorManager"))
Dim locatorManager As ILocatorManager2 = TryCast(obj, ILocatorManager2)
Dim locatorWorkspace As ILocatorWorkspace = locatorManager.GetLocatorWorkspaceFromPath("C:\locators")
Dim locator As ILocator = locatorWorkspace.GetLocator("California_city_state_zip")
' Set up the address properties
Dim addressInputs As IAddressInputs = TryCast(locator, IAddressInputs)
Dim addressFields As IFields = addressInputs.AddressFields
Dim addressProperties As IPropertySet = New PropertySetClass()
addressProperties.SetProperty(addressFields.Field(0).Name, Me.AddressTextBox.Text)
addressProperties.SetProperty(addressFields.Field(1).Name, Me.CityTextBox.Text)
addressProperties.SetProperty(addressFields.Field(2).Name, Me.StateTextBox.Text)
addressProperties.SetProperty(addressFields.Field(3).Name, Me.ZipTextBox.Text)
' Match the Address
Dim addressGeocoding As IAddressGeocoding = TryCast(locator, IAddressGeocoding)
Dim resultSet As IPropertySet = addressGeocoding.MatchAddress(addressProperties)
' Print out the results
Dim names, values As Object
resultSet.GetAllProperties(names, values)
Dim namesArray() As String = TryCast(names, String())
Dim valuesArray() As Object = TryCast(values, Object())
Dim length As Integer = namesArray.Length
Dim point As IPoint = Nothing
For i As Integer = 0 To length - 1
If namesArray(i) <> "Shape" Then
Me.ResultsTextBox.Text += namesArray(i) & ": " & valuesArray(i).ToString() & Constants.vbLf
Else
If point IsNot Nothing AndAlso (Not point.IsEmpty) Then
point = TryCast(valuesArray(i), IPoint)
Me.ResultsTextBox.Text &= "X: " & point.X + Constants.vbLf
Me.ResultsTextBox.Text &= "Y: " & point.Y + Constants.vbLf
End If
End If
Next i
Me.ResultsTextBox.Text += Constants.vbLf
End Sub
... View more
01-08-2013
09:33 AM
|
0
|
0
|
1274
|
|
POST
|
Debug.Print("resultSet.Count = " & resultSet.Count) The count is seven which is actually the same as 'length'. I see 'resultSet' is some kind of properties item: Dim resultSet As IPropertySet = addressGeocoding.MatchAddress(addressProperties) It looks like 'length is just another way of saying 'resultSet.Count': Dim length As Integer = namesArray.Length ' Not terribly sure what this line does. Probably does the same thing as resultSet.Count
... View more
01-08-2013
09:11 AM
|
0
|
0
|
1274
|
|
POST
|
Mike, The 'length' variable is actually looping through the fields in the row. That's the horizontal aspect of the database which I have working correctly. I don't have the verticle aspect of the database. I don't see the capacity for it using this method either. I could post the sample FindAddress code from the SDK if that would help.
... View more
01-08-2013
08:45 AM
|
0
|
0
|
1274
|
|
POST
|
I've written a GeocodeAddress method which is a modified version of the SDK vb.net FindAddress sample. I'm using a local address locator and I can't understand how to make it return multiple results. It is only returning the first result. If I use the same locator in ArcMap's native Find tool, it pulls up a bunch of records. All help is appreciated, Corbin de Bruin Private Sub GeocodeAddress() locatorManager = TryCast(obj, ILocatorManager2) locatorWorkspace = locatorManager.GetLocatorWorkspaceFromPath(gLocatorWorkspace) Dim locator As ILocator = locatorWorkspace.GetLocator("Street_Addresses_US") ' Set up the address properties Dim addressInputs As IAddressInputs = TryCast(locator, IAddressInputs) Dim addressFields As IFields = addressInputs.AddressFields Dim addressProperties As IPropertySet = New PropertySetClass() addressProperties.SetProperty(addressFields.Field(0).Name, txtAddress.Text) addressProperties.SetProperty(addressFields.Field(1).Name, txtCity.Text) addressProperties.SetProperty(addressFields.Field(2).Name, txtState.Text) addressProperties.SetProperty(addressFields.Field(3).Name, txtZIP.Text) ' Match the Address Dim addressGeocoding As IAddressGeocoding = TryCast(locator, IAddressGeocoding) Dim resultSet As IPropertySet = addressGeocoding.MatchAddress(addressProperties) 'Write results to DataGridView Dim names, values As Object ' Not sure how these ever really get populated. They produce a warning where a null reference exception could be produced resultSet.GetAllProperties(names, values) Dim namesArray() As String = TryCast(names, String()) Dim valuesArray() As Object = TryCast(values, Object()) Dim length As Integer = namesArray.Length ' Not terribly sure what this line does. Dim addressPoint As IPoint = Nothing dgvAddrResults.Rows.Add() ' Create DataGridRow to hold result For i As Integer = 0 To length - 1 Select Case namesArray(i) ' Case Statement to write proper fields to DataGrid Columns Case "Status" If valuesArray(i).ToString() = "U" Then lblAddressPrompt.Text = "***Address was not found." lblAddressPrompt.Visible = True Exit Sub End If Case "Shape" addressPoint = TryCast(valuesArray(i), IPoint) If addressPoint IsNot Nothing AndAlso (Not addressPoint.IsEmpty) Then dgvAddrResults.Item("Coordinates", 0).Value = addressPoint.X.ToString & ", " & addressPoint.Y.ToString Else dgvAddrResults.Item("Coordinates", 0).Value = "No geographic point available" End If Case "Score" dgvAddrResults.Item("Score", 0).Value = valuesArray(i).ToString() Case "Match_addr" dgvAddrResults.Item("Address", 0).Value = valuesArray(i).ToString() Case "Addr_type" dgvAddrResults.Item("Type", 0).Value = valuesArray(i).ToString() End Select Next i End Sub
... View more
01-08-2013
06:46 AM
|
0
|
12
|
3560
|
|
POST
|
Had success. Referenced the addin's .dll to another project.
... View more
01-04-2013
10:40 AM
|
0
|
0
|
499
|
|
POST
|
Thank you Neil, Very helpful! I've never done anything like that before, but I was able to figure it out with the documentation you provided and some googling. I now have the Enhanced Modeless Dialogs working. Thank you, Corbin de Bruin
... View more
01-03-2013
06:08 AM
|
0
|
0
|
2048
|
|
POST
|
I'm new to referencing .dlls and such. Can you reference another esriaddin the same way you would reference a dll?
... View more
01-02-2013
11:05 AM
|
0
|
1
|
817
|
|
POST
|
Interestingly, the tab key stops working if I use .Show() instead of .ShowDialog(). It simply no longer navigates from control to control. Any way to make the tab stops work with .Show()? Any one else even aware of this problem? Nevermind. I found this forum post: http://forums.arcgis.com/threads/68761-Add-In-Tab-Key-problems?highlight=tab%2C+stops
... View more
01-02-2013
07:48 AM
|
0
|
0
|
2048
|
|
POST
|
Are you trying to close ArcMap or just your Add-In? Is your Add-In just a form?
... View more
12-11-2012
05:34 AM
|
0
|
0
|
735
|
|
POST
|
Thanks for responding Neil! Translated to vb.net yourForm.Show(System.Windows.Forms.Control.FromHandle(CType(m_application.hWnd, IntPtr))) Thank you, cdebruin
... View more
12-06-2012
04:39 AM
|
0
|
0
|
2048
|
|
POST
|
Hi all, I'm programming an addin with a form and I'd like the form stay on top of ArcMap. The always on top property of the form makes it always on top of every window I have open. I'd like it to behave like all the other ArcMap forms do: Only the top most form when they have focus. Always on top of ArcMap. Never on top of other open programs that have focus. Thank you, cdebruin
... View more
12-06-2012
03:32 AM
|
0
|
6
|
5390
|
|
POST
|
It seems I've either found some old code, or I just can't find the right reference. I'm looking to point to the North American Address Locator in VB.NET. I'm using this example: Public Sub OpenAGSLocatorWorkspace()
' Open an ArcGIS Server connection.
Dim propertySet As IPropertySet = New PropertySetClass
propertySet.SetProperty("machine", "mendota")
Dim obj As System.Object = Activator.CreateInstance(Type.GetTypeFromProgID("esriGISClient.AGSServerConnectionFactory"))
Dim agsServerConnectionFactory As IAGSServerConnectionFactory = CType(obj, IAGSServerConnectionFactory)
Dim agsServerConnection As IAGSServerConnection = agsServerConnectionFactory.Open(propertySet, 0)
obj = Activator.CreateInstance(Type.GetTypeFromProgID("esriLocation.LocatorManager"))
Dim locatorManager2 As ILocatorManager2 = CType(obj, ILocatorManager2)
Dim Name As IName = agsServerConnection.FullName
Dim agsServerConnectionName As IAGSServerConnectionName = CType(Name, IAGSServerConnectionName)
Dim locatorWorkspace As ILocatorWorkspace = locatorManager2.GetAGSLocatorWorkspace(agsServerConnectionName)
' Open the AGSLocatorWorkspace
Dim agsLocatorWorkspace As IAGSLocatorWorkspace = CType(locatorWorkspace, IAGSLocatorWorkspace)
End Sub Visual Basic gives me an error of type not defined on all the red objects
... View more
11-19-2012
08:26 AM
|
0
|
0
|
1312
|
|
POST
|
I just found out that the all source code for ArcDesktop tools is available with the DeveloperKit (in both C# and VB.NET). This is the particular file path on my machine: C:\Program Files (x86)\ArcGIS\DeveloperKit10.1\Samples\ArcObjectsNet So I just opened up the 'Find' tool here and I'm working on tweaking it's functionality.
... View more
11-16-2012
09:28 AM
|
0
|
0
|
1312
|
|
POST
|
It works! Thanks Lance, you helped a lot. This Sub takes in 5 parameters, but it should work for anyone looking to populate a combobox from a table with SQL Public Sub LoadTblToCbx(inputTable As ITable, searchField As String, whereClause As String, sortField As String, cbxInput As System.Windows.Forms.ComboBox)
'CJD 11/15/2012 - uses SQL statements to query a geodatabase table and write selective values to a combobox
cbxInput.Items.Clear() 'clear old comboboxitmes
Dim queryFilter As IQueryFilter2 = New QueryFilter 'Create the query filter.
'Select the fields to be returned
queryFilter.SubFields = searchField & "," & sortField
'Set the field to query
queryFilter.WhereClause = whereClause
' Use the PostfixClause to sort ascending
Dim queryFilterDef As IQueryFilterDefinition2 = CType(queryFilter, IQueryFilterDefinition2)
queryFilterDef.PostfixClause = "ORDER BY " & sortField
Dim fieldIndex As Integer = inputTable.FindField(searchField)
Dim cursor As ICursor = inputTable.Search(queryFilter, True)
Dim row As IRow = cursor.NextRow()
While Not row Is Nothing
Dim field As String = Convert.ToString(row.Value(fieldIndex))
cbxInput.Items.Add(field)
row = cursor.NextRow()
End While
Marshal.FinalReleaseComObject(cursor)
End Sub
... View more
11-16-2012
07:51 AM
|
0
|
0
|
564
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 08-03-2012 08:07 AM | |
| 16 | 01-30-2015 11:34 AM | |
| 1 | 10-21-2014 07:41 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-06-2023
09:03 PM
|