|
POST
|
It sounds that you have LiDAR data, but in a less adequate format xyz. To use large amounts of LiDAR data as point features is not the most efficient way to handle this type of data. In case you also received .las data, use that instead and create a LAS dataset from it. Info here: ArcGIS Help (10.2, 10.2.1, and 10.2.2) In case you don't have LAS file(s), you can convert your .xyz file to a .las file by using LAS Tools using txt2las.exe. Have a look at slide 6 from my presentation: Playing around with LiDAR, AHN2, Aerial Photography and LAStools in A… It is really easy... Once you have the LAS dataset in ArcGIS, you can convert it to raster without any problem: ArcGIS Help (10.2, 10.2.1, and 10.2.2)
... View more
01-03-2015
01:54 PM
|
1
|
0
|
5119
|
|
POST
|
When a parameter is not set, this is normally replaced by a "#" sign. I did a small test and reading the optional parameter when it is supposed to be an object ended in a "Object: Error in getting parameter as text" error. So I placed it in a try except and assigned it to None when there is an error (presumably the parameter was not set). I guess you could do something like this: # Import all necessary modules
import os, sys, arcpy
from arcpy import env
import getpass
# Define all objects to be used
sde_conn = "S:/Projects/Oilsands/FortHills/OS0101_Fort_Hills_MPG/010_FH_GDA/002-GDA_LOG/My_ArcSDE_Conn.sde"
gdaFC = "FORTHILLS.GDA_PERMIT_BOUNDARY_A"
fld_gdanum = "GDA_NUMBER"
# Prompt for user parameters
table = arcpy.GetParameterAsText(0)
field = arcpy.GetParameterAsText(1)
gdanum = arcpy.GetParameterAsText(2)
extstart = arcpy.GetParameter(3)
extend = arcpy.GetParameter(4)
extdue = arcpy.GetParameter(5)
try:
asbsubmit = arcpy.GetParameter(6) # Optional Parameter
except:
asbsubmit = None
##arcpy.SetParameter(3, gdanum)
# Specify selection
fc = os.path.join(sde_conn, gdaFC)
whereClause = "{0} = '{1}'".format(arcpy.AddFieldDelimiters(fc, fld_gdanum), gdanum)
# Updates information of gda feature class
try:
cursor = arcpy.UpdateCursor(fc, whereClause)
for row in cursor:
row.setValue("EXTENSION_START_DATE", extstart)
row.setValue("EXTENSION_FINISH_DATE", extend)
row.setValue("EXTENSION_DUE_DATE", extdue)
if asbsubmit != None:
row.setValue("ASBUILT_SUBMIT_DATE", asbsubmit) # Script should skip this if no value entered
row.setValue("STATUS", "E")
row.setValue("INTERNAL_ROW_CHANGED_DATE", time.strftime("%x %X", time.localtime()))
row.setValue("INTERNAL_ROW_CHANGED_BY", getpass.getuser().upper())
cursor.updateRow(row)
del cursor, row
except:
print arcpy.GetMessages(1)
arcpy.AddMessage("GDA has been extended") I switched line 22 off. Not sure why you want to set the value of the parameter extstart (3) to contain the value contained in gdanum...
... View more
01-03-2015
12:55 PM
|
0
|
2
|
2744
|
|
POST
|
The Divide tool supports the use of a raster or constant value. In case that doesn't work you can use IRasterMakerOp::MakeConstant to create a constant raster in memory. ArcObjects 10 .NET SDK Help ArcObjects 10 .NET SDK Help
... View more
01-03-2015
10:51 AM
|
0
|
0
|
625
|
|
POST
|
The code can be easily expanded to loop through multiple locations of data. If that is what suits your specific case.
... View more
01-03-2015
10:09 AM
|
1
|
0
|
5532
|
|
POST
|
You only need to set the workspace when you use the listfiles. For the rest just combine the in_ws and out_ws to obtain a reference to the source and destination, like this: import arcpy, os
def main():
import traceback
in_ws = r"C:\Forum\CopyFiles\InFolder"
out_ws = r"C:\Forum\CopyFiles\OutFolder"
cpfiles = find_all_files(in_ws)
try:
for c in cpfiles:
destination = os.path.join(out_ws, c)
if not arcpy.Exists(destination):
arcpy.AddMessage("Copying {0} to {1}".format(c, out_ws))
arcpy.Copy_management(os.path.join(in_ws, c), destination)
del c
except:
traceback.print_exc()
print("Cannot copy {0}, copy it over manually and run script again".format(c))
finally:
print("Finished!")
def find_all_files(workspace):
arcpy.env.workspace = workspace
files = arcpy.ListFiles()
return files
if __name__ == '__main__':
main()
... View more
01-03-2015
10:07 AM
|
0
|
0
|
956
|
|
POST
|
Question... why do you want to build the GUI outside of ArcMap? The script will still need ArcMap to execute... If you use Tkinter to navigate to the .shp file you won't be able to use other formats like file geodatabase content.
... View more
01-03-2015
09:45 AM
|
0
|
0
|
894
|
|
POST
|
An Add-in is basically a ZIP file with a certain folder structure. You can change the extension to .zip and open it. Just look at the content in the Install folder. In case it is written in .NET you will see the dll files. They are compiled and cannot be easily accessed. In case of a Python toolbox you will probably see a toolbox and 1 or more python files. There are however loads of sample in C# (and VB.NET) available. This is one with a custom selection: ArcObjects Help for .NET developers
... View more
01-03-2015
09:41 AM
|
1
|
0
|
4381
|
|
POST
|
If you use a continuous line that follows the trail from start to end it should work. The problem is that the distance from start is repeating in your specific case. Drawing and XY graph from that creates the loops.
... View more
01-03-2015
09:22 AM
|
1
|
2
|
1200
|
|
POST
|
Maybe these resources can point you in the right direction: ArcGIS Help (10.2, 10.2.1, and 10.2.2) Tools · Esri/ago-admin-wiki Wiki · GitHub EsriUK/PythonAGOLTools · GitHub Using Python to update web mapping applications hosted on Amazon Web Services | ArcGIS Blog Updating ArcGIS.com Hosted Feature Services with Python | ArcGIS Blog
... View more
01-03-2015
09:18 AM
|
0
|
1
|
928
|
|
POST
|
Does something happen with the Excel files between the moment it works and when it stops working? Do you have the Excel 2007 drivers installed? Working with Microsoft Excel in ArcGIS Desktop | ArcGIS Blog
... View more
01-03-2015
09:07 AM
|
0
|
8
|
2371
|
|
POST
|
I thought the idea was to do this automatically as the post title states. This sounds pretty manual to me.
... View more
01-03-2015
08:53 AM
|
1
|
0
|
5532
|
|
POST
|
Hi Alex, The steps are as follows (using the python window and not the standalone method in a python IDE): copy the code to a text editor like notepad or notepad++ (don't use IE, since it will probably copy the line numbers as well) In the text editor change the values in line 4 to 6 to match your data Copy the text (code) to the clipboard In ArcMap, show the python window: click on the Python Window button to the right of the standard toolbar: This will open the python window (probably floating) Right click in the Python window as select Paste: Press the Enter key until the code executes (probably twice) After execution you will see the prompt: ">>> " Check your data to see if it worked In case of any error message post it here and we'll see what is going wrong.
... View more
01-03-2015
08:52 AM
|
1
|
3
|
5532
|
|
POST
|
If you use the Find locations tool, it will return the geocoding result in the coordinate system you have defined in you data frame. You may have to be more specific as to which geocoding service you are using. Some support that the result is projected to a different coordinate system. The POINT you received is in projected coordinates. However, since you didn't specify the location nor the projection used it will be almost impossible to advice you how to project the result to WGS 1984. So, please provide some more details...
... View more
01-03-2015
08:36 AM
|
1
|
0
|
1913
|
|
POST
|
If you want to update all feature classes in a workspace, you could use some Python code to do so: import arcpy
import os
ws = r"C:\Forum\DistLinePol\test.gdb"
fld_x = "POINT_X"
fld_y = "POINT_Y"
arcpy.env.workspace = ws
fds = arcpy.ListDatasets()
fds.append("")
for fd in fds:
fcs = arcpy.ListFeatureClasses(feature_dataset=fd)
for fc in fcs:
fcl = os.path.join(ws, fd, fc)
shape_type = arcpy.Describe(fcl).shapeType
if len(arcpy.ListFields(fcl, fld_x)) == 0:
arcpy.AddField_management(fcl, fld_x, "DOUBLE")
if len(arcpy.ListFields(fcl, fld_y)) == 0:
arcpy.AddField_management(fcl, fld_y, "DOUBLE")
with arcpy.da.UpdateCursor(fcl, ("SHAPE@", fld_x, fld_y)) as curs:
for row in curs:
if shape_type == "Point":
row[1] = row[0].firstPoint.X
row[2] = row[0].firstPoint.Y
elif shape_type == "Polyline":
pnt = row[0].positionAlongLine(0.5, True)
row[1] = pnt.firstPoint.X
row[2] = pnt.firstPoint.Y
elif shape_type == "Polygon":
row[1] = row[0].centroid.X
row[2] = row[0].centroid.Y
curs.updateRow(row) Change the values on line 4 to 6 to set the path to the workspace and the fields to update. If the fields don't exist they are added in the process.
... View more
01-01-2015
08:31 PM
|
2
|
5
|
5532
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
Monday
|