|
POST
|
Before testing this, I would recommend making a copy of your feature dataset as a backup. Here is some sample code that will move your point features based on the GPS fields: import arcpy
from arcpy import env
env.workspace = "C:/Temp/Python/test.gdb"
fc = "Parker_R6_Manhole_1"
pnt = arcpy.Point()
rows = arcpy.UpdateCursor(fc)
for row in rows:
pnt.X = row.GPS_X
pnt.Y = row.GPS_Y
row.shape = pnt
rows.updateRow(row)
del row, rows The tricky part is having the mains move with the manholes. I was able to get this to work by specifying a larger cluster tolerance and setting the rank for the manhole feature class to 1, and the rank for the mains feature class to 2 within the topology. If the distance the points moved is less than the cluster tolerance, the mains will snap to the updated manholes upon validation.
... View more
08-09-2011
06:45 AM
|
0
|
0
|
4686
|
|
POST
|
I believe the problem is with the 'arcpy.ListRasters' function. You will want to specify "TIF" instead of "TIFF". Also, I believe you will want to specify 'os.path.join(OutDir, outname)' within the 'arcpy.Clip_management' function. Ex: rasters = arcpy.ListRasters("*", "TIF")
for raster in rasters:
print raster
outname = raster[:-4] + "_clip.tif"
arcpy.Compression= "LZW"
arcpy.Clip_management(raster, "", os.path.join(outDIR, outname), clipFC, "", "ClippingGeometry")
... View more
08-09-2011
04:01 AM
|
0
|
0
|
1165
|
|
POST
|
Is your data frame coordinate system the same as the raster coordinate system? Also, here is a helpful KB article.
... View more
08-08-2011
09:01 AM
|
0
|
0
|
996
|
|
POST
|
If you are running a python script to perform the reconcile/post/compress you will want to make sure no users are connected to the database. A connection acquires a state lock and a locked state cannot be compressed. You may want to consider using the 'sdemon -o kill -t all' command to kill all connected users so you can perform the compress successfully. Also, there is a great script here for reconciling/posting versions.
... View more
08-08-2011
06:15 AM
|
0
|
1
|
2222
|
|
POST
|
I would double-check to make sure who the owner of the domain is. Take a look at the following link for the correct query: http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_java_help/index.html#//0092000013v7000000.htm Note: The SQL Server query is for a repository owned by the DBO schema. If your schema is owned by SDE, you will need to update the dbo owner to sde. Ex: --SQL Server
SELECT items.Name AS "Domain Name",
items.Definition.value('(/*/Owner)[1]','nvarchar(max)') AS "Owner"
FROM sde.GDB_ITEMS AS items INNER JOIN sde.GDB_ITEMTYPES AS itemtypes
ON items.Type = itemtypes.UUID
WHERE itemtypes.Name IN ('Coded Value Domain', 'Range Domain')
... View more
08-08-2011
06:03 AM
|
0
|
0
|
2740
|
|
POST
|
A mosaic dataset would be the best option. You may not see the mosaic dataset at smaller scales because Overviews are not built. To build overviews right-click on the mosaic dataset in ArcCatalog > Build Overviews.
... View more
08-04-2011
04:52 AM
|
0
|
0
|
359
|
|
POST
|
Do you have a stretch applied to the raster? If the stretch is set to 'Standard Deviations', try changing it to 'None' and see if this helps. You can change this in the Properties > Symbology tab, or use the new Image Analysis windows for ArcGIS 10.
... View more
08-04-2011
04:48 AM
|
0
|
0
|
465
|
|
POST
|
I believe the problem is with the Search cursor. You have: sCur = arcpy.SearchCursor("test.shp", "","","ID_1") When specifying "ID_1" you are limiting the search cursor to this specific field, but you are trying to query the "Shape" field's extent. I would recommend keeping this parameter empty, or including the ''Shape'' field. Ex: sCur = arcpy.SearchCursor("test.shp", "","","ID_1; Shape") or sCur = arcpy.SearchCursor("test.shp")
... View more
08-04-2011
03:43 AM
|
0
|
0
|
904
|
|
POST
|
Your code will work with no problems. You can also use the 'arcpy.ListFields' function. Ex: lstFields = arcpy.ListFields(fc)
x = False
for field in lstFields:
if field.name == "USNG":
print "Field exists"
x = True
if x <> True:
print "Field does not exist" I tested the Describe function vs the ListFields function using the time module, and the ListFields function was slightly faster by a tenth of a second. Also, to preserve indentation when copying/pasting your code, select your code and click the '#' button at the top. It will wrap it in CODE tags.
... View more
08-03-2011
01:08 PM
|
2
|
0
|
16719
|
|
POST
|
I could not find a way to access an ArcScene document (.sxd) using python either. The best approach I found was to copy your group layer to ArcMap by right-clicking on the group layer in ArcScene > Copy > right-click on ArcMap's data frame > Paste Layer(s). Next save the map document. Once you have the saved MXD you can run python on the group layer to sort the layer alphabetically. After the group layer is sorted in ArcMap, you can copy/paste the group layer back into the SXD. Here is an example how to sort the Group Layer: import arcpy
from arcpy import env
from arcpy import mapping
env.overwriteOutput = True
env.workspace = r"C:\temp\python"
folder = env.workspace
mxd = mapping.MapDocument(r"C:\temp\python\Scene.mxd")
list = []
for df in mapping.ListDataFrames(mxd, "*"):
for lyr in mapping.ListLayers(mxd, "*", df):
# Find layers within Group Layer
if "\\" in lyr.longName:
lyrName = str(lyr.name) + ".lyr"
list.append(lyrName)
# Save layers to .lyr files
arcpy.SaveToLayerFile_management(lyr, lyrName)
# Remove layers from Group Layer
mapping.RemoveLayer(df, lyr)
print "Successfully created layer files and removed layers"
# Order layer files in alphabetical order
list.sort(key=lambda x: x.lower())
# Add layer files to Group Layer in alphabetical order
for df in mapping.ListDataFrames(mxd, "*"):
for n in list:
for lyr in mapping.ListLayers(mxd, "3D", df):
targetGroupLayer = lyr
addLayer = mapping.Layer(folder + "\\" + n)
mapping.AddLayerToGroup(df, targetGroupLayer, addLayer, "BOTTOM")
print "Successfully reorderd Group Layer"
# Delete lyr files
lstFiles = arcpy.ListFiles("*.lyr")
for file in lstFiles:
arcpy.Delete_management(file)
print "Sucessfully deleted layer files"
mxd.save()
del mxd
... View more
08-03-2011
08:13 AM
|
0
|
0
|
683
|
|
POST
|
Sounds like the problem is just with this specific MXD, so I don't think reverting back to 9.3.1 will help. There are a couple other things you can try: 1. Save the MXD to a new MXD (you can even try an earlier version of ArcGIS by using 'Save A Copy') 2. Run the 'ArcGIS Document Defragmenter' on the MXD 3. Run the 'MXD Doctor' on the MXD Both of the utilities mentioned in 2 and 3 are located at Start > Programs > ArcGIS > Desktop Tools.
... View more
08-03-2011
04:59 AM
|
0
|
0
|
825
|
|
POST
|
Have you considered using a mosaic dataset? This is essentially a raster dataset and raster catalog hybrid. It renders much faster due to the mosaic datasets overviews. This is the recommended approach when dealing with a large collection of rasters. Here is another helpful link and a video on mosaic datasets.
... View more
08-02-2011
03:10 AM
|
0
|
0
|
683
|
|
POST
|
Glad to see you got this working! The lock will only remain while the feature class is being updated. Once the points have been moved, the lock is released. A lock will be placed on the feature class using the 'arcpy.Snap_Edit' funciton as well, the difference being is that it is automatically released afterwards. Below is the code that I was able to get working: mxd = arcpy.mapping.MapDocument("CURRENT")
rows = arcpy.UpdateCursor("Points")
for row in rows:
POINTNO = row.getValue("Line_ID")
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.name in "AllLines":
lyr.definitionQuery = "\"LINENO\" = " + str(POINTNO)
arcpy.RefreshActiveView()
if lyr.name in "Points":
lyr.definitionQuery = "\"POINTNO\" = " + str(POINTNO)
arcpy.RefreshActiveView()
snapEnv = ["AllLines", "EDGE", "5"]
arcpy.Snap_edit("Points", [snapEnv])
print "Snapped point successfully"
del row, rows, mxd Also, as a hint, after copying/pasting your code you can select it and click the '#' symbol to wrap CODE tags around it. This will preserve the indentation of your script.
... View more
08-02-2011
03:01 AM
|
0
|
0
|
730
|
|
POST
|
Using the Update, Search, or Insert cursor function will place a lock on the feature class. You will need to delete the 'row' and 'rows' variables. You can do this by running 'del row, rows' at the end of your code. Also, I noticed an error within your code. You will need to change AllLines to "AllLines" within your snapEnv variable. Ex: import arcpy
rows = arcpy.UpdateCursor("Points")
mxd = arcpy.mapping.MapDocument("CURRENT")
print mxd.filePath
for row in rows:
LINENO = row.getValue("Line_ID")
print "LINENO " + str(LINENO)
for lyr in arcpy.mapping.ListLayers(mxd):
print "lyr.name " + lyr.name
lyrname = lyr.name
if lyr.name in ["AllLines"]:
print "LINENUMBER = '" + str(LINENO) + "'"
lyr.definitionQuery = "LINENUMBER = '" + str(LINENO) + "'"
snapEnv = ["AllLines", "EDGE", "2 Meters"]
arcpy.Snap_edit("Points", [snapEnv])
del row, rows, mxd
... View more
08-01-2011
05:07 AM
|
0
|
0
|
730
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 1 | 12-01-2025 05:58 AM | |
| 1 | 11-21-2025 03:55 AM | |
| 1 | 11-14-2025 09:01 AM | |
| 1 | 11-13-2025 12:28 PM |
| Online Status |
Offline
|
| Date Last Visited |
Saturday
|