|
POST
|
I use to work in Tech Support and came across this issue quite a few times. Here are queries that you can run that will remove all the entries from the SDE, GDB, and base tables. These queries should only be run AFTER you create a database backup. ESRI rarely recommends editing tables directly within the geodatabase, but this is the only solution that I've been able to find in these situations. As vangelo recommended, I would follow up with Tech Support before running these queries. Also, the below queries are for ArcSDE 9.x for SQL Server. use <database>
select rastercolumn_id from sde.sde_raster_columns where table_name = '[table_name]'
select ID from sde.gdb_objectclasses where name = '[table_name]'
select layer_id from sde.sde_layers where table_name = '[table_name]'
--Recall the three numbers from these queries. Then run the following queries:
use <database>
delete from sde.sde_table_registry where table_name = '[table_name]'
delete from sde.sde_layers where table_name = '[table_name]'
delete from sde.gdb_rastercatalogs where objectclassid = [number from above sde.sde_raster_columns query]
delete from sde.gdb_objectclasses where Name = '[table_name]'
delete from sde.sde_raster_columns where table_name = '[table_name]'
delete from sde.sde_geometry_columns where f_table_name = '[table_name]'
DROP TABLE <owner>.<table_name>
DROP TABLE <owner>.sde_aux_<# from above rastercolumn_id query>
DROP TABLE <owner>.sde_bnd_<#>
DROP TABLE <owner>.sde_blk_<#>
DROP TABLE <owner>.sde_ras_<#>
DROP TABLE <owner>.f[number from above sde_layers query]
DROP TABLE <owner>.s[number from above sde_layers query]
... View more
07-25-2011
10:38 AM
|
0
|
0
|
1329
|
|
POST
|
You can create a script to do this. Below is an example: import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.mdb"
inputTable = "XY"
lstFields = arcpy.ListFields(inputTable, "Lat")
for field in lstFields:
name = field.name
precision = field.precision
length = field.length
fieldtype = field.type
scale = field.scale
domain = field.domain
alias = field.aliasName
env.workspace = r"C:\temp\python\Test2.mdb"
lstTables = arcpy.ListTables("*")
for table in lstTables:
arcpy.AddField_management(table, name, fieldtype, precision, scale, length, alias, "", "", domain)
print "Successfully added field" The code exports the name, precision, etc from a table called 'XY' in geodatabase Test1 and then adds a new field to each table in geodatabase Test2.
... View more
07-25-2011
10:24 AM
|
0
|
0
|
1807
|
|
POST
|
I have not submitted this as a bug. Feel free to do so if you'd like, I'm not sure that I will have the time. Mosaic Datasets are a hybrid of raster datasets and raster catalogs. They render extremely fast due to the mosaic dataset's overviews. Mosaic Datasets render just as fast as raster datasets, plus you receive the additional benefits that the mosaic dataset has to offer. I would recommend taking a look at the following video to see how great and easy to use Mosaic Datasets are.
... View more
07-21-2011
11:38 AM
|
0
|
0
|
1972
|
|
POST
|
Looks like this may be a bug for the replaceDataSource method and raster datasets. However, this works with Mosaic Datasets. Have you considered migrating your large raster mosaics to Mosaic Datasets? This is a much more efficient way to manage your imagery at ArcGIS 10. The mosaic dataset makes it easy for you to manage, search, and discover imagery in collections of any size. The mosaic dataset catalogs image and raster data sources, stores detailed metadata, and defines how imagery should be transformed into different products on the fly without the need to preprocess. The mosaic dataset includes: �?� Dynamic mosaicking for efficient handling of overlapping imagery �?� On-the-fly processing to create multiple products from a single source �?� Management and accessibility to metadata �?� Integration for multiple disparate image sensors and formats �?� Streamlined data maintenance and updates of new imagery The mosaic dataset also saves time and storage space. The mosaic dataset simply reads the images from their native file locations and format. Since it reads the data from their native file locations it is extremely fast to create mosaic datasets. Loading large rasters into SDE that took hours will only take seconds now and you will no longer have to allocated the storage space in your SDE database to accomodate these large rasters.
... View more
07-21-2011
08:34 AM
|
0
|
0
|
1972
|
|
POST
|
You can update the layer name by searching for a keyword and then replacing the text. I was working on a similar script earlier this morning. I added this functionality to it. import arcpy, os
from arcpy import env
from arcpy import mapping
env.workspace = workspace = arcpy.GetParameterAsText(0)
env.overwriteOutput = True
for (path, dirs, files) in os.walk(workspace):
for file in files:
if ".mxd" in file.lower():
mxd = os.path.join(path, file)
print mxd + " is being processed"
mxd = mapping.MapDocument(mxd)
for df in mapping.ListDataFrames(mxd, "*"):
for lyr in mapping.ListLayers(mxd, "*", df):
lyr.replaceDataSource(arcpy.GetParameterAsText(1), "SDE_WORKSPACE", "")
print "Successfully updated data sources"
if "vector" in lyr.name:
lyr.name = "RASTER.DATALOADER." + lyr.name.split(".")[2]
print "Succesfully changed layer name"
mxd.save()
del mxd The previous database name was "vector", so the feature classes were listed as "vector.dataloader.parcels". I created and IF statement to find all layer names containing vector and renamed the layers to the new database raster: if "vector" in lyr.name:
lyr.name = "raster.dataloader." + lyr.name.split(".")[2]
... View more
07-20-2011
11:07 AM
|
0
|
0
|
1972
|
|
POST
|
Are you trying to Sum the two lists together based on the index of each list? Ex: listA = [1,2,3,4,3,2,1] listB = [7,8,9,5,4,3,1] index[0] = 7 + 1 = 8 index[1] = 8 + 2 = 10 index[2] = 9 + 3 = 12 If you are, you can use the following code to do this: import os
listA = [1,2,3,4,3,2,1]
listB = [7,8,9,5,4,3,1]
listC = []
x = 0
while x < len(listA):
listC.append(listB + listA )
x += 1
print listC
... View more
07-20-2011
07:41 AM
|
0
|
0
|
2626
|
|
POST
|
Thanks, Ruth! The 'replaceDataSource' method was exactly what I needed. I was able to get this working with the following code:
import arcpy
from arcpy import env
from arcpy import mapping
env.workspace = workspace = arcpy.GetParameterAsText(0)
env.overwriteOutput = True
mxdList = arcpy.ListFiles("*.mxd")
for mxd in mxdList:
mxd = workspace + "\\" + mxd
print mxd + " is being processed"
mxd = mapping.MapDocument(mxd)
for df in mapping.ListDataFrames(mxd, "*"):
for lyr in mapping.ListLayers(mxd, "*", df):
lyr.replaceDataSource(arcpy.GetParameterAsText(1), "SDE_WORKSPACE", "")
print "Successfully updated data sources"
mxd.save()
del mxd
... View more
07-19-2011
11:17 AM
|
2
|
4
|
1827
|
|
POST
|
You can use the 'Create File Geodatabase' or 'Create Personal Geodatabase' tool to create a 9.3 geodatabase and then copy the data from your 10 geodatabase to the 9.3 geodatabase using ArcGIS 10.
... View more
07-18-2011
11:59 AM
|
0
|
0
|
287
|
|
POST
|
It looks you are missing a ',' between OBJECTID and SDE for the -C option. Here is an example on registering a table: SQL> CREATE TABLE building (OBJECTID INTEGER, shape SDE.ST_GEOMETRY);
SQL> INSERT INTO building VALUES (1, SDE.ST_Polygon ('polygon ((0 0, 0 10, 10 10, 10 0, 0 0))', 2));
SQL> INSERT INTO building VALUES (2, SDE.ST_Polygon ('polygon ((20 0, 30 20, 40 0, 20 0))', 2));
SQL> INSERT INTO building VALUES (3, SDE.ST_Polygon ('polygon ((20 30, 25 35, 30 30, 20 30))', 2));
SQL> create index bf_indx on building(shape) indextype is SDE.ST_spatial_index parameters = ('SDE.ST_grids=1,0,0 SDE.ST_srid=2');
$ sdelayer -o regiSDE.STer -l building,shape -e nac+ -C OBJECTID,SDE -P HIGH -t SDE.ST_GEOMETRY -i 5151 -u vector -p vector
... View more
07-18-2011
11:53 AM
|
0
|
0
|
933
|
|
POST
|
Try removing the 417th file and then re-execute the script to see if it works. The file may be corrupted.
... View more
07-18-2011
11:30 AM
|
0
|
0
|
926
|
|
POST
|
Is it possible to change the data source of an MXD to another SDE geodatabase? I've tried this, but have only been able to get this to work when switching versions within the same SDE geodatabase. Ex: import arcpy
from arcpy import env
env.workspace = workspace = r"C:\temp\python"
env.overwriteOutput = True
mxdList = arcpy.ListFiles("*.mxd")
for mxd in mxdList:
mxd2 = workspace + "\\" + mxd
mapdoc = arcpy.mapping.MapDocument(mxd2)
mapdoc.findAndReplaceWorkspacePaths(r"C:\TEMP\Python\VECTOR_Default.sde", r"C:\TEMP\Python\VECTOR_QAQC.sde")
mapdoc.save()
del mapdoc The above code works as I am switching from one version (SDE.Default) to another version (SDE.QAQC) within the same VECTOR geodatabase. When I try to switch to another SDE geodatabase that contains the same feature class (same owner and feature class name, just different database), it does not work. Ex: import arcpy
from arcpy import env
env.workspace = workspace = r"C:\temp\python"
env.overwriteOutput = True
mxdList = arcpy.ListFiles("*.mxd")
for mxd in mxdList:
mxd2 = workspace + "\\" + mxd
mapdoc = arcpy.mapping.MapDocument(mxd2)
mapdoc.findAndReplaceWorkspacePaths(r"C:\TEMP\Python\VECTOR_Default.sde", r"C:\TEMP\Python\RASTER_Default.sde")
mapdoc.save()
del mapdoc Thanks for any suggestions!
... View more
07-18-2011
11:14 AM
|
1
|
6
|
4951
|
|
POST
|
Below is an example on how you can do this using the Field Calculator. Be sure to check 'Python' at the top and 'Show Codeblock'. Under 'Pre-logic Script Code' enter the following: def update():
import arcpy
list = []
rows = arcpy.SearchCursor(r"C:\data\Parcels")
for row in rows:
list.append(row.AREA)
S = sum(list)
del row, rows
rows = arcpy.UpdateCursor(r"C:\data\Parcels")
for row in rows:
row.AREA2 = S
val = row.AREA2
del row, rows
return val Then, under the second block enter: update()
... View more
07-08-2011
05:35 AM
|
0
|
0
|
783
|
|
POST
|
Below is an example on how to do this. The code adds all the shapefiles first two characters to a list, then removes the duplicates. It will then merge the related shapefiles together to one shapefile. lstFCs = arcpy.ListFeatureClasses("*")
list1 = []
# Append first two characters of each shapefile to list
for fc in lstFCs:
list1.append(fc[0:2])
# Remove duplicates from list
list1 = dict.fromkeys(list1)
list1 = list1.keys()
# Merge feature classes
for n in list1:
m = str(n) + "*"
lstFCs = arcpy.ListFeatureClasses(m)
arcpy.Merge_management(lstFCs, n + "_merge")
... View more
07-07-2011
04:08 AM
|
0
|
0
|
926
|
|
POST
|
In order to update the symbology for layers within MXD using another MXD as the source, you will need to use the 'arcpy.mapping.ListLayers' function rather the the 'arcpy.mapping.Layer'. Here is an example below on how you can accomplish this:
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\temp\Final_Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
lstLayers = arcpy.mapping.ListLayers(mxd, "Rivers*", df)
mxd2 = arcpy.mapping.MapDocument(r"C:\temp\Source.mxd")
df2 = arcpy.mapping.ListDataFrames(mxd2, "*")[0]
for layer in lstLayers:
updateLayer = layer
sourceLayer = arcpy.mapping.ListLayers(mxd2, "River", df2)[0]
arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, True)
mxd.save()
print "Updated symbology successfully"
del mxd You can copy/paste the syntax above to update the Roads and Building layers as well.
... View more
06-27-2011
08:19 AM
|
0
|
0
|
582
|
|
POST
|
If you have an ArcEditor license for ArcGIS 10 you can use the 'arcpy.FlipLine_edit' function to reverse the direction of your polyline data.
... View more
06-27-2011
06:52 AM
|
0
|
0
|
748
|
| 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 |
Friday
|