Reputation
2,499
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
3 17
Impact
~24k people reached

Aug
26
comment How do I figure out the length of polyline features in a feature class with a WGS 1984 coordinate system?
@Mintx that is a good point. You could use any projection in there, I just used web Mercator as an example I thought everyone would be familiar with.
Aug
21
comment get the outline of a polygon
Here are code samples in multiple languages, pick your poison: en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/…
Aug
21
comment Creating a ValueTable with a column that has dependency
I just typed those in. These value tables seem kind of limited on what you can do. I have been tinkering with it and cannot seem to get more than one drop down to work. I thought I would be able to do nested lists in the UpdateParameters method, something like parameters[2].filter.list = [[fieldList, lookupTable] for fieldList, lookupTable in valuetable] but this didn't work either. It may not be possible in a PYT.
Aug
21
comment get the outline of a polygon
Sounds like you want a convex hull.
Aug
21
comment Creating a ValueTable with a column that has dependency
Haha, ok. I was able to get it to work, but I think in order to use parameter dependencies you have to have the Fields as the first column in the Value Table. Se my answer below.
Aug
21
comment Front-end GUI for a spatial database
Do you have ArcGIS Server or an ArcGIS Online Organization account? If you have these resources available, a simple web map with a feature service set up for tree planting sites would allow users to edit the database through a web application.
Aug
21
comment Creating a ValueTable with a column that has dependency
Someone can correct me if I'm wrong here, but if this what you are wanting to do, I don't think it's possible to set a filter on the Field column of your value table based on the Lookup Table value in that same row in a PYT. You might be able to customize this in .NET, but I'm not sure. It would be awesome though if Esri implemented an advanced filter option where you could dynamically change filters in each row of the Value Table.
Aug
21
comment Creating a ValueTable with a column that has dependency
Typically, you would set parameter dependencies like this: param2.parameterDependencies = [param1.name]. But it sounds like you want the user to add a table into the Value Table as a "Lookup Table", and then choose a field from that? Is that what you mean?
Aug
20
comment Calculating geometry for feature class with x/y and Lat/Long values in different projections?
Looks like you need to capitalize the S in SpatialReference. Python is a case sensitive language.
Aug
20
comment Getting coordinates at location n meters from known point to NW and SE using ArcPy?
Yep, it should work in any projection, just make sure you pass that WKID into the arcpy.SpatialReference() class.
Aug
19
comment What is the purpose of arcpy.Array()?
There's a lot of speculation here, but from what I think I understand, arcpy is a wrapper on the arcgisscripting.pyd (essentially a DLL) which I think is a course grained wrapper of a lot of ArcObjects functionality written in C++. I do know for a fact that ArcObjects is not directly exposed in arcpy/arcgisscripting but you can get at them using the comtypes module. My main point is I think that using arcpy.Array packages up a point collection in a C/C++ like object for easier translation into arcgisscritping, hence as @dmahr suggested may happen in mixins.py.
Aug
18
comment What is the purpose of arcpy.Array()?
I could be wrong here, but I believe that under the hood arcpy.Array is creating a Python object equivalent of the ArcObjects IPointArray interface, which is a required input for constructing line/polygon geometries. resources.arcgis.com/en/help/arcobjects-net/componenthelp/…
Aug
18
comment Calculate and Restart Sequential ID for Unique Values in a Field
This code will not be very efficient if there are a lot of unique values as you are creating a new cursor for each one.
Aug
12
comment Determining local geodatabase release version with arcpy?
@ian...Well that explains a lot! Good catch!
Aug
12
comment Determining local geodatabase release version with arcpy?
Also, I think I know why InitStandalone() is failing for you. See EDIT2 in my answer.
Aug
12
comment Determining local geodatabase release version with arcpy?
Yes, this will not work on a personal geodatabase, because it is calling esriDataSourcesGDB.FileGDBWorkspaceFactory. In order to open a personal gdb, you need to use the esriDataSourcesGDB.AccessWorkspaceFactory class and cast it to the same esriGeoDatabase.IWorkspaceFactory interface: resources.arcgis.com/en/help/arcobjects-net/componenthelp/…
Aug
11
comment UpdateCursor not calculating the date
have you tried datetime.datetime.today()?
Aug
11
comment Determining local geodatabase release version with arcpy?
Can you edit your original question to show what error message you are getting from the InitStandalone(). And you should have a stand alone license, it is simply an ArcGIS license. The important piece is here: pInit = NewObj(esriSystem.AoInitialize, esriSystem.IAoInitialize). Note, in the CheckGDBRelease(), you could substitute the call to InitStandalone with import arcpy. That would initialize an ArcGIS license for stand alone use.
Aug
11
comment Determining local geodatabase release version with arcpy?
Ah, right, I forgot you need to load the .olb files (ArcObjecs Object Library files). I edited my post to demonstrate this. I would use my full script instead and call load_all() to generate the necessary files first.
Aug
10
comment arcpy.da.UpdateCursor error: RuntimeError: create cursor has failed
John is correct. Also, why not use the 'OID@' token to grab the ObjectID field? It will always find it by its type (OID).