|
POST
|
I could not reproduce where the script is grabbing the incorrect data. I tried different scenarios (i.e. connected to the database as a user that has read privileges to all the feature class). Do you have service pack 3 installed for ArcGIS 10?
... View more
02-03-2012
07:35 AM
|
0
|
0
|
2836
|
|
POST
|
What do you receive when you run the following: import arcpy
from arcpy import env
env.overwriteOutput = True
mxd = arcpy.mapping.MapDocument("C:\TEMP\python\Airports.mxd")
broken = arcpy.mapping.ListBrokenDataSources(mxd)
for n in broken:
for lyr in arcpy.mapping.ListLayers(mxd, n):
print lyr.dataSource
del mxd Note: You will need to update the path to the MXD. You should receive something along the lines of: Database Connections\SDEConnection.sde\vector.VECTOR.ap All SDE feature classes come from a SDE connection file so '.sde' should be in the path.
... View more
02-03-2012
07:01 AM
|
0
|
0
|
2291
|
|
POST
|
Here is a preview of my table in SQL Server in design view with the primary key applied to the ID field: [ATTACH=CONFIG]11668[/ATTACH] Right-click on the ID field > Indexes/Keys > choose to Delete this index: [ATTACH=CONFIG]11669[/ATTACH] Right-click on the ID field > Indexes/Keys > create a new Clustered index: [ATTACH=CONFIG]11670[/ATTACH] Save the changes you have made, then import the table into the SDE geodatabase. Afterwards, the ID field will remain and a OBJECTID field will be created: [ATTACH=CONFIG]11671[/ATTACH] Note: The ID field will now be able to contain duplicates.
... View more
02-03-2012
06:54 AM
|
0
|
0
|
2660
|
|
POST
|
Hi Emily, You are correct about the unique key field. When importing a table to a geodatabase, the unique key field will automatically be changed to an OBJECTID field. Does the SQL table reside in the SDE geodatabase, or is it a separate database? If it is in the same SDE geodatabase you can use command line to register the table with the geodatabase and specify which field you would like to be the row ID column (unique key field). Ex: C:\> sdetable -o register -t XY -c ID -C SDE In the above example, I am specify the row ID column to be ID. Another option would be to drop the unique index on the SQL table field, recreate an index that is not unique, and then import the table into the geodatabase. Your original field will remain with the same values, and a OBJECTID field will be created. The OBJECTID field will be the new unique key field in this case.
... View more
02-03-2012
06:29 AM
|
0
|
0
|
2660
|
|
POST
|
Hi Michael, The 'serviceProperties' property will not work for broken data sources. However, the following should work to see which layers were stored in SDE:
mxd = arcpy.mapping.MapDocument("C:\TEMP\python\Airports.mxd")
broken = arcpy.mapping.ListBrokenDataSources(mxd)
for n in broken:
for lyr in arcpy.mapping.ListLayers(mxd, n):
if '.sde' in lyr.dataSource:
print lyr.name
del mxd
... View more
02-03-2012
05:42 AM
|
0
|
0
|
2291
|
|
POST
|
Hi Christina, Ultimately, what are you trying to do? From your first post it looks like you are trying to replace the feature class 'Airports' in your MXD with another feature class called 'AP'. You can do this with the following code: import arcpy
from arcpy import env
env.overwriteOutput = True
mxd = arcpy.mapping.MapDocument("C:\TEMP\Airports.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.dataSource == "Database Connections\\SDEConnection.sde\\LocalData.VECTOR.Airports":
lyr.replaceDataSource("Database Connections\\SDEConnection.sde", "SDE_WORKSPACE", "ap")
lyr.name = "AP"
mxd.saveACopy(r"C:\TEMP\NEW_Airports.mxd")
del mxd The above code is written for ArcSDE for SQL Server. It will find the layer that is in the LocalData database, owned by the user Vector, and is named "Airports". This is the line: if lyr.dataSource == "Database Connections\\SDEConnection.sde\\LocalData.VECTOR.Airports": Next, the replaceDataSource method updates this to the other feature class. I specify the Database Connection (you will not want to reference the new feature class name, only the SDE connection), the workspace type, and the new feature class to change the Airports feature class to. The next line: lyr.name = "AP" is simply renaming the layer in the table of contents. Then finally I am saving the MXD to a new MXD. Also, when specifying the SDE connection file, be sure to use '\\' instead of '\'. If you use '\', you will need to specify an 'r' in front of the path: r"Database Connections\SDEConnection.sde\LocalData.VECTOR.Airports"
... View more
02-03-2012
05:30 AM
|
0
|
0
|
2836
|
|
POST
|
Hi Nadeem, The link here provides suggestions on Oracle's configuration for ArcSDE 10. ArcSDE 9.3 can be found here.
... View more
02-03-2012
02:35 AM
|
0
|
0
|
1084
|
|
POST
|
I would recommend creating a Mosaic Dataset rather than a raster catalog. You will get much better performance than a raster catalog and this is core at 10. Not only will it provide better performance, but it will also save you 600 GB of storage space in the geodatabase. Here are some other helpful links on mosaic datasets: http://www.esri.com/news/arcuser/0610/mosaicdataset.html http://video.esri.com/tag/37/mosaic-dataset
... View more
02-01-2012
10:13 AM
|
0
|
0
|
931
|
|
POST
|
Below is an example on how I was able to accomplish this. The OBJECTIDs for the two feature classes were the same, so I first appended all the new features created for a polygon split. Then I compare the original geometry to each geometry in the subset feature class (excluding new features). If the geometry is different, I delete the original feature and update with the new feature (the other half of the geometry that was created from the polygon split). Since I used the OBJECTID I can only run this script once as the OBJECTIDs in the original feature class will change after the appends. import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"
env.overwriteOutput = True
fcA = "AirportsA"
fcB = "AirportsB"
OID_list = []
listB = []
# find max OBJECTID
rows = arcpy.SearchCursor(fcA)
for row in rows:
OID_list.append(row.OBJECTID)
del row, rows
maxOID = sorted(OID_list)[-1]
# append all geometries for AirportsB to list
rows = arcpy.SearchCursor(fcB)
for row in rows:
geom = row.Shape
listB.append(geom.area)
del row, rows
# append all new features to AirportsA feature class
arcpy.MakeFeatureLayer_management(fcB, "AirportsB_lyr", "OBJECTID > " + str(maxOID))
arcpy.CopyFeatures_management("AirportsB_lyr", "AirportsB_2")
arcpy.Append_management("AirportsB_2", fcA, "NO_TEST")
x = 0
# compare geometries from AirportsA to AirportsB
rows = arcpy.SearchCursor(fcA, "OBJECTID <= " + str(maxOID))
for row in rows:
geom = row.Shape
if geom.area != listB :
print "OBJECTID " + str(row.OBJECTID) + " has changed"
arcpy.MakeFeatureLayer_management(fcA, "AirportsA_lyr")
arcpy.SelectLayerByAttribute_management("AirportsA_lyr", "NEW_SELECTION", "OBJECTID = " + str(row.OBJECTID))
# delete original features that changed
arcpy.DeleteFeatures_management("AirportsA_lyr")
arcpy.MakeFeatureLayer_management(fcB, "AirportsB_lyr", "OBJECTID = " + str(row.OBJECTID))
# append new split feature
arcpy.Append_management("AirportsB_lyr", fcA, "NO_TEST")
x += 1
del row, rows
... View more
02-01-2012
06:35 AM
|
0
|
0
|
904
|
|
POST
|
Are you looking to convert your map of vector data to a TIFF, or convert the data itself to a TIFF? You can export your MXD to a TIFF by going to File > Export Map. Specify a TIFF and choose the option to create a world file. If you are looking to convert the actual data, you can do this using the conversion tools: Polygon to Raster Line to Raster Point to Raster If you want the data to represent elevation (i.e. a DEM) then you will need an attribute field containing the elevation values. You could then interpolate the points to a TIFF using the IDW tool in 3D or Spatial Analyst.
... View more
01-24-2012
08:57 AM
|
0
|
0
|
2590
|
|
POST
|
I was able to get this to work using the 'sdetable -o create', 'sdelayer -o add', and 'sdelayer -o alter'. Ex: Create a table: sdetable -o create -t parcels -d "PIN string(20)" -D vector -u vector Add a spatial column to the table including coordinate system: sdelayer -o add -l parcels,shape -e a -G 32614 -D vector -u vector Alter the coordinate system: sdelayer -o alter -l parcels,shape -G 32618 -D vector -u vector You should be able to alter the spatial index using the 'sdelayer -o alter' command: sdelayer -o alter -l parcels,shape -g GRID,300,1000,5000 -D vector -u vector I am currently using ArcSDE 10 SP3 and SQL Server 2008.
... View more
01-24-2012
08:45 AM
|
0
|
0
|
1621
|
|
POST
|
Currently, there is no command to create a feature class using the SDE commands. You can find a reference to all SDE commands in the admincmdref.htm file located at: C:\Program Files\ArcGIS\ArcSDE\Documentation\Admin_Cmd_Ref What are you trying to accomplish? There may be a solution using python, or some other procedure.
... View more
01-24-2012
07:57 AM
|
0
|
0
|
1621
|
|
POST
|
Not sure what could be causing this. Try downloading the attachment from here.
... View more
01-23-2012
08:05 AM
|
0
|
0
|
1774
|
|
POST
|
Have you tried downloading from a different browser. For example, if you are using Internet Explorer and are receive this error, try downloading using FireFox.
... View more
01-23-2012
05:17 AM
|
0
|
0
|
1774
|
|
POST
|
Hi Suhanats, You can find the max OBJECTID by appending the OIDs to a list and then retrieving the max value from the list. Ex: fc = "Airports"
OID_list = []
rows = arcpy.SearchCursor(fc, "", "", "OBJECTID")
for row in rows:
OID_list.append(row.OBJECTID)
del row, rows
maxOID = max(OID_list) Next you can use maxOID variable to select only the new records within the SQL table.
... View more
01-23-2012
04:45 AM
|
0
|
0
|
1014
|
| Title | Kudos | Posted |
|---|---|---|
| 4 | 05-07-2020 05:14 PM | |
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM | |
| 1 | 01-20-2026 04:04 AM |
| Online Status |
Online
|
| Date Last Visited |
2 hours ago
|