|
POST
|
Dawn, ESRI have been messing around behind the scenes again... Use this instead: Set pCommandBar = pCommandBars.Find(arcid.EditingToolbarNew) Duncan
... View more
01-29-2013
11:32 AM
|
0
|
0
|
851
|
|
POST
|
All, OK I have a folder and I want to insert a keyword into all the datasets metadata without overwriting any existing metadata. I've looked at this page in help and got it working but I discovered that it blitzes any existing metadata which is not good :(. So I looked at this page which appears to be the solution but using nightmare XLST style sheets. Now I'm the first person to put their hand up for feeling very much a fish out of water. I had a good look at their sample XLST style sheet which gives an example of search and replace of contact details. I'm not at all familiar with this sort of thing so needless to say my botched attempted failed when I ran the import metadata tool, strangely it did not give an error. I took their sample XLST style sheet and tried to adapt it but it does not work, can any metadata guru out there have a look and tell me what I did wrong? I'm guessing its failing on matching dataIDInfo or have I missed something? Duncan <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no" />
<!-- process the metadata using the templates below -->
<xsl:template match="/">
<xsl:apply-templates select="node() | @*" />
</xsl:template>
<!-- copy all metadata conent -->
<xsl:template match="node() | @*" priority="0">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
<!-- all metadata XSLT stylesheets used to update metadata should be identical to this example up to this point -->
<!-- add the templates you'll use to update the metadata below -->
<!-- Insert a place name keyword -->
<xsl:template match="dataIdInfo" priority="1" >
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
<placeKeys>
<keyword>Pakistan</keyword>
</placeKeys>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
... View more
01-29-2013
07:12 AM
|
0
|
0
|
2377
|
|
POST
|
Bruce,You can do this easily you just call the appropriate method on the application object. So the first thing you need to do is search the help file for Excel and you will discover all the functions you need. I don't have them at hand as I am accessing this forum from a tablet...
... View more
01-27-2013
01:59 AM
|
0
|
0
|
1436
|
|
POST
|
Bruce, You use automation to open and drive Excel from ArcMap in VBA, below is some code to get you going: ' Create some Excel objects Dim EXCELApplication As Object Dim aWorkBook As Object Dim theSheets As Object Dim aSheet As Object ' Start Excel Application and create Workbook Set EXCELApplication = CreateObject("Excel.Application") If EXCELApplication Is Nothing Then Exit Sub End If With EXCELApplication .Visible = True .SheetsInNewWorkbook = 2 .DisplayStatusBar = True .StatusBar = "Please be patient, transfer in progress, Excel will minimise when completed..." .Workbooks.Add Set aWorkBook = .Workbooks(1) End With With aWorkBook .Title = "Sites Downstream of input site" .Subject = "List of downstream sites" .Comments = "This Excel file contains a list of all sites downstream of the sites in the input layer." End With ' Initialise worksheets Set theSheets = aWorkBook.Sheets theSheets.Item(1).Name = "Downstream sites" ' Blah blah blah Duncan
... View more
01-26-2013
04:53 AM
|
0
|
0
|
1436
|
|
POST
|
Roland, I know in 10.1 the legend is now capable of dropping items from its display when there are no features from that layer in the current extent, its some option you need to tick on when in legend properties mode. It seems to be accessible from the IDynamicLegendItem Interface. One idea is to associate a graphics layer to the visibility of a layer have a look at the IGraphicsLayer Interface. Never used it so don't know if I'm suggesting a red herring! Duncan
... View more
01-25-2013
08:09 AM
|
0
|
0
|
811
|
|
POST
|
What sort of collection are you talking about? Is it a collection, arraylist, dictionary or hashtable? Either way you still need to build a cursor over the table and cycle through it copying the data into your collection object. There are many examples on the forum and in help that can give you coded samples. Search for IFeatureCursor. Duncan
... View more
01-25-2013
07:38 AM
|
0
|
0
|
487
|
|
POST
|
Richard, I was having ArcMap crash spectacularly and it was down to the IDatastatistics object as indicated by the thread that Ken has linked to. It took a few days of headbanging a brick wall and all manner of cursing before I discovered that thread so I re-engineered the code to use a cursor to obtain unique values. It is clearly a bug introduced into 10.1 Everyone else thanks for your advice on best practise when using comReleaser (which seems to be don't use it! 😄 ) Duncan
... View more
01-25-2013
07:31 AM
|
0
|
0
|
991
|
|
POST
|
OK this is a shot in the dark. I don't tend to call geo-processing tools the way you are, I use the old style create a variant array and pass that to a tool. I just have not got around to learning your method. But I'm guessing you are missing a parameter? Your error message talks about a scripting engine, so I'm guessing you have to explicitly state which one you are using VBScript or Python? But I don't know how you would do that with your approach. Duncan
... View more
01-25-2013
06:06 AM
|
0
|
0
|
1185
|
|
POST
|
Neil and Jason, Thank you for telling me why I should not be using comReleaser! ESRI use it in many of their code examples so this is why I have adopted it as I understood it guaranteed the release of the cursor but as Jason shows that is not always the case and using Marshal.ReleaseComObject is a more robust solution. BUT, I can't help noticing this does not answer my question...;) If you are using comReleaser what is the best practise when you have nested loops? Neil points out it is an ESRI class, may be one the the ESRI product developers can answer this question? Duncan
... View more
01-24-2013
12:43 AM
|
0
|
0
|
4204
|
|
POST
|
James, Search for IRasterStretch2 Interface it has an invert method, not used it but my money is on that! Duncan
... View more
01-23-2013
06:46 AM
|
0
|
0
|
573
|
|
POST
|
Michael, I've personally turned my back on COM extensibility in favour of AddIns as as you say there is no nightmare installation issues. Simply drop the AddIn in a folder and point ArcMap to the folder, hey presto its installed. Even a non-power user can do that. The only issue I have come across within AddIns is that when porting say an older 2005 VS project you have to rebuild the whole toolbar from scratch. A bit of a pain but acceptible. Duncan
... View more
01-23-2013
06:20 AM
|
0
|
0
|
1004
|
|
POST
|
You need to upload your code if you want anyone to even have a chance at answer this!
... View more
01-23-2013
06:09 AM
|
0
|
0
|
1185
|
|
POST
|
Coding gurus, I've got a question about best practise when using the ComReleaser object. In the first example below is some stub code showing how I would typically using ComReleaser when I'm processing within a single loop. Using comRel As New ComReleaser() pFeatureCursor = pFeatureClass.Update(pQueryFilter, False) comRel.ManageLifetime(pFeatureCursor) pFeature = pFeatureCursor.NextFeature Do While Not pFeature Is Nothing ' Do something pFeatureCursor.UpdateFeature(pFeature) pFeature = pFeatureCursor.NextFeature Loop pFeatureCursor.Flush() End Using Now suppose I want to loop through another cursor whilst looping through the first cursor, so nested. Is it appropriate to have a Using statement within a using statement (1) or do you simply add the inner cursor to the comReleaser object (2). I ask as I've not seen any examples and was wondering what was the best approach when nesting cursors? Example 1 Using comRel As New ComReleaser() pFeatureCursor = pFeatureClass.Update(pQueryFilter, False) comRel.ManageLifetime(pFeatureCursor) pFeature = pFeatureCursor.NextFeature Do While Not pFeature Is Nothing ' Do something Using comRel2 as New ComReleaser() pFeatureCursor2 = pFeatureClass2.Search(pQueryFilter2, False) comRel2.ManageLifetime(pFeatureCursor2) ' Do something inner looping stuff End Using pFeatureCursor.UpdateFeature(pFeature) pFeature = pFeatureCursor.NextFeature Loop pFeatureCursor.Flush() End Using Example 2 Using comRel As New ComReleaser() pFeatureCursor = pFeatureClass.Update(pQueryFilter, False) comRel.ManageLifetime(pFeatureCursor) pFeature = pFeatureCursor.NextFeature Do While Not pFeature Is Nothing ' Do something pFeatureCursor2 = pFeatureClass2.Search(pQueryFilter2, False) comRel.ManageLifetime(pFeatureCursor2) ' Do something inner looping stuff End Using pFeatureCursor.UpdateFeature(pFeature) pFeature = pFeatureCursor.NextFeature Loop pFeatureCursor.Flush() End Using In example 2 pFeatureCursor2 is added to comRel on every cycle of the outer cursor loop, is that good, bad or irrelevant?
... View more
01-23-2013
06:05 AM
|
0
|
15
|
8741
|
|
POST
|
You may need to check that the other machine has missing references? In vb editor go to menu > references and check for italic missing references and untick them.
... View more
12-16-2012
12:22 PM
|
0
|
0
|
876
|
|
POST
|
Bert, OK found the source of the difference. Go to ArcCatalog and work out the vertical extent distance (Extent top - extent bottom). This gives you a value of 10194.24176. Divide that by your Y length cell size and you get 10037. The code method you are using is assuming that you X and Y size are the same, but they are not in your case, thus if you divide the vertical extent difference by X length size you get 55996. So it suggests that the code method assumes X and Y are the same length for a cell which is the normal case. Duncan
... View more
11-29-2012
05:13 AM
|
0
|
0
|
1805
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 3 | 2 weeks ago | |
| 1 | 02-15-2023 05:45 AM | |
| 1 | a month ago | |
| 1 | a month ago |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|