|
POST
|
A very serious performance hit is placing the default.gdb in the user's profile area which is not local, but across the network. Kim, this is a bit off-topic, but there is a fix for this in 10.0 SP5 and 10.1. HowTo: Set the default Home folder and geodatabase location for new map documents Of course this requires getting SP5 installed! In ArcMap 10.1 this setting is exposed in the options button on the Catalog window.
... View more
08-08-2012
02:20 PM
|
0
|
0
|
2863
|
|
POST
|
Thanks Jason. I can see where you could get into a lot of trouble with this, but on the other hand I'm pretty comfortable with suffering with issues with 3rd party libraries that you don't use. Why Shapely? I've been told that Shapely can do certain things much faster (not having to interact with the ArcGIS system) which is why I included it. This is probably a big reason people are looking to have GDAL available - although the functionality may be there in the Spatial Analyst toolbox, there may be big performance gains using GDAL if integration with the ArcGIS environment (validation, projection, mask etc) is not needed for a geoprocessing use case.
... View more
08-08-2012
01:21 PM
|
0
|
0
|
2863
|
|
POST
|
The 'file.split("\\")[-1][0:-4]' will split the path of the CAD file for each backslash (\), use the last value found by specifying [-1] (which would be the CAD file name), and then strip the '.DWG' from the file name by specifying [0:-4]. I'm more of a fan of using the os.path function for this sort of thing. For one thing it works with forward-slash path delimiters too. >>> import os
>>> p = r"e:\work\test.dbf"
>>> os.path.basename(p)
'test.dbf'
>>> os.path.splitext(p)
('e:\\work\\test', '.dbf')
>>> os.path.splitext(p)[1]
'.dbf'
... View more
08-08-2012
01:11 PM
|
0
|
0
|
6666
|
|
POST
|
Looks good, much more fleshed out. Maybe I am missing something though, this doesn't seem to preserve the negative sign with the xmin assignment. You're right--it doesn't preserve the sign. I don't think you need it as long as you use the ABS function in the second SearchCursor SQL expression. Arc 10 help: SQL reference for query expressions used in ArcGIS
... View more
08-08-2012
12:11 PM
|
0
|
0
|
1279
|
|
POST
|
The ArcGIS Python 2.7 distribution for 10.1 includes (in addition to the python standard library) the user-contributed modules numpy and matplotlib. It would be really great to include some more modules. If you agree, vote this item up and add your favorites (and use cases) in the comments. Vote here, and also feel free to vote the idea up: ideas.esri.com: Ship additional python extensions
... View more
08-08-2012
10:52 AM
|
0
|
33
|
15314
|
|
POST
|
Matt - I guess I have a tweak:
tv = arcpy.MakeTableView(table)
curs = arcpy.SearchCursor(tv)
listing = list() # create a list
for row in curs:
listing.append(row.min_value)
del row, curs # always a good idea when done!
xmin = min([abs(i) for i in listing])
# now get that record (or the first if several) with that abs value
curs = SearchCursor(tv,"abs(%s) = %s" % (min_value,xmin))
# get the value for field "shapefile"
shapefile = curs.next().shapefile
del curs
... View more
08-08-2012
09:55 AM
|
0
|
0
|
1279
|
|
POST
|
Thanks that was helpful. The odd behavior in reading strings equal to or longer that 256 is that the entire script fails, not just the one long string. For a field named Description and pulling in 10 rows of data, if just one value is too large all 10 rows fail on that field. You'd think that just the one record would fail not all. Microsoft Jet parses through the first few rows of the file to determine datatype. This setup process is clearly broken by your long strings! Here's more about this in the 10.0 help: Adding an ASCII or text file table
... View more
08-07-2012
12:18 PM
|
0
|
0
|
1577
|
|
POST
|
You need string delimeters inside the expression, which is itself a string. In Python this is easily done by escaping the double quote, or using the other kind of python string delimeter outside:
arcpy.CalculateField_management(eoptreps_v2, "Project", "\"1307 - PNDI CPP\"")
arcpy.CalculateField_management(eoptreps_v2, "Project", '"1307 - PNDI CPP"')
Double-quotes are used here because although we are using python, the default syntax expression for the Calculate Field tool is VBScript, which delimits string literals with double quotes.
... View more
08-07-2012
12:12 PM
|
0
|
0
|
1115
|
|
POST
|
Another straightforward workaround to try is the Clip_management tool. Since it's outside the Spatial Analyst toolbox, it's going to probably work better with a wider collection of raster input types. Clip_management has a nice feature: it is set up to snap by default to avoid resampling.
... View more
08-07-2012
09:44 AM
|
0
|
0
|
4770
|
|
POST
|
After all, this may be due to the cache of the external disk filling up after a few (hundred) datasets. After that, real disk-writing occurs, which is slower. Restarting the script would then mean that the cache gets cleared before work restarts and fills it again. When you delete an object from a geodatabase, it is not truly deleted, just flagged for deletion. The way to make it really go away and no longer take up disk space is to Compact (not compress) the geodatabase.
... View more
08-06-2012
04:07 PM
|
0
|
0
|
786
|
|
POST
|
I'm reading in text values from xls and csv files, I'm using row.getValue('Field_Name") to read the values in. This method is working well with short sentences but fails once it hits 256 chars. Is there another method that allows more characters to be pulled in? This is a limitation of how tables are read in ArcGIS (using Microsoft Jet). However, there are limitations writing large strings to some data types as well (.dbf, .mdb). You may have more luck reading long strings in a .csv using the python csv module.
... View more
08-06-2012
03:59 PM
|
0
|
0
|
1577
|
|
POST
|
I am trying to perform a sedimentation analysis for a watershed. I have created multiple rasters that I need to multiply together. When I multiply the four rasters together with the raster calculator I have negative and positive values. However, the lowest value in the rasters being multiplied is zero. I can multiply up to three of them together without this happening but all four seems to add negative values. I am using ArcGIS 9.3.1 and all rasters have the same projection, cell size, and are in a GRID format. Any ideas as to why negative values are showing up? You may be able to solve this mystery by using the identify tool to compare the values in the four inputs and the output for individual locations.
... View more
08-06-2012
03:50 PM
|
0
|
0
|
675
|
|
POST
|
How do you get this installed into ArcMap10?? In Arc 10, you can just access the toolbox directly in the catalog window. No need to "add toolbox".
... View more
08-06-2012
03:38 PM
|
0
|
0
|
2584
|
|
POST
|
arcpy.gp.RasterCalculator_sa("((\"%RT_v4_2028_0_albers_tif%\" * 31) + (\"%RT_v4_2028_1_albers_tif%\" * 28) + (\"%RT_v4_2028_2_albers_tif%\" * 31)) * 100", rt_sum_2028_100_tif) The Raster Calculator tool is designed for use in ModelBuilder only. For best results, if you are going to do this in Python you should rewrite the expression using Python map algebra. # Import arcpy module import arcpy from arcpy.sa import * # Check out any necessary licenses arcpy.CheckOutExtension("spatial") # Local variables: RT_v4_2027_0_albers_tif = "RT_v4_2027_0_albers.tif" RT_v4_2027_1_albers_tif = "RT_v4_2027_1_albers.tif" RT_v4_2027_2_albers_tif = "RT_v4_2027_2_albers.tif" rt_sum_2027_100_tif = "Y:\\RT_annual\\rt_sum_2027_100.tif" rast = (Raster(RT_v4_2027_0_albers_tif) * 31.0 +\ Raster(RT_v4_2027_1_albers_tif) * 28.0 +\ Raster(RT_v4_2027_2_albers_tif)) * 100 rast.save(RT_v4_2027_2_albers_tif)
... View more
08-06-2012
03:28 PM
|
0
|
0
|
4352
|
|
POST
|
Or is it just easier to use VB instead of Python for field calculations? I believe (and I think many would agree) that Python has far superior string manipulation capabilities. Here are some pretty good Python methods for stripping non printables: http://stackoverflow.com/questions/92438/stripping-non-printable-characters-from-a-string-in-python http://stackoverflow.com/questions/1276764/stripping-everything-but-alphanumeric-chars-from-a-string-in-python
... View more
07-29-2012
09:22 PM
|
0
|
0
|
4422
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-11-2021 01:26 PM | |
| 5 | 12-10-2021 04:58 PM | |
| 1 | 02-27-2017 09:30 AM | |
| 2 | 12-04-2023 01:05 PM | |
| 1 | 04-12-2016 10:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
06-19-2024
12:10 AM
|