POST
|
I haven't messed with it much, but I don't think there is a way of passing arguments to a script when you execute it via the python window! If I am right, ESRI must have overlooked this one. I think your options would then be to: 1. Hard code the arguments in the script, and run it via the python window. 2. If your arguments are simple, like a single number or something, use the input() method. Example: test = input("Provide a number") 3. Run the script in Pythonwin, wing, etc. where you can specify the parameters. 4. Build a toolbox and use arcpy.getparameterastext() in you code to accept the arguments from the toolbox.
... View more
08-11-2010
09:09 AM
|
0
|
0
|
1690
|
POST
|
Not sure what inQuest is, but would it be possible to just import the raw DD coordinates (in .dbf format)straight into ArcGIS using th AddXYeventLayer tool, and then reprojecting using the ESRI prj tools?
... View more
08-11-2010
08:47 AM
|
0
|
0
|
1290
|
POST
|
Make sure you are specifying a negative longitude value if your coordinates are west (left) of the prime meridian. For example, using decimal degrees, Washington State (Pacific Coast) in the U.S. is located at about -120.0 longitude and 47.0 latitude.
... View more
08-11-2010
08:23 AM
|
0
|
0
|
1290
|
POST
|
BTW: I think Jim deserves a Forum MVP medal next to his name - almost 400 posts! Thanks for your all hard work with the new system:)
... View more
08-10-2010
09:56 PM
|
0
|
0
|
583
|
POST
|
One argument for splitting the existing Geoprocessing forum (or at least reorganizing it) is that it currently represents nearly 50% of all the forum threads/posts on the Functions topic. If you were a lumper, it could be argued that many of the other functions such as Geocoding, Map Automation, Interoperability, Imagery/Raster data, etc. should also be included as aspects of Geoprocessing. Doing so, however, would raise the "market share" of the Geoprocessing posts to roughly 65-70% of all the forum posts! Personally, I am a splitter rather than a lumper. My suggestion is to keep the Geoprocessing forum as is and create a new forum simply called "Scripting". Keeping with the spirit of v10 (arcpy scripting being a major aspect), this potential Scripting forum would be the go-to place for posts regarding geoprocessing, mapping, spatial analyst, and geostatistical scripting. Scripting (that is automating GIS "work" using a relatively high level computer language such as AML, Avenue, Python, etc.) is a central component of any reputable GIS. I for one am extremely excited that ESRI is putting a renewed emphasis on scripting in v10 (arcpy.mapping). Doing so is truly helping to rekindle the GIS Analyst caste that was, I think, somewhat lost when ESRI abandoned their old scripting languages like AML and Avenue and jumped head first into using ArcObjects and "real" programming languages as their default GIS automation technique. Scripting deserves it's own forum.
... View more
08-10-2010
09:50 PM
|
0
|
0
|
583
|
POST
|
Jason: So is getattr() and setattr() preferable to the esri cursor methods of getvalue() and setvalue(). That is to say, are they faster or for some other reason better? Regardless, seems pretty cool!
... View more
08-10-2010
09:56 AM
|
0
|
0
|
411
|
POST
|
Just an FYI but I gave up on ModelBuilder a long time ago because of constant stuff like this. But... Maybe a quick work around would be to have a condition in the Model that if the specified output exists, then delete it 1st, then run the guts of the Model?
... View more
08-10-2010
08:55 AM
|
0
|
0
|
858
|
POST
|
ArcMap and ArcCatalog seem to cling to locks on FCs (especially in PGDB and sometimes even FGDB). So if you had run your model, and had the result FC added to ArcMap, and then rerun your model (using the same output fc path) I bet that it is having trouble deleting it, since it had been added to the active session of ArcMap at one point. Try exiting ArcMap completely, restart it, and then rerun the Model. Does it work then?
... View more
08-10-2010
08:29 AM
|
0
|
0
|
858
|
POST
|
Hi, I noticed that the ArcGIS "Functions" forum topics have the following breakdown as of 08/09/2010: (apologies for the poor formatting...) FORUM----------------------------THREADS%-------POSTS% ------------------------------------------------------------------- CAD Data--------------------------1.00%------------0.64% Cartography-----------------------4.44%------------4.36% Data Models-----------------------3.08%------------2.14% Enterprise GIS--------------------0.79%------------0.42% Geocoding-------------------------0.36%------------0.16% Geodatabases/ArcSDE------------27.22%----------27.94% Geoprocessing--------------------45.27%-----------48.01% Imagery/Raster Data-------------12.61%-----------12.11% Interoperability and Standards--1.29%-------------0.73% Map Automation------------------3.15%-------------3.18% Map Templates--------------------0.79%-------------0.31% Nautical Mapping------------------0.00%-------------0.00% (Nautical Mapping?) ---------------------------------------------------------------- TOTAL------------------------------100%--------------100% Based on this summary, it is quite easy to see that the Geoprocessing forum topic has by far the most traffic in terms of thread topics and "chatter" about those topics. I would like to formally request that esri split the existing Geoprocessing forum topic into at least three subtopics: 1. Geoprocessing (General) 2. ModelBuilder 3. Scripting (e.g. Python) - Personally I would put 'Map Automation via Python scripting' in here as well since it is so related... Another simpler option would be to just create a new forum topic called "Scripting" 🙂 As a dedicated contributor to the poorly organized existing Geoprocessing forum, I find it hard to continue my contributions when there is an ever-increasing volume of seemingly non-relevant thread posts and an ever increasing level of disorganization within (in it's current state) an EXTREEMLY broad topic that obviously needs to be split into at least several sub-topics. in it's current incarnation, it includes nearly half of all the posts in the entire ArcGIS "Functions" category. Seems a bit out of whack to me... Also, I have to say it: I am baffled that there is an apparently new forum topic called "Nautical Mapping" (0 posts so far), and NOT a dedicated ModelBuilder or Scripting forum. Cmon... Nautical Mapping? :confused: What the?!?! Please esri - I am not alone in my frustrations here...
... View more
08-09-2010
03:30 PM
|
0
|
81
|
4295
|
POST
|
Use a shapefile. Contrary to popular belief, the ESRI formats in order of (in general) best to worst performance: 1. Shapefile 2. FGDB 3. PGDB Also, if you are attempting to store a raster in a geodatabase and are wanting to do actual analysis, stop right now! Put it in Grid format, and I guarantee you better performance.
... View more
08-09-2010
09:36 AM
|
0
|
0
|
365
|
POST
|
Hasn't this always been like this though? Even in v9.3 if you manually create a square having coordinate pairs of: 0,0 0,2 2,2 2,0 It reports the centroid as being: 1.000061, 1.000061 and the area as: 4.000488 and the perimeter as: 8.000488 Could be wrong here, but I was led to believe what Bill hinted at: ESRI's data models store/process coordinates as integers rather that double precision floats (seemingly to save space and speed processing). Seems like the larger the feature (relative distances) that, at least in v9.3, things become more "precise". For example, if you make a larger square of: 0,0 0,100000 100000,100000 100000,0 the centroid is now "exactly": 50000, 50000 and the area: 10000000000
... View more
08-05-2010
03:53 PM
|
0
|
0
|
2048
|
POST
|
Damn! I found that while it appears that you can load a geometry object straight into a dictionary it gets corupted somehow in the process!!! The tabular data however is perfect. I am guessing it has something to do with the stupid geometry object being incompatible with the dictionary. If you really need the geometry in the dictionary, you could just loop through all thr coordinate pairs in the searchcursor and add them to the dictionary as raw values rather than the stupid ESRI geometry thing. But that makes things more complicated. Oh well - maybe in v10 since things seem more Pythonic (although I suspect it's just a wrapper of some sort)... Tables are easy at least. Rich you could handle a multi-dimential array via Python in several ways (embedded lists or a dictionary). Python doesn't really have an "array" like VB, but I think Python array-type objects are better: listObj = [["ORIG_NAME1","NEW_NAME1"],["ORIG_NAME2","NEW_NAME2]] #print the original and name of the 2nd field print str(listObj[1][0]) + ", " + str(listObj[1][1]) ORIG_NAME2, NEW_NAME2 #or my favorite, a dictionary keyed from the original name: >>> dictionaryObj = {"ORIG_NAME1":["NEW_NAME1", "String"],"ORIG_NAME2":["NEW_NAME2","DOUBLE"]} >>> str(print dictionaryObj["ORIG_NAME2"][0]) + ", " + str(print dictionaryObj["ORIG_NAME2"][1]) NEW_NAME2, DOUBLE
... View more
08-05-2010
11:34 AM
|
0
|
0
|
485
|
POST
|
Rich, you will like this: import arcgisscripting
gp = arcgisscripting.create(9.3)
fc = r"D:\csny490\oesf_nso_models_20100623\landscape_model\results\results_bu.gdb\summary_results"
fieldList = gp.listfields(fc)
fieldIndex = 0
fieldNameDict = {}
for field in fieldList:
fieldNameDict[field.name] = fieldIndex
fieldIndex = fieldIndex + 1
fcDictionary = {}
oidFieldName = gp.describe(fc).oidfieldname
searchRows = gp.searchcursor(fc)
searchRow = searchRows.next()
while searchRow:
recordReadCount = 0
oidFieldValue = searchRow.getvalue(oidFieldName)
fcDictionary[oidFieldValue] = []
for field in fieldList:
fcDictionary[oidFieldValue].append(searchRow.getvalue(field.name))
searchRow = searchRows.next()
del searchRow
del searchRows
#Now that it's in the memory, fetch the habitat density field value of OID = 31 and its width...
fcDictionary[31][fieldNameDict["HAB_DENSITY"]] + " - " + str(fcDictionary[31][fieldNameDict["Shape"]].extent.width) + " feet wide!"
... View more
08-04-2010
03:44 PM
|
0
|
0
|
929
|
POST
|
Holy crap! Rich, you got me thinking here and check this out. I had no idea you could do this (load the geometry object ito a dictionary so easily). Not sure how to use it, but that so damn cool!!! basically this way you could store an entire FC as a Python dictionary! Wow! dict = {} >>> searchRows = gp.searchcursor(fc) >>> searchRow = searchRows.next() >>> dict[0] = searchRow.Shape >>> dict {0: <geoprocessing describe geometry object object at 0x00C1AAE8>} >>> del searchRow >>> del searchRows >>> dict[0].getpart(0) <geoprocessing array object object at 0x00C1A890> >>> dict[0].getpart(0).next().x 820175.92491082847 >>>
... View more
08-04-2010
02:45 PM
|
0
|
0
|
929
|
Title | Kudos | Posted |
---|---|---|
1 | 02-13-2012 09:06 AM | |
2 | 10-05-2010 07:50 PM | |
1 | 02-08-2012 03:09 PM | |
1 | 10-31-2013 02:18 PM | |
1 | 06-20-2011 07:53 AM |
Online Status |
Offline
|
Date Last Visited |
07-09-2024
09:30 PM
|