|
POST
|
I had success earlier today updating the SDE connection files using mxd.replaceWorkspaces. I was trying to do something similar for datasources on a network drive by trying to replace the drive letter with the UNC path. When I try to use lyr in my earlier code (I know I'm using a different method) I get the same or similar ValueError.
for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.supports("WORKSPACEPATH"):
wp = lyr.workspacePath
if '@RockGIS2' or 'RockGIS' in wp:
print wp
#mxd.replaceWorkspaces("", "NONE", r"\\gisserver2\GIS_Resources\DirectConnect_ArcCatalog_ConnectionFiles\gisuser@rockgis2.sde","SDE_WORKSPACE")
lyr.findAndReplaceWorkspacePath(wp, r"\\gisserver2\GIS_Resources\DirectConnect_ArcCatalog_ConnectionFiles\gisuser@RockGIS2.sde")
if '@RockRaster' in wp:
... View more
08-28-2014
02:15 PM
|
0
|
2
|
1724
|
|
POST
|
I want to partially change the path for layers in an mxd from a letter drive to a UNC path. The help page for updating and fixing datasources with arcpy states "...allows you to substitute an entire or partial string for a layer..." but I cannot figure out how to partially replace a path. I have an mxd with one layer that points to W:\Data\City\Planimetric\xyz_planimetric_data_2011.mdb This doesn't change the path.
import arcpy
mxd = arcpy.mapping.MapDocument(r'C:\GIS\test\AppServerConnections.mxd')
for lyr in arcpy.mapping.ListLayers(mxd):
wp = lyr.workspacePath
if 'W:' in wp:
nwp = r"\\\gisserver2" + wp[2:]
mxd.findAndReplaceWorkspacePaths(wp,nwp)
mxd.saveACopy(r"c:\gis\test\test2.mxd")
del mxd
if I substitute add a print statement here
if 'W:' in wp:
nwp = r"\\gisserver2" + wp[2:]
print nwp
it prints as I would expect: \\gisserver2\Data\City\Planimetric\xyz_planimetric_data_2011.mdb What am I missing?
... View more
08-28-2014
01:07 PM
|
0
|
8
|
3551
|
|
POST
|
I ran into the same problem. My workaround was to use the workspacepath property in the layer class
... View more
08-28-2014
09:19 AM
|
0
|
0
|
1000
|
|
POST
|
The solution is that the IIF operator requires 3 arguments. My expression should have been written as IIF([DIAMETER] >=16, "250", NULL) ESRI tech support helped me understand I needed the 3rd argument. It was actually very helpful to know this because it meant that I could write the expression as: IIF([DIAMETER] >=16, "250", "350"). If the pipe diameter is greater or equal to 16 then populate the description field as "250" otherwise populate the description field as "350". It saved me from need adding a second expression record in the dynamic table. The example on this page has a good description: http://msdn.microsoft.com/en-us/library/27ydhh0d(v=vs.90).aspx I want to populate the value in the field "description" when the value in "diameter" is created or changed. tableName - water_pipes fieldName - description valueMethod - expression valueInfo - IIF([DIAMETER] >=16, "250") onCreate - True onChange (attribute) - True onChange (geometry) - false manualOnly - False I've tried both creating a new feature and changing the value of an existing feature attribute but this expression is not working. Any ideas? I've looked through the forum and found much more complicated expressions that this seems simple in comparison.
... View more
03-17-2014
09:06 AM
|
0
|
0
|
1084
|
|
POST
|
Yes. The diameter will be constrained by a range domain. Let me rephrase it. Will there be a set number of diameters?
... View more
03-14-2014
08:11 AM
|
0
|
0
|
1084
|
|
POST
|
No. Right now this is a simple test to see if I can get this to work. There are no subtypes or domains on these fields. The diameter field has a type of double. The description field has a field type of text, length=60. Are there a set number of diameters? If so you should create a subtype of the diameters. Enter the values for the Diameter as you create the different subtypes. Then in the dialog below the subtypes are your different attributes. When you select your first diameter (in the subtype dialog) go to the attribute and fill in the default value for the description. You can do this for each subtype.
... View more
03-14-2014
07:42 AM
|
0
|
0
|
1084
|
|
POST
|
I want to populate the value in the field "description" when the value in "diameter" is created or changed. tableName - water_pipes fieldName - description valueMethod - expression valueInfo - IIF([DIAMETER] >=16, "250") onCreate - True onChange (attribute) - True onChange (geometry) - false manualOnly - False I've tried both creating a new feature and changing the value of an existing feature attribute but this expression is not working. Any ideas? I've looked through the forum and found much more complicated expressions that this seems simple in comparison.
... View more
03-14-2014
07:25 AM
|
0
|
5
|
4158
|
|
POST
|
Does the new alter field tool in 10.2.1 require that the enterprise geodatabase be upgraded to 10.2.1 in addition to the clients? Our organization just went through a major, months long upgrade from 9.3 to 10.2 on all clients and our SDE geodatabase. If I could get away with just updating my client to 10.2.1 and not the SDE geodatabase to get this functionality that would be great. - Mike
... View more
01-15-2014
06:45 PM
|
0
|
7
|
3392
|
|
POST
|
Here is the response I received from ESRI tech support: "Either method would be appropriate, however, tracking using editor tracking may be a better alternative than using the Attribute Add-In. The attribute add-in works at the client level which can be disabled when upgrading the software or if the client machine forgets to turn it on. In some scenarios, it may be better to turn on editor tracking since it works at the database level tracking edits. This means that when upgrading the software or when changing machines, you may not lose this functionality.
... View more
09-06-2013
12:03 PM
|
0
|
0
|
372
|
|
POST
|
I am exploring ways to automate the recording of the user name and date when a record is edited. It seems that editor tracking and the methods "current username" and "timestamp" in the Attribute Assistant Add-in offer two paths to doing the same thing. Is one favored over the other? Are these methods meant to be complementary?
... View more
09-03-2013
07:44 AM
|
0
|
1
|
880
|
|
POST
|
I misread the example I was following about how to use rstrip. Instead of using the number of characters I want removed I should use the actual characters! In my example I should have used '.sid' and it works.
... View more
08-20-2013
11:22 AM
|
0
|
0
|
1643
|
|
POST
|
I want to strip off the last 4 characters of a layer name that is in my mxd. It is the only layer. It is a MrSid file. I want to export this image to pdf using the layer name without the .sid part. This code exports the map to PDF but it is not stripping off the .sid part. Ex: J-228-01-W-2013.sid.pdf I used 4 as the number of characters to strip off because I assumed that the dot needs to be removed also. import arcpy,os
mxd = arcpy.mapping.MapDocument(r"C:\GIS\designsheet.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.rotation = 0
lname = arcpy.mapping.ListLayers(mxd)[0].name
outFile = r"C:\GIS\output\\" + lname.rstrip('4') + ".pdf"
arcpy.mapping.ExportToPDF(mxd, outFile) - Mike
... View more
08-20-2013
11:18 AM
|
0
|
2
|
2450
|
|
POST
|
Finally figured it out. I needed to add esri.geometry.geographicToWebMercator(new esri.geometry.Point to this line var pt = new esri.geometry.Point(ptX,ptY,map.spatialReference); to make var pt = new esri.geometry.Point(esri.geometry.geographicToWebMercator(new esri.geometry.Point(ptX,ptY,map.spatialReference))); and it worked. I still don't quite understand why I had to do this but I will leave that to a discussion post.
... View more
05-01-2013
06:50 AM
|
0
|
0
|
929
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-05-2025 11:56 AM | |
| 1 | 11-27-2024 11:10 AM | |
| 22 | 08-12-2024 11:06 AM | |
| 1 | 02-01-2019 08:27 AM | |
| 2 | 04-23-2024 08:44 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-06-2025
12:09 PM
|