POST
|
I've recently upgraded from 9.3.1 to 10.1 SP1. We had a lot of pretty complex VBA code infused MXDs. So I went about trying to convert them to VB.NET Add-Ins and had a lot of problems, probably because I'm not developer, just an analyst and novice developer. So with the enterprise wide upgrade deadline approaching we decided to make use of the VBA licenesing option in 10.1. You do get access to the VBA editor. Some of our old VBA MXDs work fine while others fail on some odd and seemingly minor issues. For example, loading a list box with attribute names from one of the layers in the TOC fails, but if you step through it while debugging that part works only to fail later at a call to IMxDoc.PageLayout.Page. My confusion and what I believe is one of the critical issues when they say "unsupported" is that without the SDK, the intelli-sense doesn't bring up the 10.1 ArcObjects, but the 9.3.1 ones it was built with. the VB.NET API help says IPageLayout interface is now superseded with IPageLayout3, but that's not accessible through the intelli-sense so I'm not sure if I can use it in the VBA environment or if it's just not accessible due to the lack of support. This is probably another example of something that would be a mole hill for an experienced developer, but for many of us analyst turned jack of all trades types it's a bit daunting. My biggest disappointment with the transition process is the lack of literature out there for converting VBA into VB.NET Add-Ins. There's a few, but they're relatively limited. The link below is to one of the better guides I've found. It sketches out the basics but I'd be great find another more involved example out there: http://www.esri.com/news/arcuser/0311/recycling-vba.html Hope this was of some help, Claiborn
... View more
03-14-2013
07:11 AM
|
0
|
0
|
885
|
POST
|
I just realized I had some more information to add to this issue. It seems to run one iteration: the creation of a feature layer and applying the field values to the target layer, but it only works once and it�??s incorrect. It applies the wrong precinct info to a completely different precinct. I still don�??t understand why this same statement, updated to 2.7.2 as best I could, doesn�??t work.
... View more
02-08-2013
05:03 AM
|
0
|
0
|
179
|
POST
|
I???m converting a geoprocessing Python v2.5 script we used for years with ArcGIS 9.3.1 into a v2.7.2 to work with ArcGIS 10.1. The script is pretty long, and basically just runs relatively simple location selections on a series of different layers and our parcel layer (and a derived center point layer of those same parcels) and calculates values in the parcel layers based on whether or not they intersect. The part I???m stuck on is a short cut that worked fine in the previous version but is failing for some reason in the new version. The intent with this line is to create a feature class for each record in the voting districts layer. This layer has three different fields I???ll need to apply to my parcel points. It???s not an excessive amount of records; only 13 so that shouldn???t be the issue, plus the fact that it worked fine in 9.3.1 and on older PCs for years. I???ve included the rest of the code below, but I believe the line that???s generating the error is this, where it???s supposed to create a feature layer per each record, via their ObjectID: arcpy.MakeFeatureLayer_management("BOSElectLayer", "ElectionSelection", "\"OBJECTID\" = " + str(ObjectID)) Now, given that???s out of context, and you???ll have to either believe me or check the code below that there???s no major logical error, or misspelled variable, I think I???ve failed to replace some v2.5 operator or syntax with something new in v2.7.2. I???ve tested it line by line in ArcCatalog???s Python Command Line (making the appropriate changes) and it repeatedly hits an error here. But when it does error, it must be running through all the rows because it???s in a ???try??? group and for the ???except??? I used ???print(???BOS Election Feature Layer Creation Failed???) and it seems to print that line multiple times, possibly because it???s in an endless loop, but I???m not sure why. Again, this is intended to be a stand alone script. While it???s just one small part of the entire script, I???ve already tested all preceding parts; this is the first I have not been able to resolve. Here's the code (not that it's just an excerpt, but I've included all critical lines from previous sections):
# previous line where "AddrPtLayer" is generated in a try group:
arcpy.MakeFeatureLayer_management("Z:\\Custom_Apps\\WEBGIS\\TESTWEBGIS_10.1.gdb\\ParcelPoints", "AddrPtLayer")
#/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
#GET BOS ELECTION DISTRICT INFORMATION
try:
#Get election district layer
arcpy.MakeFeatureLayer_management("Database Connections\\gis_viewer@york.sde\\york.GISADMIN.BoundaryandGovernment\\york.GISADMIN.VotingDistricts", "BOSElectLayer")
#Create a search cursor for the election districts
ElecRows = arcpy.SearchCursor("BOSElectLayer")
#Loop through each election district polygon and calculate parcel polygon attributes accordingly
while ElecRecord:
#Select the current election district record
ObjectID = ElecRecord.getValue("OBJECTID")
try:
arcpy.MakeFeatureLayer_management("BOSElectLayer", "ElectionSelection", "\"OBJECTID\" = " + str(ObjectID)) #appears to be the problem line
except:
log.write("BOS Election Feature Layer Creation Failed")
log.write(arcpy.GetMessages(2) + "\n")
#Get values from selected election polygon
try:
Precinct = ElecRecord.getValue("PRECINCT")
PollName = ElecRecord.getValue("POLLNAME")
District = ElecRecord.getValue("DISTR")
except:
log.write("BOS Field Value Variables Faild")
log.write(arcpy.GetMessages(2) + "\n")
#Select Parcel Points that intersect with the selected election polygon
try:
arcpy.SelectLayerByLocation_management("AddrPtLayer", "INTERSECT", "ElectionSelection", "#", "NEW_SELECTION")
except:
log.write("BOS Location Selection Faild")
log.write(arcpy.GetMessages(2) + "\n")
#Calculate parcel polygon fields according to respective election polygon
try:
arcpy.CalculateField_management("AddrPtLayer", "Precinct", '"' + Precinct + '"')
arcpy.CalculateField_management("AddrPtLayer", "poll", '"' + PollName + '"')
arcpy.CalculateField_management("AddrPtLayer", "supdistr", District)
except:
log.write("BOS Field Calculations Faild")
log.write(arcpy.GetMessages(2) + "\n")
arcpy.SelectLayerByAttribute_management("AddrPtLayer", "CLEAR_SELECTION")
ElecRecord = ElecRows.next()
except:
log.write ("BOS Election District attribution failed!" + "\n")
log.write (arcpy.GetMessages(2) + "\n")
#/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
... View more
02-07-2013
10:36 AM
|
0
|
1
|
302
|
POST
|
Thanks for clearing that up for me. One more follow-up question for you if I may. If I decide to stick with the VS2008 configuration, can I incorporate Visual Web Developer 2008 Express (the free version) and still make use of ESRI�??s tools for web mapping services, or do I have to purchase the professional version of Web Developer? I assume the answer to that question will be the same for the VS2010 + Visual Web Dev 2010. Thanks again for your help,
... View more
01-21-2011
05:51 AM
|
0
|
0
|
160
|
POST
|
These maybe grossly elementary questions but I have to ask as I haven???t been about to find clear answers anywhere else; I???m using ArcGIS Server 9.3.1 and Visual Studio 2008; what version of Silverlight do I install? From everything I???ve read version 4 is setup for VS 2010, not VS 2008. I have Visual Studio on my PC which also has ArcGIS Desktop, but our ArcGIS Server is located on the server machine, will I need to install Visual Studio there in order to develop web application, or can I deploy the finished site to the server???s IIS when complete?
... View more
01-20-2011
07:13 AM
|
0
|
2
|
630
|
POST
|
Our GIS group (consisting of a manager, analyst and technician) has a VB.NET *.exe that connects to our SDE, gets all the current Versions, reconciles them to the sde.Default version, then writes some simple text to a *.txt file. This *.exe has worked since we were in 9.1 and still works on 9.3.1 (with the 9.3.1 License Initialize addition), however, our manager recently had her PC upgraded to run Window�??s 7 OS. She has all the proper .NET framework installed and has no other issues with our other applications (VB.NET *.dll�??s, VBA, models and Python scripts). We have tried using the �??run as admin�?� option but that does not work. The error message she gets is: Description: Stopped working Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: reconcile.exe Problem Signature 02: 1.0.3505.12428 Problem Signature 03: 4a7ac60c Problem Signature 04: Reconcile Problem Signature 05: 1.0.3505.12428 Problem Signature 06: 4a7ac60c Problem Signature 07: 1c Problem Signature 08: 2 Problem Signature 09: PSZQOADHX1U5ZAHBHOHGHLDGIY4QIXHX OS Version: 6.1.7600.2.0.0.256.48 Locale ID: 1033 I have researched the Event name an only come up with one similar issue. The resolution was simply to rebuild the project with the most current Visual Studio (2008 in our case) and compile. We did this but it did not work. We have considered loading VS2008 on to the manager�??s machine and rebuilding the exe but were interested if there are any other possible settings or code issues that are causing the misfire. I have also included the main logic of the exe attached as a zipped *.vb and bleow. Any help or insight is appreciated. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Imports ESRI.ArcGIS.ArcMapUI Imports ESRI.ArcGIS.Framework Imports ESRI.ArcGIS.Catalog Imports ESRI.ArcGIS.CatalogUI Imports ESRI.ArcGIS.Geodatabase Imports ESRI.ArcGIS.esriSystem Imports ESRI.ArcGIS.DataSourcesGDB Imports System.IO Public Class Form1 Inherits System.Windows.Forms.Form <Windows Form Designer generated code> Public Sub GetVersions() Dim pSDEWorkspace As IWorkspace Dim pVersionedWorkspace As IVersionedWorkspace Dim pConnectionProperties As IPropertySet Dim pWorkspaceFactory As IWorkspaceFactory Dim pVersionInfo As IVersionInfo Dim pEnumVersionInfo As IEnumVersionInfo 'Open a textfile to write any error that occur during reconciliation Dim FileName As String FileName = "Z:\Admin\ReconcileLog.txt" Dim fs As New System.IO.FileStream(FileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.None) Dim sw As New System.IO.StreamWriter(fs) sw.BaseStream.Seek(0, System.IO.SeekOrigin.End) sw.WriteLine(Now) 'Connect to SDE pConnectionProperties = New PropertySet With pConnectionProperties .SetProperty("Server", "gis2") .SetProperty("Instance", "5151") .SetProperty("User", "gisadmin") .SetProperty("Password", "vector^5") .SetProperty("Version", "sde.DEFAULT") End With pWorkspaceFactory = New SdeWorkspaceFactory pSDEWorkspace = pWorkspaceFactory.Open(pConnectionProperties, 0) 'Get versions pVersionedWorkspace = pSDEWorkspace pVersionInfo = pVersionedWorkspace.DefaultVersion.VersionInfo pEnumVersionInfo = pVersionInfo.Children pVersionInfo = pEnumVersionInfo.Next Do Until pVersionInfo Is Nothing 'If pVersionInfo.VersionName = "PETERSS.peterss" Then ReconcileIt(pVersionInfo, pVersionedWorkspace, sw) 'End If pVersionInfo = pEnumVersionInfo.Next Loop sw.WriteLine("Reconcile Process Finished: " & Now) sw.WriteLine(vbNewLine) sw.Flush() sw.Close() fs.Close() 'Clean up pSDEWorkspace = Nothing pVersionedWorkspace = Nothing pConnectionProperties = Nothing pWorkspaceFactory = Nothing pVersionInfo = Nothing pEnumVersionInfo = Nothing FileName = Nothing sw = Nothing fs = Nothing Close() End Sub Private Sub ReconcileIt(ByVal pVersionInfo As IVersionInfo, ByVal pVersionedWorkspace As IVersionedWorkspace, ByVal sw As System.IO.StreamWriter) Dim pVersionEdit As IVersionEdit Dim pVersion As IVersion pVersionEdit = pVersionedWorkspace.FindVersion(pVersionInfo.VersionName) pVersion = pVersionEdit 'Check to see if version is locked If IsLocked(pVersionEdit, sw) Then sw.WriteLine(pVersion.VersionName & " can not be reconciled because it is in use by another user.") Else 'Reconcile the version to sde.DEFAULT StartEditing(pVersionEdit) On Error GoTo AbortOperation pVersionEdit.Reconcile("sde.DEFAULT") StopEditing(pVersionEdit, True) sw.WriteLine(pVersion.VersionName & " has been reconciled.") End If 'Clean up pVersionEdit = Nothing pVersion = Nothing Exit Sub AbortOperation: StopEditing(pVersionEdit, False) sw.WriteLine("Error in ReoncileIt: " & Err.Description) End Sub Private Function IsLocked(ByVal pVersion As IVersion, ByVal sw As System.IO.StreamWriter) As Boolean 'Helper Function to determine if versioned is locked by another user On Error GoTo ErrorHandler Dim pEnumLockInfo As IEnumLockInfo Dim pLockInfo As ILockInfo pEnumLockInfo = pVersion.VersionLocks pLockInfo = pEnumLockInfo.Next Do Until pLockInfo Is Nothing sw.WriteLine(pVersion.VersionName & " is in use by " & pLockInfo.UserName) pLockInfo = pEnumLockInfo.Next IsLocked = True Loop 'Clean up pEnumLockInfo = Nothing pLockInfo = Nothing Exit Function ErrorHandler: IsLocked = True sw.WriteLine("IsLocked: " & Err.Description) End Function Private Sub StartEditing(ByVal pWorkspaceEdit As IWorkspaceEdit) 'Helper Function to start editing pWorkspaceEdit.StartEditing(False) pWorkspaceEdit.StartEditOperation() End Sub Private Sub StopEditing(ByVal pWorkspaceEdit As IWorkspaceEdit, ByVal bSave As Boolean) 'Helper Funciton to stop editing If bSave Then pWorkspaceEdit.StopEditOperation() pWorkspaceEdit.StopEditing(True) Else pWorkspaceEdit.AbortEditOperation() pWorkspaceEdit.StopEditing(False) End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load GetVersions() End Sub End Class
... View more
07-29-2010
07:07 AM
|
0
|
0
|
603
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|