POST
|
Thanks for your help Dan, The FeatureClass I am trying to reproject does indeed differ from the projection result. The WKID is contained in the projection file (sToProjectionFile) read by the function: GEOGCS["GCS_GDA_1994",DATUM["D_GDA_1994",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],AUTHORITY["EPSG",4283]] The Lambert coordinates (in metres) are of the order of 9,000,000 4,000,000. The GDA94 coordinates should be lat-long. Viewing the output featureclass in ArcCatalog shows that they are still Lambert coordinates. The input and output featureclasses have the same datum (D_GDA_1994) so no transformation should be necessary. Despite that I tried using IGeometry2 to do the projection with a Null transformation but I got the same result.
... View more
08-10-2015
06:21 PM
|
0
|
2
|
524
|
POST
|
The application is standalone. It takes the featureclass from a file geodatabase. When I look at the resulting featureclass in ArcCatalog it's source tab says Lambert, not GDA94.
... View more
08-08-2015
01:35 AM
|
0
|
4
|
524
|
POST
|
I am trying to reproject a featureclass using the IGeometry.Project method. When I use it to change a featureclass from Lambert to GDA94, nothing changes. I may be making a fundamental error here as the finer points of reprojection have always exited my head after a cup of tea. Can someone tell me what I'm doing wrong? I am using a Windows 7 machine with ArcGIS 10.1. The application is a standalone .exe one. My code is: public static string reProject(string sFromWorkspace, string sFromFC, string sToProjectionFile, ref ToolStripProgressBar pProgress) { // Reproject sFromFC using the projection in file sToProjectionFile string sError = ""; IWorkspaceFactory pFromWSFactory = null; IWorkspace pFromWS = null; IFeatureWorkspace pFromFWS = null; IFeatureClass pFromFC = null; IFeatureCursor pFromFCur = null; IFeature pFromFeat = null; IGeometry pGeom; IQueryFilter pQ; ISpatialReference pSpRef; ISpatialReferenceFactory pSpRefFact = null; bool bProgress = false; int iCount; try { if (File.Exists(sToProjectionFile) == false) { sError = "File: " + sToProjectionFile + " does not exist"; return sError; } bProgress = pProgress != null; // From Workspace pFromWSFactory = workspaceFactoryGet(sFromWorkspace, ref sError); if (sError.Length > 0) { sError = "reProject\r\n" + sError; return sError; } pFromWS = pFromWSFactory.OpenFromFile(sFromWorkspace, 0); pFromFWS = (IFeatureWorkspace)pFromWS; // Spatial reference Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); System.Object obj = Activator.CreateInstance(factoryType); pSpRefFact = obj as ISpatialReferenceFactory; pSpRef = pSpRefFact.CreateESRISpatialReferenceFromPRJFile(sToProjectionFile); // Open the featureclass pFromFC = pFromFWS.OpenFeatureClass(sFromFC); iCount = pFromFC.FeatureCount(null); if (iCount == 0) return sError; if (bProgress == true) { pProgress.Visible = true; pProgress.Maximum = iCount; } iCount = 0; pFromFCur = pFromFC.Update(null, false); pFromFeat = pFromFCur.NextFeature(); while (pFromFeat != null) { pGeom = pFromFeat.ShapeCopy; if (pGeom.IsEmpty == false) { pGeom.Project(pSpRef); pFromFeat.Shape = pGeom; pFromFeat.Store(); } Marshal.ReleaseComObject(pFromFeat); pFromFeat = pFromFCur.NextFeature(); if (bProgress == true) { pProgress.Value = iCount; iCount += 1; } } return sError; } catch (Exception ex) { System.Diagnostics.StackTrace pStack = new System.Diagnostics.StackTrace(ex, true); System.Diagnostics.StackFrame pFrame = pStack.GetFrame(pStack.FrameCount - 1); int iLineNo = pFrame.GetFileLineNumber(); sError = "Error: reProject; Line: " + iLineNo + " \r\n" + ex.Message; return sError; } finally { if (pFromFeat != null) Marshal.ReleaseComObject(pFromFeat); if (pFromFCur != null) Marshal.ReleaseComObject(pFromFCur); if (pFromFC != null) Marshal.ReleaseComObject(pFromFC); if (pFromWSFactory != null) pFromWSFactory = null; if (pFromWS != null) pFromWS = null; if (pFromFWS != null) pFromFWS = null; if (pSpRefFact != null) pSpRefFact = null; if (bProgress == true) pProgress.Visible = false; } } Thanks, John
... View more
08-06-2015
05:22 PM
|
0
|
6
|
3314
|
POST
|
If FME is installed with the 'Associate file types with FME' option ticked, the problem occurs. To fix it uninstall FME and reinstall it with the Associate file types option set to 'No'. John
... View more
08-04-2015
03:57 PM
|
0
|
0
|
418
|
POST
|
The problem is caused by FME. When IGxDialog.DoModalOpen is run, it calls lmutil.exe to obtain an FME license. The problem is that all two of our FME licenses are always in use. The code doesn't have any FME references or Interoperability extension. I uninstalled FME and the problem disappeared. It would be interesting to know why this process happens. John
... View more
08-03-2015
08:04 PM
|
0
|
1
|
418
|
POST
|
I have a standalone ArcGIS Application used for moving data around. It was written vb.NET using Windows XP and ArcGIS 10.0 and has recently been translated to C# on a Windows 7 machine using ArcGIS 10.1. (SP1). Since being translated, the problem I am having is the IGxDialog window takes anything from 5 to 20 minutes to display it's contents and then when the Look in: location in the window is changed, such as choosing a directory, it takes another 10 minutes to refresh the display. The code calling the browse Dialog window is: switch (m_iDataTypeCurrent) { case m_eDataType.FeatureClass: { pGxFilter = new GxFilterFeatureClasses(); sTitle = "Select a FeatureClass"; break; } case m_eDataType.Table: { pGxFilter = new GxFilterTables(); sTitle = "Select a Table"; break; } case m_eDataType.TableOrFeatureClass: { pGxFilter = new GxFilterTablesAndFeatureClasses(); sTitle = "Table or Featureclass"; break; } case m_eDataType.FeatureDataset: { pGxFilter = new GxFilterFeatureDatasets(); sTitle = "Select a Feature Dataset"; break; } case m_eDataType.GeoDatabase: { pGxFilter = new GxFilterGeoDataServersAndWorkspaces(); sTitle = "Select a GeoDatabase"; break; } case m_eDataType.ProjectionFile: { pGxFilter = new GxFilterSpatialReferences(); sTitle = "Select a Spatial Ref"; break; } } pGxDialog = new GxDialogClass(); pGxDialog.AllowMultiSelect = false; pGxDialog.Title = sTitle; pGxDialog.ButtonCaption = "Load"; if (pGxFilter != null) { pGxDialog.ObjectFilter = pGxFilter; } bSelectOK = pGxDialog.DoModalOpen(iHandle, out pEnumGxObj); if (bSelectOK == false) return; pGxObj = pEnumGxObj.Next(); if ((pGxObj == null)) { return; } // Get the item details sName = pGxObj.FullName; sType = pGxObj.Parent.Category.ToUpper(); sClass = pGxObj.Category.ToUpper (); .... etc All the code for browsing is contained in a separate class: namespace NHVR_DataTransfer { class clsEsriData { The handle for DoModalOpen is taken from the calling form using this.Handle but using zero seems to work just as well. My ArcMap and ArcCatalog software don't have the same time lag when browsing data. I tried removing the filter but nothing changed. The time lag seems to be dependent upon the number of objects (directories, files etc) in the directory being browsed so I set the Options in ArcCatalog to be the minimum possible. No change. It appears that the problem has something to do with this being a standalone application. It wasn't a problem with 10.0 but maybe it is with 10.1? Does anyone have an idea of what is causing this? Thanks class clsEsriData {
... View more
07-29-2015
10:33 PM
|
0
|
2
|
3150
|
POST
|
I have a C# Add-In with two combo boxes. The first box contains the Map layer names and the second contains the field names of the layer chosen in the first box. Each combo box has it's own class which I have created using the Add-In wizard in VS 2010. The problem I am having is when the user selects a layer from the layer combo box it triggers the layer combo onSelChange routine but there is no way to access the field combo box's loadFields routine. If the loadFields routine is made static then all the this.Value and this.Add etc cannot be accessed. If an instance of the field combo box is created then it all runs fine but the fields box on the screen is empty. If a static instance of the field and layers combo boxes is used it all runs fine but again, the fields box is empty. My code for the startup button is: // Layer combo
public static comboLayer m_pLayers;
// Fields combo
public static comboField m_pFields;
protected override void OnClick() { // Startup string sError = "";
try { m_pLayers = new comboLayer(); sError = m_pLayers.loadLayers(); if (sError.Length > 0) { sError = "clsFilter.OnClick" + "\r\n" + sError; MessageBox.Show(sError); return; }
m_pFields = new comboField(); } catch (Exception ex) { System.Diagnostics.StackTrace pStack = new System.Diagnostics.StackTrace(ex, true); System.Diagnostics.StackFrame pFrame = pStack.GetFrame(pStack.FrameCount - 1); int iLineNo = pFrame.GetFileLineNumber(); MessageBox.Show("Error: clsFilter.OnClick; Line: " + iLineNo + " \r\n" + ex.Message); }
} That looks awful! Why have all the blank lines been added to the code? What happened to the indentation? My code for the layer OnSelChange: protected override void OnSelChange(int cookie) { string sError; string sLayer; // Reset the fields in the Fields combo try { sError = ""; if (cookie == -1) return;
sLayer = Value; clsFilter.m_sCurrentLayer = sLayer; // Load the fields sError = clsFilter.m_pFields.loadFields(sLayer); if (sError.Length > 0) { sError = "OnSelChange;" + "\r\n" + sError; MessageBox.Show(sError); }
base.OnSelChange(cookie); } catch (Exception ex) { System.Diagnostics.StackTrace pStack = new System.Diagnostics.StackTrace(ex, true); System.Diagnostics.StackFrame pFrame = pStack.GetFrame(pStack.FrameCount - 1); int iLineNo = pFrame.GetFileLineNumber(); sError = "Error: OnSelChange; Line: " + iLineNo + " \r\n" + ex.Message; }
} I have a suspicion that I'm not doing any of this correctly (otherwise I would have found an answer in the forum). I'm probably not putting the code in correctly either but I can't find a Help document for writing forum entries. Thanks, John
... View more
06-03-2015
05:16 PM
|
0
|
0
|
3153
|
POST
|
I read that document and like Allan I couldn't get it to work. My successful effort was the sub below. I have used it to add images to the flags on the Sydney Harbour Bridge and the Anzac Bridge in Sydney. Sorry for the line nos, I forgot to strip them out. Private Sub tileComponentGeometry(ByVal sLayer As String, ByVal sOID As String, _ ByVal sTextureFile As String, ByVal sGeomNo As String, _ ByRef sError As String, ByRef sMsg As String, ByVal sXfreq As String, _ ByVal sYfreq As String) ' Add an image to a component geometry. The image is tiled Xfreq x Yfreq across the geometry. ' sOID can only refer to one component. The image is in the texture file. 1: Using pComReleaser As New ESRI.ArcGIS.ADF.ComReleaser 2: Dim pColour As IRgbColor 3: Dim iColourNo As Integer 4: Dim pFeat As IFeature 5: Dim pFC As IFeatureClass 6: Dim pPtColl As IPointCollection4 7: Dim iOID As Integer 8: Dim pGeom As IGeometry 9: Dim bGeomProgress As Boolean 10: Dim pPt1 As ESRI.ArcGIS.Geometry.IPoint 11: Dim pWKSPt As WKSPoint 12: Dim pZAware As IZAware 13: Dim pExGeomCol As IGeometryCollection 14: Dim pExMultiPatch As IMultiPatch 15: Dim pNewGeomPatchCreator As IGeneralMultiPatchCreator 16: Dim pGenInfo As IGeneralMultiPatchInfo 17: Dim pMat As IGeometryMaterial 18: Dim pMatList As IGeometryMaterialList 19: Dim i As Integer 20: Dim iPatchType As ESRI.ArcGIS.Geometry.esriPatchType 21: Dim j As Integer 22: Dim k As Integer 23: Dim n As Integer 24: Dim iVertices As Integer 25: Dim pNewMultiPatch As IMultiPatch 26: Dim pSpatialRef As ISpatialReference 27: Dim sFldOID As String 28: Dim bWhere As Boolean = True 29: Dim iGeomCount As Integer 30: Dim iGeomNo As Integer 31: Dim iPatchCount As Integer 32: Dim iAction As m_eTextureAction = m_iTextureAction 33: Dim iVertexCount As Integer 34: Dim s As String = "s" 35: Dim pColTextureFiles As New StringCollection 36: Dim sTempTextureFile As String 37: Dim iFileIndex As Short = 0 38: Dim dTransparency As Double ' 0 to 1 39: Dim sFileDir As String = My.Application.Info.DirectoryPath 40: Dim pExMultiPatchCopy As IMultiPatch 41: Dim iNewTexture As Short 42: Dim hPatchMatII As New Hashtable ' Patch index and it's material index 43: Dim hTexturePts As New Hashtable ' Point index + texture pt 44: Dim hExistingTexturesII As New Hashtable ' Material No + nothing 45: Dim iPriority As Integer 46: Dim iGeomMatIndex As Integer ' The material index of iGeomNo 47: Dim bAssigned As Boolean = False ' Set to True if the texture is overwriting an existing texture 49: Dim iXfreq As Short 50: Dim iYfreq As Short 51: Dim iX As Short 52: Dim iY As Short 53: Dim iTotTextureVertexCount As Integer 54: Dim iTextureVertexCount As Integer 55: Dim iTexture As Integer 56: Try 57: sError = "" 58: sMsg = "" ' Only one component can be changed and at least one geometry must be specified. 59: If String.IsNullOrEmpty(sOID) OrElse IsNumeric(sOID) = False Then 60: sError = "One (and only one) Component must be chosen" 61: Exit Sub 62: End If ' Set the OID 63: iOID = CInt(sOID) 64: If String.IsNullOrEmpty(sGeomNo) OrElse IsNumeric(sGeomNo) = False Then 65: sError = "At least one Geometry must be chosen as a Geometry Number" 66: Exit Sub 67: End If ' Geometry No 68: iGeomNo = CInt(sGeomNo) ' X and Y frequency 69: If String.IsNullOrEmpty(sXfreq) Or String.IsNullOrEmpty(sYfreq) Then 70: sError = "A Row and Column tile frequency is missing" 71: Exit Sub 72: End If 73: If IsNumeric(sXfreq) = False Or IsNumeric(sYfreq) = False Then 74: sError = "The Row or Column tile frequency is not a number" 75: Exit Sub 76: End If 77: iXfreq = CInt(sXfreq) 78: iYfreq = CInt(sYfreq) ' Spatial Reference 79: pSpatialRef = m_pSxDoc.Scene.SpatialReference ' Layer FeatureClass 80: Call getLayerFC(sLayer, pFC, sError, m_hLayers) 81: If sError.Length > 0 Then 82: sError = "cmdLayerReColour;" & vbCrLf & sError 83: MsgBox(sError) 84: If g_bLogging = True Then g_wLog.WriteLine(Format(Now, "hh:mm:ss") & " " & sError) 85: Exit Sub 86: End If 87: pComReleaser.ManageLifetime(pFC) 88: sFldOID = pFC.OIDFieldName ' Get the geometries that make up the component and copy them with the ' old or the new colour/texture. Note that you cannot update these values in the ' existing multipatches. 89: pFeat = pFC.GetFeature(iOID) 90: StatusLabel1.Text = iOID.ToString 91: StatusStrip1.Refresh() 92: If pFeat.ShapeCopy.IsEmpty Then 93: sError = "EMPTY SHAPE" 94: sMsg = "Shape is empty for feature; OID = " & sOID 95: Exit Sub 96: End If 97: bGeomProgress = False 98: pExGeomCol = CType(pFeat.ShapeCopy, IGeometryCollection) ' Decide if a progressbar of geometry is required 99: iGeomCount = pExGeomCol.GeometryCount 100: If iGeomCount > MAX_GEOM_COUNT_IGNORE Then 101: bGeomProgress = True 102: ProgressBar1.Value = 0 103: ProgressBar1.Maximum = iGeomCount 104: End If ' Get the existing Multipatch and it's info 105: pExMultiPatch = CType(pFeat.ShapeCopy, IMultiPatch) ' Make a copy 106: Dim objectCopy As IObjectCopy = New ObjectCopyClass() 107: Dim obj As Object = objectCopy.Copy(CObj(pExMultiPatch)) 108: pExMultiPatchCopy = CType(obj, IMultiPatch) 109: pComReleaser.ManageLifetime(pExMultiPatchCopy) 110: pGenInfo = pExMultiPatchCopy ' Get the relationship between the patches (geometries) and the materials ' and the material index of the chosen geometry 111: iTotTextureVertexCount = 0 ' The existing total texture vertex count. If the new tiles replace ' ' an existing texture then the count from that texture is omitted. 112: For i = 0 To pGenInfo.PatchCount - 1 113: j = pGenInfo.PatchMaterialIndex(i) 114: hPatchMatII.Add(i, j) 115: If i = iGeomNo Then 116: iGeomMatIndex = j 117: iTotTextureVertexCount += (iXfreq * iYfreq) + 4 ' Add top left + bottom rt texture pts 118: ElseIf pGenInfo.IsMaterialTextured(j) = True Then 119: iTotTextureVertexCount += pGenInfo.PatchTextureVertexCount(i) 120: End If 121: Next i ' MultiPatch Info 122: iVertices = pGenInfo.VertexCount 123: iPatchCount = pGenInfo.PatchCount ' Create the new materials as a copy of the existing ones 124: pMatList = New GeometryMaterialListClass 125: For i = 0 To pGenInfo.MaterialCount - 1 126: pMat = New GeometryMaterial 127: If i = iGeomMatIndex And pGenInfo.IsMaterialTextured(i) = True Then ' Replace the old with the new texture - no colour 128: pMat.TextureImage = sTextureFile 129: iNewTexture = i 130: bAssigned = True 131: Else ' Existing Texture ' Colour 132: iColourNo = pGenInfo.MaterialColor(i) 133: pColour = New RgbColor 134: pColour.RGB = iColourNo 135: pMat.Color = pColour 136: If pGenInfo.IsMaterialTextured(i) = True Then 137: hExistingTexturesII.Add(i, i) ' Save an image of the texture 138: sTempTextureFile = sFileDir & "\" & TEXTURE_TEMP_FILE & iFileIndex.ToString & ".jpg" 139: If IO.File.Exists(sTempTextureFile) Then 140: IO.File.Delete(sTempTextureFile) 141: End If 142: StatusLabel1.Text = "OID " & sOID & " reading Texture No " & i.ToString 143: StatusStrip1.Refresh() 144: Call textureImageCreate(pGenInfo, i, sTempTextureFile, sError) 145: If sError.Length > 0 Then 146: sError = "tileComponentGeometry;" & vbCrLf & sError 147: Exit Sub 148: End If ' Add the file to the list so it can be deleted later 149: pColTextureFiles.Add(sTempTextureFile) 150: pMat.TextureImage = sTempTextureFile 151: iFileIndex += 1 152: End If ' Transparency 153: dTransparency = pGenInfo.MaterialTransparencyPercent(i) 154: pMat.Transparency = dTransparency / 100 155: End If 156: pMatList.AddMaterial(pMat) 157: Next i 158: If bAssigned = False Then ' Add the new material to the material list - no colour 159: iNewTexture = pMatList.Count 160: pMat = New GeometryMaterial ' New texture 161: pMat.TextureImage = sTextureFile 162: pMatList.AddMaterial(pMat) 163: End If ' Start the MultiPatch creator for the geometry copy 164: pNewGeomPatchCreator = New GeneralMultiPatchCreatorClass 165: pNewGeomPatchCreator.Init(iVertices, iGeomCount, False, False, False, iTotTextureVertexCount, pMatList) ' Set the patch types, points, materials and start points for vertices and textures 166: k = 0 ' Vertex 167: n = 0 ' Vertex 168: iTexture = 0 ' Vertex 169: For i = 0 To iGeomCount - 1 170: iPatchType = pGenInfo.PatchType(i) 171: iVertexCount = pGenInfo.PatchVertexCount(i) 172: iTextureVertexCount = pGenInfo.PatchTextureVertexCount(i) ' Patch Type 173: pNewGeomPatchCreator.SetPatchType(i, iPatchType) ' Patch No set start of next patch 174: pNewGeomPatchCreator.SetPatchPointIndex(i, k) ' Patch Material 175: If i = iGeomNo Then 176: pNewGeomPatchCreator.SetMaterialIndex(i, iNewTexture) 177: Else 178: pNewGeomPatchCreator.SetMaterialIndex(i, hPatchMatII(i)) 179: End If ' Patch priority 180: iPriority = pGenInfo.PatchPriority(i) 181: pNewGeomPatchCreator.SetPatchPriority(i, iPriority) ' Texture point indexes 'pNewGeomPatchCreator.SetPatchTexturePointIndex(i, n) ' Set the texture vertex pts 182: If i = iGeomNo Then 183: pNewGeomPatchCreator.SetPatchTexturePointIndex(i, iTexture) '' Set the top left and bottom right texture pts 'pWKSPt = New WKSPoint 'pWKSPt.X = 0 'pWKSPt.Y = iYfreq 'pNewGeomPatchCreator.SetTextureWKSPoint(iTexture, pWKSPt) 'iTexture += 1 'pWKSPt = New WKSPoint 'pWKSPt.X = iXfreq 'pWKSPt.Y = 0 'pNewGeomPatchCreator.SetTextureWKSPoint(iTexture, pWKSPt) 'iTexture += 1 ' Left 184: For iY = 0 To iYfreq 185: pWKSPt = New WKSPoint 186: pWKSPt.X = 0 187: pWKSPt.Y = iY 188: pNewGeomPatchCreator.SetTextureWKSPoint(iTexture, pWKSPt) 189: iTexture += 1 190: Next iY ' Top 191: For iX = 0 To iXfreq 192: pWKSPt = New WKSPoint 193: pWKSPt.X = iX 194: pWKSPt.Y = iY 195: pNewGeomPatchCreator.SetTextureWKSPoint(iTexture, pWKSPt) 196: iTexture += 1 197: Next iX ' Right 198: For iY = iYfreq To 0 Step -1 199: pWKSPt = New WKSPoint 200: pWKSPt.X = iX 201: pWKSPt.Y = iY 202: pNewGeomPatchCreator.SetTextureWKSPoint(iTexture, pWKSPt) 203: iTexture += 1 204: Next iY ' Bottom 205: For iX = iXfreq To 0 Step -1 206: pWKSPt = New WKSPoint 207: pWKSPt.X = iX 208: pWKSPt.Y = iY 209: pNewGeomPatchCreator.SetTextureWKSPoint(iTexture, pWKSPt) 210: iTexture += 1 211: Next iX 212: ElseIf hExistingTexturesII.ContainsKey(pGenInfo.PatchMaterialIndex(i)) Then 213: pNewGeomPatchCreator.SetPatchTexturePointIndex(i, iTexture) ' This geometry has an existing texture. Reallocate the points 214: For j = 0 To pGenInfo.PatchTextureVertexCount(i) - 1 215: pWKSPt = New WKSPoint 216: pWKSPt = pGenInfo.PatchTextureVertex(i, j) ' Add this point 217: pNewGeomPatchCreator.SetTextureWKSPoint(iTexture, pWKSPt) 218: iTexture += 1 219: Next j 220: End If ' ***** Set the geometry points *****' ' Point collection type 221: iPatchType = pGenInfo.PatchType(i) 222: Select Case iPatchType Case esriPatchType.esriPatchTypeTriangleStrip 223: pPtColl = New TriangleStripClass 224: Case esriPatchType.esriPatchTypeTriangleFan 225: pPtColl = New TriangleFanClass 226: Case esriPatchType.esriPatchTypeTriangles 227: pPtColl = New TrianglesClass 228: Case Else 229: pPtColl = New RingClass 230: End Select 231: pGeom = pExGeomCol.Geometry(i) 232: pPtColl = CType(pGeom, IPointCollection4) 233: For j = 0 To pPtColl.PointCount - 1 234: pPt1 = New ESRI.ArcGIS.Geometry.Point 235: pZAware = pPt1 236: pZAware.ZAware = True 237: pPt1 = pPtColl.Point(j) 238: pNewGeomPatchCreator.SetPoint(n, pPt1) ' Texture 'pNewGeomPatchCreator.SetTexturePoint(n, pPt1) 239: n += 1 240: Next j 241: If bGeomProgress = True Then ProgressBar1.Value = i ' User hits stop button 242: System.Windows.Forms.Application.DoEvents() 243: If m_bStop = True Then 244: sMsg = "Aborted by user" 245: Exit Sub 246: End If 'pNewGeomPatchCreator.SetPatchTexturePointIndex(i, k) 247: k += iVertexCount 248: Next i 249: pNewMultiPatch = New MultiPatch 250: pNewMultiPatch.SpatialReference = pSpatialRef 251: pNewMultiPatch = pNewGeomPatchCreator.CreateMultiPatch 252: pFeat.Shape = pNewMultiPatch 253: pFeat.Store() 254: pNewGeomPatchCreator.ClearResources() 255: Marshal.ReleaseComObject(pFeat) 256: Marshal.ReleaseComObject(pExMultiPatch) 257: Marshal.ReleaseComObject(pNewMultiPatch) 258: Catch ex As Exception 259: sError = "ERROR: tileComponentGeometry; Line: " & Erl() & vbCrLf & "Layer " & sLayer & " OID = " & iOID & vbCrLf & ex.ToString 260: Finally 261: ProgressBar1.Visible = False ' Delete the texture files 262: If pColTextureFiles.Count > 0 Then 263: For Each sTempTextureFile In pColTextureFiles 264: Try 265: IO.File.Delete(sTempTextureFile) 266: Catch ex As Exception 267: If g_bLogging = True Then g_wLog.WriteLine(Format(Now, "hh:mm:ss") & " Error deleting file: " & sTempTextureFile & " " & ex.Message) 268: End Try 269: Next sTempTextureFile 270: End If 271: End Try 272: End Using End Sub
... View more
11-15-2014
01:41 AM
|
0
|
1
|
398
|
POST
|
Hi SIrish, Sorry for the delay on this. The point collection of the multipatch can be found by creating a new IPointCollection4 and then looping through the geometries and typing each geometry to the pointcollection. for (int i = 0; i < multiPatchGeometryCollection.GeometryCount; i++) { //here i want to know each geomteries Triangles count and it vertices pPtColl = new Ring; pGeom = multiPatchGeometryCollection.Geometry(i); pPtColl = (IPointCollection4)pGeom; // Cycle through the points pPtColl }
... View more
11-15-2014
01:05 AM
|
0
|
1
|
325
|
POST
|
I am using ArcGIS 10.0 SP5 and Windows XP. I have had the experience where transferring a set of rows using IRowBuffer from a table in a MemoryWorkspace to an identical table in a File Geodatabase caused fields with NULL values to be 'left out'. All the field values after the field with a NULL value were shifted to the left. The resulting FGDB table ended up with a single character text field containing a 40 character value. Nothing crashed and no exceptions were created! The last (text) field in the row had a piece (about 15 characters) of the second-last field inserted in it. If I changed the fields with NULL values to have a value then everything copied ok from the memory table to the FGDB table. If I did the same copy (with NULL values) using IRow and assigning the field values individually then it all worked ok. If I did the same copy using IRowBuffer but without the memory table (eg copied from the source of the memory table) then it all worked. The only solution I could find for this problem is not to use IRowBuffer when copying from a table in a MemoryWorkspace. JM
... View more
12-10-2013
05:46 PM
|
0
|
0
|
311
|
POST
|
Yes! That was it. The arcgisscripting shouldn't be capitalised. Thanks
... View more
04-17-2013
08:30 PM
|
0
|
0
|
299
|
POST
|
I am trying to repair a Python script that has thrown the error: <type 'exceptions.TypeError'>: exceptions must be classes, instances, or strings (deprecated), not unicode The part of the code it is referring to is for upload in uploads: try: process(upload,method,doforcenow) except Arcgisscripting.ExecuteError: #<< Line where error is reported msgs = gp.GetMessage(0) msgs += gp.GetMessages(2) gp.AddError(msgs) logMsg("\tError: "+ msgs) errorOccurred(True) pass except: # Get the traceback object tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] pymsg = tbinfo + "\n" + str(sys.exc_type)+ ": " + str(sys.exc_value) gp.AddError(pymsg) logMsg("\tError: " +pymsg) pass The Python version is 2.5 and it is using ESRI v9.3.1 SP1. I found a web page that had the Arcgisscripting.ExecuteError part of the exception single quoted. That didn't work. It simply reported that the exception couldn't be handled. Can anyone tell me how to fix this error? Thanks
... View more
04-16-2013
05:03 PM
|
0
|
2
|
457
|
POST
|
I have an ArcScene document which was created using an FME translation of an AutoCad 3D drawing. The arrangement of the geometries is awful - there are triangles which touch and are in the same plane but have been placed in different geometries. I am using Ctype(pFeature.ShapeCopy, IGeometryCollection) to break up the multipatch. I would like to be able to break the multipatch into it's individual triangles and reassemble them in some kind of logical order. If I break it into it's geometries then most of them contain more than one triangle. Can anyone tell me how I can break the geometries into their individual triangles? Thanks, NavJohn
... View more
02-06-2013
04:43 PM
|
0
|
5
|
4301
|
Title | Kudos | Posted |
---|---|---|
1 | 02-13-2024 05:18 PM | |
1 | 02-12-2024 07:06 PM |
Online Status |
Offline
|
Date Last Visited |
02-13-2024
11:00 PM
|