|
POST
|
Great to hear! Perhaps it isn't that relevant to this instance, but Wayne's comments certainly hold true. "...in_memory is great when it works correctly - careful not to run out of memory, 'Delete_management' frees it up..." It's a double-edged sword thing -- too much reliance on it and it can cut ya. One of the things that I have done to help mitigate any kwirks/wierdness with the in_memory is to make darn sure nothing is in it when it shouldn't be or when I am finished with it. This simply def() can be called right before and after you process 'stuff' and helps to be sure it is all cleaned up (sorry, it's Arcgisscripting 9.3 because I am still waiting to migrate to 10.1). (this is just for featureclasses but you can alter it to include other types like tables and such) def ClearINMEM():
## clear out the IN_MEMORY workspace of any featureclasses
try:
gp.Workspace = "IN_MEMORY"
fcs = gp.ListFeatureClasses()
### for each FeatClass in the list of fcs's, delete it.
for f in fcs:
gp.Delete_management(f)
gp.AddMessage("deleted: " + f)
except:
gp.AddMessage("The following error(s) occured attempting to clear in_memory space " + gp.GetMessages())
return
... View more
01-17-2013
10:48 AM
|
0
|
0
|
573
|
|
POST
|
Chris: Thanks for the tip on in-memory. I used that, not much time difference, though. Is this correct? env.workspace = "IN-MEMORY" I thought it should be env.workspace = "IN_MEMORY" You might want to go back and make sure the in_memory space is correctly implemented (ie, copy your temporary FC's there and run the dissolve on those copied/in_memory FC's). My experience has been huge performance improvements.
... View more
01-17-2013
09:39 AM
|
0
|
0
|
3773
|
|
POST
|
Instead of creating temporary data in a specific folder location, do all of your temp data and processing of that temp data within the IN_MEMORY workspace. You should see significant performance gains.
... View more
01-17-2013
05:41 AM
|
0
|
0
|
3773
|
|
POST
|
I am implementing IRasterClassifyColorRampRenderer using an EqualInterval class breaks and manually setting min/max and number of classes for each raster loaded in an ArcScene document. All works exactly as expected but I have a request to "flip" the color ramp and I cannot seem to find how to get this done. Manually, I would just access the symbology via properties menu, select all of the classes/symbols, right-click and choose "flip colors". Of note: I am not manipulating the IColorRamp at all, rather I am enumerating thru the StyleGallery and selecting one by name (eg. "Blue-Dark to Cyan-Light"). So, with all this said... Can I simply issue a .FlipColorRamp somehow??? 🙂 Prefer VisualBasic but can probably figure out the C# if you have an example. Thanks, James
... View more
01-15-2013
05:49 AM
|
0
|
2
|
985
|
|
POST
|
Tip: if you plan to use matplotlib to generate many figures from inside of a loop, make sure to close the figure each time you are finished saving it out! plt.figure()
#...plotting code here
plt.savefig(out)
plt.close() If you don't you will get severe memory leak and the ArcGIS software you are running the python script from will bomb out. In my case I am running this as an ArcToolbox script and ArcCatalog would shutdown after a few hundred figures were generated.
... View more
01-10-2013
06:38 AM
|
0
|
0
|
3649
|
|
POST
|
Check out the pandas library -- it is very slick for time-series work. Plus, you can integrate with your matplotlib work too. http://pandas.pydata.org/pandas-docs/dev/timeseries.html
... View more
01-09-2013
08:32 AM
|
0
|
0
|
3649
|
|
POST
|
Thank you James. It worked perfectly. I recommend that, this solution strongly works. cheers Glad to hear it helped!
... View more
12-31-2012
02:34 AM
|
0
|
0
|
1238
|
|
POST
|
I am using ArcGIS 9.3.1. I want to bind the Itable to a .net DataGridView on framework 3.5. How do i do it? Please help thanks You wouldn't bind to the DataGridView. Rather, you would likely have to actually create and populate a new DATASOURCE of your DataGridView. that is, create a DataTable from your ITable then bind to the DGV. Here is a function I have in an implementation that works very well to convert a FeatureLayer into an ADO.NET DataTable object --- you should be able to replace with your ITable instead of the FeatureLayer relatively easily. Public Function ConvertToADONETDataTableFromLayer(ByVal inLayer As IFeatureLayer) As DataTable Try Dim tmpDT As New DataTable("tmpDT") Dim column As DataColumn Dim pTable As ITable = inLayer.FeatureClass Dim pFields As IFields = pTable.Fields Dim pCur As ICursor = pTable.Search(Nothing, False) For c = 0 To pCur.Fields.FieldCount - 1 column = New DataColumn() column.ColumnName = (pFields.Field(c).Name) If pFields.Field(c).Type = esriFieldType.esriFieldTypeString Then column.DataType = System.Type.GetType("System.String") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeInteger Then column.DataType = System.Type.GetType("System.Int32") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeDouble Then column.DataType = System.Type.GetType("System.Double") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeDate Then column.DataType = System.Type.GetType("System.DateTime") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeSingle Then column.DataType = System.Type.GetType("System.Single") ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeBlob Then column.DataType = System.Type.GetType("System.Byte") End If column.ReadOnly = False tmpDT.Columns.Add(column) Next Dim pRow As IRow = pCur.NextRow Dim newRow As DataRow Do Until pRow Is Nothing newRow = tmpDT.NewRow() newRow.BeginEdit() For cols = 0 To pCur.Fields.FieldCount - 1 newRow(cols) = pRow.Value(pRow.Fields.FindField(pFields.Field(cols).Name)) Next newRow.EndEdit() tmpDT.Rows.Add(newRow) tmpDT.AcceptChanges() pRow = pCur.NextRow Loop Return tmpDT Catch ex As Exception MsgBox(ex.ToString) Return Nothing End Try
... View more
12-27-2012
03:01 AM
|
0
|
0
|
1238
|
|
POST
|
My workaround was to apply the classification I wanted to a single raster manually in ArcGIS, then in the "Symbology" tab of the raster properties you can select all of the symbols in the range and right-click -- this gives you the option to "Save Class Breaks" that saves it as an .xml file. ...Now when I load my RasterCatalog into the TOC I can use the "Load Class Breaks" option in the same menu as mentioned above.
... View more
12-21-2012
10:00 AM
|
0
|
0
|
595
|
|
POST
|
I am trying to apply some existing VBA code that works for a Raster on a RasterCatalogLayer. The existing code sets up a new renderer and classifies it with a specific minimum and maximum value for the renderer, which is done by way of IRasterStatistics. For example, Dim pStats As IRasterStatistics Set pStats = pRasBand.Statistics pStats.Minimum = d_dMin pStats.Maximum = d_dMax Can someone show and example of how to perform the above on an IRasterCatalogLayer? That is, we have moved all of the standalone rasters into a new RasterCatalog and now tasked with generating the required renderer. Thanks!
... View more
12-20-2012
10:34 AM
|
0
|
1
|
870
|
|
POST
|
@jamesfreddyc Thanks for your answer. First of all, I'm working with 10.1 SP1. I'm aware of the functionality and how to check in and check out extensions with python. What I don't get to work is storing this code as an Add-In or in the Normal.mxt so it automatically releases any extensions when closing down/starting a mxd. 😞 http://resources.arcgis.com/en/help/main/10.1/index.html#/What_is_a_Python_add_in/014p00000025000000/
... View more
12-05-2012
02:35 AM
|
0
|
0
|
1650
|
|
POST
|
What version of ArcGIS are you working with? Here's an example for 10: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v0000003q000000 I am still on ArcGIS 9.3.1 and here is some sample from one of my arcgisscripting(9.3) implementations:
import arcgisscripting
### see if spatial analyst extension is available for use
availability = gp.CheckExtension("Spatial")
if availability=="Available":
gp.CheckOutExtension("Spatial")
gp.AddMessage("Spatial Analyst Has been checked out")
else:
gp.AddError("%s extension is not available (%s)"%("Spatial Analyst Extension",availability))
gp.AddError("Please ask someone who has it checked out but not using to turn off the extension")
return
#....do the SA work here....
### return the Spatial Analyst Extension to the pool ###
gp.CheckInExtension("Spatial")
gp.AddMessage("Spatial Analyst Has been checked back in")
... View more
12-04-2012
02:52 AM
|
0
|
0
|
1650
|
|
POST
|
I'd move some of the join management stuff you are doing to the IN_MEMORY space. You can still perform your selections and count processes there, but you can mitigate some of the locking issues (from my experience) by working with intermediate data in_memory. Also, from what I understand the overwrite setting will not work as expected if you are not properly releasing references along the way. This is another reason why I like the in_memory space to perform these kinds of things -- it is very easy to "clear" it when needed.
... View more
11-27-2012
04:15 AM
|
0
|
0
|
3315
|
|
POST
|
Thanks James, I have seen a few people talk about IN_MEMORY, but I have never seen any help files or code examples using it, so I have never tried it out! Sounds like something I should look into! Cheers, Stacy In addition to relief from the locking issue I was having, the in_memory space performs much better. However, I do see that threre are limitations to it as well and it can be a double-edged sword as you will then be upping the RAM usage (I think). But the idea is to do the processing there, then write out the final output to where you need the result(s) to be. It is very easy to implement, just set your workspace to it and process as normal. Here is an example of a def() I use before I start any processing to "clear" out the IN_MEMORY sapce (although, I am not so sure this is even required. But because I am still unsure how garbage collection fully works when tools are being run from ArcCatalog in succession -- so I just clear it out anyway). I am implementing arcgisscripting(9.3) for ArcGIS 9.3.1 here
def ClearINMEM():
## clear out the IN_MEMORY workspace of any featureclasses
try:
gp.Workspace = "IN_MEMORY"
### clear in_memory of featureClasses
fcs = gp.ListFeatureClasses()
### for each FeatClass in the list of fcs's, delete it.
for f in fcs:
gp.Delete_management(f)
gp.AddMessage("deleted feature class: " + f)
### clear in_memory of tables
tables = gp.ListTables()
for tbl in tables:
gp.Delete_management(tbl)
gp.AddMessage("deleted table: " + tbl)
gp.AddMessage("in_memory space cleared")
except:
gp.AddMessage("The following error(s) occured attempting to ClearINMEM " + gp.GetMessages())
return
... View more
11-26-2012
02:40 AM
|
0
|
0
|
7041
|
|
POST
|
Apparently ArcCatalog simply doesn't like pyodbc all that much. Supposedly it has to do with the way ArcCatalog handles conneciton pooling. ...sticking with cx_Oracle for the time being.
... View more
11-21-2012
06:36 AM
|
0
|
0
|
4745
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|