|
POST
|
Sorry of maybe this should go under the Installation forum. Anyway, I just installed Pythonwin (from a download, not the installation disc, which some administrator has). None of the intellisense pops up. Is this correct? I seem to remember that it did pop up in an earlier install on a different machine. Thanks. Oh, and I did add C:\Python26\ArcGIS10.0 to the PATH variable. Well, now it does pop up, but not consistently. For example, if I type 'arcpy.', nothing pops up the first time. I then type 'arcpy.env'. From then on, 'env' will pop up, but no other properties. The same with functions like 'Select_analysis'; nothing the first time, but it will show up subsequently. The os properties pop up, but they're part of Python, not arcpy. What am I missing?
... View more
02-17-2012
06:31 AM
|
0
|
4
|
1727
|
|
POST
|
Well, that's odd. Last time I typed the script line by line into the Python window in ArcGIS, and it ran. This time, I imported the .py file - same script - and got the same error 'arcgisscripting...' as above. Besides the riddle of why it runs one way and not the other, why an arcgisscripting error when this is ArcGIS 10, importing arcpy? To further muddy the waters, I just loaded the script in the Python window and changed the hardcoded path to the mxd in MapDocument to CURRENT, and it worked. Maybe this is a PATH problem when running the script outside ArcGIS? Python isn't in my PATH variable anywhere. But shouldn't a hardcoded path from within ArcGIS work anyway? Hmmm...
... View more
02-16-2012
04:54 AM
|
0
|
0
|
1650
|
|
POST
|
Well, it did work in the python window. It also added duplicate layers to the first data frame, presumably because the ApplySymbologyLayer tool ran on all layerList, which had included the features from the first data frame. Adding them in again seems a strange behavior, but whatever. One thing I found strange, but maybe is normal, is that the iterators - d, symbologyLayer & layer - didn't pop up any intellisense. Don't know why a stand alone script wouldn't work. Next step is to try it after adding the script as a tool, then work on labels. I really appreciate the help, thanks.
... View more
02-15-2012
10:47 AM
|
0
|
0
|
1650
|
|
POST
|
Thanks. I caught the typo w/the parenthesis. Only thing I changed was the directory, from CURRENT to an absolute path. At one point I did add a 'print d.name' after the layerList.Extend, and that gave the correct names. I know that sometimes the error is in the line above the cited one, but that's just a For loop declaration. My code (well, your code):
import arcpy
mxd = arcpy.mapping.MapDocument(r'F:\Muzyl\GIS\Old Data\Michigan LP\MXD\Michigan.mxd')
df = arcpy.mapping.ListDataFrames(mxd)
#Create list of layer from first dataframe
symbologyList = arcpy.mapping.ListLayers(mxd,"",df[0])
layerList = list()
#Remove first dataframe from list
df.remove(df[0])
#Add the rest of the layers to a list
for d in df:
layerList.extend(arcpy.mapping.ListLayers(mxd,"",d))
#Compare the layers. If they are the same feature change the symbology.
for symbologyLayer in symbologyList:
for layer in layerList:
if symbologyLayer.dataSource == layer.dataSource:
arcpy.ApplySymbologyFromLayer_management(layer, symbologyLayer)
and the error in PythonWin:
Traceback (most recent call last):
File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 309, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=0)
File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File "C:\Python26\ArcGIS10.0\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 624, in run
exec cmd in globals, locals
File "C:\Users\greg\Desktop\Clone_symbology_data_frames.py", line 19, in <module>
if symbologyLayer.dataSource == layer.dataSource:
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\_base.py", line 70, in _get
return convertArcObjectToPythonObject(getattr(self._arc_object, attr_name))
AttributeError: LayerObject: Get attribute dataSource does not exist
>>>
... View more
02-13-2012
01:30 PM
|
0
|
0
|
1650
|
|
POST
|
Well, I think the error message below means the layer doesn't have a datasource property, although it comes up in the intellisense window in PythonWin after typing the dot after symbologyLayer & layer. The help files seem to indicate that the layer has to be a layer, .lyr, file, and not a feature class or shapefile. I don't know why this would be the case.
File "C:\Users\greg\Desktop\Clone_symbology_data_frames.py", line 19, in <module>
if symbologyLayer.dataSource == layer.dataSource:
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\_base.py", line 70, in _get
return convertArcObjectToPythonObject(getattr(self._arc_object, attr_name))
AttributeError: LayerObject: Get attribute dataSource does not exist
... View more
02-12-2012
04:05 PM
|
0
|
0
|
1650
|
|
POST
|
I know some python, and less arcpy. What I want to do is to loop through the features in the first data frame of two or more, get the symbology and label properties of each feature, then set the same features in all other data frames to the same property. This would be a kind of cleanup tool so I don't have to do it manually if I make changes. Any ideas on where to start? I'm not sure how to get the features/properties from just the first data frame. The help files seem to deal with .lyr files, while I'm using shapefiles and feature classes in a gdb. Maybe there's already a tool for this, but I'd like to do this as a learning exercise anyway. Thanks.
... View more
02-08-2012
07:34 AM
|
0
|
9
|
2220
|
|
POST
|
Yes, didn't think of that. The SA toolbar has been greatly reduced between 9.3 and 10. Why, no idea.
... View more
10-27-2011
07:20 AM
|
0
|
0
|
1065
|
|
POST
|
Have you actually downloaded the extensions? They're not automatically installed even though they show up in the Customize menu. In 10, Start - All Programs - ArcGIS - ArcGIS Administrator and go from there.
... View more
10-26-2011
09:59 AM
|
0
|
0
|
1065
|
|
POST
|
If your shapefile or data frame is in lat/long GCS, you could do this pretty simply and quickly: 1. Add two float fields - call them lat and lng, or something else if you prefer 2. Right click the field heading, select Calculate Geometry. Select either X point or Y point from the dropdown as appropriate for that field. X = longitude, Y = latitude. 3. Select whether to use the shapefile coordinate system or the data frame one. 4. Click Ok, and you're done This won't work to give you lat/long if neither the shapefile or the data frame is in a GCS. If both are projected coordinate systems, the results will be in that as well. You might try adding your shapefile to a new, empty map where you've first set the data frame to whatever GCS you want to use, then do the above. Your existing map will still be fine, but your shapefile will then have lat/long attributes. Technically, maybe you could just switch your existing data frame to GCS, perform the above, then switch back, but I like to keep the process cleaner.
... View more
10-06-2011
10:18 AM
|
0
|
0
|
709
|
|
POST
|
You might also try getting rid of most, if not all, of the empty columns. I'm not sure, but a limit on the number of fields. In any case, they just bloat the file. Also, as well as no spaces in the column names, maybe Excel column names need to be under 13 characters like a dbf. It doesn't hurt, anyway. If you wanted to make a shapefile out of the data, you'd need to do it then.
... View more
09-30-2011
04:32 PM
|
0
|
0
|
2669
|
|
POST
|
Can you get the number of records in a particular dataset (Count, maybe?). Then round that up to the nearest 50K and divide that by 50K to get the number of loops you want. This might be easier in code than Model Builder, don't know which you're using.
... View more
02-09-2011
10:09 AM
|
0
|
0
|
1538
|
|
POST
|
Never used Oracle, but here's one result from googling 'Oracle date format': http://www.oradev.com/oracle_date_format.jsp The 1899 date may be the base that the db starts from. Dates are generally represented internally to the computer as the number of days since a base date (1899... in this case, apparently), then displayed as a regular date. At least that's how they used to be done. I don't think there's any way to update a date/time field automatically within the field itself. You could use a trigger to update at specified intervals or events, assuming your db is running at the time. You probably wouldn't want constant updating unless you have a lot of processing power anyway. Updating every second, even every minute, would use a lot of processing resources. edit: It's been a while since I've actually done any of this, so take the above with a grain of salt.
... View more
02-08-2011
03:17 PM
|
0
|
0
|
687
|
|
POST
|
You have to get/activate the license as well. Not sure about v. 10, but for 9.3x educational, there's a Desktop Administrator' icon under the ArcGIS folder under Start -> All Programs. Click that, then go through the steps to download (or activate) the license. Not sure offhand which of the options in Desktop Administrator you go through, but you can probably figure it out.
... View more
01-28-2011
11:53 AM
|
0
|
0
|
3253
|
|
POST
|
I have several DEMs for adjacent counties, one per county. The problem with displaying them is that the values are calculated individually for each county, so that the high part of one DEM, displayed as white, matches up with a low part of the adjacent county (black). This makes for a contrast between the counties which isn't actually there. I'd like to based on the values in all DEMS, so that the transition between counties is equivalent, either through calculating individual DEMs based on all DEMs, or by combining them into one. Is either approach correct, and if so, what would I do to accomplish this? If incorrect, what should I do? Thanks.
... View more
01-28-2011
11:22 AM
|
0
|
0
|
891
|
| Title | Kudos | Posted |
|---|---|---|
| 6 | 08-22-2019 07:41 AM | |
| 1 | 05-05-2014 04:30 AM | |
| 1 | 08-15-2018 06:23 AM | |
| 3 | 08-06-2018 07:31 AM | |
| 1 | 03-30-2012 08:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
12-12-2021
01:00 PM
|