|
POST
|
Are you using 10.3.0? I can't reproduce this at 10.3.1. According to the documentation this would be classified as a bug. As a side note, if you're just trying to avoid the sde layers have you tried checking if the layer supports "DATASOURCE" (online services won't support this) and if the layer.datasource contains ".sde"?
... View more
12-03-2015
09:15 AM
|
1
|
0
|
1371
|
|
POST
|
ModelBuilder wouldn't allow you to delete the fields with the tools that are available out-of-the-box. You could use the Feature Classes Iterator with the recursive property set to true to locate all of the feature classes, but you would need to write a python tool or function to get the names of the fields that you'd be able to delete from the feature class (i.e. fields that aren't of type Geometry or OID). The logic needed could probably be execute with a single line in the Calculate Value tool or at least three lines in a script tool. The logic would be based on the following to list the needed fields to create the MultiValue object needed to pass to the Delete Field (Data Management) tool. [f.name for f in arcpy.Describe(fc).fields if f.type not in ("Geometry", "OID") and f.name not in ("UnitID")] Iterate Feature Classes http://desktop.arcgis.com/en/desktop/latest/tools/modelbuilder-toolbox/iterate-feature-classes.htm Examples of using iterators in ModelBuilder http://desktop.arcgis.com/en/desktop/latest/tools/modelbuilder-toolbox/examples-of-using-iterators-in-modelbuilder.htm#ESRI_SECTION1_46903073A36D4E928AAFC0F0AE5240EC Calculate Value http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/calculate-value.htm Delete Field http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/delete-field.htm If your end goal is to delete the fields so that you can copy the feature class to another source you may be able to accomplish this task with the out-of-the-box tools in a number of ways. The first way that I could think of would be to create a new feature class with the CreateFeatureClass (Data Management) tool, add your needed field with the Add Field (Data Management) tool, and then use the Append (Data Management) tool to only map the Shape and ID fields. A quicker way to accomplish this would be to simply call the Feature Class to Feature Class (Conversion) tool and provide a fieldmappings object that only retains the few fields that you're needing to retain. Create Feature Class http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/create-feature-class.htm Add Field http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/add-field.htm Append http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/append.htm Feature Class To Feature Class http://desktop.arcgis.com/en/desktop/latest/tools/conversion-toolbox/feature-class-to-feature-class.htm Using the field mapping control http://desktop.arcgis.com/en/desktop/latest/analyze/executing-tools/using-the-field-mapping-control.htm
... View more
12-02-2015
11:01 PM
|
1
|
0
|
2048
|
|
POST
|
I believe that there should be plenty of samples in the book to help you with your task, but I've never honestly gone through the book. I usually just pull it up when I need to look to see if it has examples for interfaces I don't use that often. One of my colleagues, Alexander Nohe, learned ArcObjects recently and may have used this book. He may be able to give some insight on the usefulness of it.
... View more
11-30-2015
12:49 PM
|
3
|
1
|
1692
|
|
POST
|
Could you provide more specifics on exactly what you're needing to implement and display some code showing what you have so far? Are you needing to implement something that you can't implement using the rules available to an enterprise geodatabase? Also, have you tried implementing a class extension or wiring into the edit events? Working with Edit Events http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Working_with_editing_events/000100000154000000/ Creating Class Extensions http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Creating_class_extensions/000100000201000000/
... View more
11-30-2015
12:54 AM
|
1
|
0
|
403
|
|
POST
|
I just took a look at the toolbox and it is indeed showing signs of being corrupt. Could you upload a backup of this file that worked at 10.1? I can load it on a 10.1 machine on my end just in case there is some issue with 10.3.1 and this particular instance of your model. Also, do you remember exactly what was done when you upgraded your system? Did you only uninstall and install the newer version of ArcGIS Desktop and the models didn't show up? Did you apply any Microsoft updates or run any security scans? etc. I know that I've heard of users that have run into this issue, but I've never been able to replicate it personally.
... View more
11-30-2015
12:42 AM
|
1
|
0
|
2375
|
|
POST
|
In task scheduler are you explicitly setting the 32 bit python executable to run your script or are you using the default for the system? I would highly suggest that you explicitly set the python executable if your default isn't the 32bit instance. I'm assuming the default on your machine is the 64 bit instance.
... View more
11-30-2015
12:31 AM
|
0
|
1
|
2231
|
|
POST
|
I can see that you're running your code against the 64-bit install of python. I'd be curious to find out if your code works against the 32-bit install of python. I won't be able to test this against the 64-bit install until Monday, but everything works fine on my machine. Could you try running the attached script? I've included a map package that the code can run against to create the runtime content. I've pasted the code below as well. The code is designed to extract a map document from the map package and use it to create the runtime content. import arcpy
import subprocess
from os import path, walk
def ExtractMpk(mpkPath):
outFolder = mpkPath.replace(".mpk", "_extracted")
if arcpy.Exists(outFolder):
arcpy.management.Delete(outFolder)
arcpy.management.ExtractPackage(mpkPath, outFolder)
mxdPaths = []
for root, dirs, files in walk(outFolder):
for name in files:
if name.endswith(".mxd"):
return path.join(root, name)
return None
def ValidateMxd(mxdPath, filler="Test"):
mxd = arcpy.mapping.MapDocument(mxdPath)
empty = (None, "", " ")
for attr in ("author", "credits", "description", "summary", "tags", "title"):
if getattr(mxd, attr).strip() in empty:
setattr(mxd, attr, filler)
naLayer = False
for df in arcpy.mapping.ListDataFrames(mxd):
if df.description.strip() in empty:
df.description = filler
for lyr in arcpy.mapping.ListLayers(mxd, data_frame=df):
if lyr.description.strip() in empty:
lyr.description = filler
if lyr.isNetworkAnalystLayer:
naLayer = True
mxd.save()
return naLayer
def CreateRtContent(mxdPath, naLayer=False):
outFolder = mxdPath.replace(".mxd", "_rtc")
if arcpy.Exists(outFolder):
arcpy.management.Delete(outFolder)
params = {"extent":"MAXOF", "optimize":"NON_OPTIMIZE_SIZE", "options":"FEATURE_AND_TABULAR_DATA"}
if naLayer: params["options"].extend(["NETWORK_DATA"])
arcpy.management.CreateRuntimeContent(mxdPath, outFolder, **params)
# Open the folder where the runtime content is created.
subprocess.Popen("explorer {0}".format(outFolder))
if __name__ == "__main__":
srcPath = path.dirname(__file__)
mpkPath = path.join(srcPath, "MapPackage.mpk")
# Extract the included map package
mxdPath = ExtractMpk(mpkPath)
# Validate the map document
naLayer = ValidateMxd(mxdPath)
# Create Runtime Content
CreateRtContent(mxdPath, naLayer)
... View more
11-27-2015
08:23 PM
|
1
|
3
|
2231
|
|
POST
|
Are you having some problems using ArcMap 10.3.1. with Runtime .NET? I believe that you should be able to use any version of ArcMap 10.1.1 or higher to create runtime enabled map packages and 10.2.X or higher to create runtime content.
... View more
11-25-2015
05:53 PM
|
0
|
0
|
797
|
|
POST
|
What are you trying to accomplish with the following logic? sourceFieldsList = ["TARGET_FID", poly,"SiteAddress",'SiteNum_1', 'SiteStreet_1','SiteNumSfx_1','Predir_1','SiteStreet_1', 'Postdir_1', 'SiteCity_1', 'SiteZIP_1', 'OwnerName_1','StreetType_1']
sourceFieldsList['SiteStreet_1'] + " " + sourceFieldsList['StreetType_1'] You won't be able to slice a list in python with a string. Are you trying to get the index of the word in the list?
... View more
11-25-2015
09:54 AM
|
2
|
0
|
1430
|
|
POST
|
I would think that the simplest way I could get your code to work is as follows. You'll see that I'm creating a Guid to give me a unique name for your new feature class. import arcpy
from os import path
from uuid import uuid4
for k, v in FCFDdict.items():
fcName = "{}_{}".format(*[path.basename(k), str(uuid4()).split("-")[0].upper()])
arcpy.conversion.FeatureClassToFeatureClass(k, v, fcName)
... View more
11-25-2015
09:10 AM
|
1
|
0
|
492
|
|
POST
|
Hi Trillium, Your problem should be that you're trying to export the feature class to a new feature dataset with the same name. Names must be unique within a geodatabase. So in your case you can't have both FD_A\infotafeln_1 and FD_A_redefined\infotafeln_1. You would have to rename the new feature class to another unique name that doesn't exist in the entire geodatabase. To prove this I've provided the code I used to test. You should be able to run this on your machine to confirm. You'll see in the new instance that I add an underscore to the name to make it unique. import arcpy
import os
import unittest
# This will create a geodatabase similar to yours
def CreateUserEnvironment(gdbPath):
gdbContents = [("FD_A", ["infotafeln_1"]),
("FD_B", ["sielhautproben_2", "infotafeln_2"]),
("FD_A_redefined", []),
("FD_B_redefined", [])]
if arcpy.Exists(gdbPath):
arcpy.management.Delete(gdbPath)
arcpy.management.CreateFileGDB(os.path.dirname(gdbPath), os.path.basename(gdbPath))
for ds, fcs in gdbContents:
dsPath = arcpy.management.CreateFeatureDataset(gdbPath, ds, arcpy.SpatialReference(3857))
for fc in fcs:
arcpy.management.CreateFeatureclass(dsPath, fc, "POINT", spatial_reference=arcpy.Describe(dsPath).spatialReference)
def TestWorkflow(gdbPath):
expPath = {"{0}\\FD_A\\infotafeln_1".format(gdbPath):"{0}\\FD_A_redefined".format(gdbPath),
"{0}\\FD_B\\sielhautproben_2".format(gdbPath):"{0}\\FD_B_redefined".format(gdbPath),
"{0}\\FD_B\\infotafeln_2".format(gdbPath):"{0}\\FD_B_redefined".format(gdbPath)}
for k,v in expPath.items():
# Workflow you're currently implementing
try:
print("Exporting to new feature dataset with same name")
arcpy.conversion.FeatureClassToFeatureClass(k, v, os.path.basename(k))
except arcpy.ExecuteError as e:
print(e.message)
# Workflow I'm suggesting
try:
print("Exporting to new feature dataset with different name")
arcpy.conversion.FeatureClassToFeatureClass(k, v, os.path.basename(k) + "_")
print(arcpy.GetMessages())
except arcpy.ExecuteError as e:
print(e.message)
print("*"*25 + "\n")
if __name__ == "__main__":
gdbPath = os.path.join(os.path.dirname(__file__), "MyData.gdb")
CreateUserEnvironment(gdbPath)
TestWorkflow(gdbPath)
... View more
11-25-2015
09:05 AM
|
1
|
2
|
4249
|
|
POST
|
When I need to write scripts that are backwards compatible with 9.X I always start by writing the script using the arcgisscripting to create the dispatch object and quickly check the install version. I will limit my use of arcpy in the code so that I can reduce the amount of redundancy. If there is a functionality that I need to use that is only available in 10.X and the users machine shows a valid version I'll quickly import arcpy and execute that task. The biggest problem you'll see when writing a script that is compatible with 9.X is going to be the change in case for functions\methods. 9.X functions used PascalCase, whereas 10.X functions use camelCase. For example, if you're using a cursor at 9.X you'd need to call row.GetValue, whereas arcpy would require that you call row.getValue.
... View more
11-24-2015
05:03 PM
|
1
|
1
|
699
|
|
POST
|
When importing arcpy the default systems toolboxes are already loaded (i.e. the toolboxes located at <ArcGIS Install Path>\ArcToolbox\Toolboxes. This was a new functionality introduce at 10.0 with arcpy. Prior to this, when creating the gp object you would need to load each toolbox that prior to using it via a call to gp.AddToolbox. When using a custom toolbox you'd need to call AddToolbox at 9.3 or earlier and ImportToolbox at 10.0 or higher. The problem you're having with the spatial analyst tools are now part of their own module in the arcpy site package. You would call them as functions in the same manner as when you using the arcpy.mapping or arcpy.na modules. Importing arcpy http://desktop.arcgis.com/en/desktop/latest/analyze/python/importing-arcpy.htm I would assume that the error you're seeing is because you're calling ExtractValuesToPoints_sa and there is no function available with this name. You would either need to call arcpy.sa.ExtractValuesToPoints or if you import all of the functions from the sa module (i.e. import * from sa) you would use only the function name ExtractValuesToPoints. (Note the missing "_sa" part. This was intentionally left out because it isn't part of the function name)
... View more
11-24-2015
04:56 PM
|
1
|
1
|
2789
|
|
POST
|
11-24-2015
04:47 PM
|
2
|
1
|
2789
|
|
POST
|
For the raster question, what happens if you call the function directly? import arcpy
from arcpy.sa import *
arcpy.env.workspace = "C:/sapyexamples/data"
arcpy.CheckOutExtension("Spatial")
ExtractValuesToPoints("rec_sites.shp", "elevation", "C:/sapyexamples/output/outValPnts", "INTERPOLATE", "VALUE_ONLY")
... View more
11-24-2015
04:11 PM
|
0
|
1
|
2789
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-19-2016 04:45 AM | |
| 1 | 09-24-2015 06:45 AM | |
| 1 | 09-15-2015 10:49 AM | |
| 1 | 10-12-2015 03:07 PM | |
| 1 | 11-25-2015 09:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|