POST
|
Hello all, I am working on a land cover change analysis; I recently created a canopy cover raster with the following projection info: NAD_1927_UTM_Zone_11N WKID: 26711 Authority: EPSG Projection: Transverse_Mercator False_Easting: 500000.0 False_Northing: 0.0 Central_Meridian: -117.0 Scale_Factor: 0.9996 Latitude_Of_Origin: 0.0 Linear Unit: Meter (1.0) Geographic Coordinate System: GCS_North_American_1927 Angular Unit: Degree (0.0174532925199433) Prime Meridian: Greenwich (0.0) Datum: D_North_American_1927 Spheroid: Clarke_1866 Semimajor Axis: 6378206.4 Semiminor Axis: 6356583.799998981 Inverse Flattening: 294.9786982 I received LIDAR-derived DSM's and DTM's for the same area but from a later year with the following projection info: WGS_84_UTM_zone_11N Authority: Custom Projection: Transverse_Mercator false_easting: 500000.0 false_northing: 0.0 central_meridian: -117.0 scale_factor: 0.9996 latitude_of_origin: 0.0 Linear Unit: Meter (1.0) Geographic Coordinate System: GCS_WGS_1984 Angular Unit: Degree (0.0174532925199433) Prime Meridian: Greenwich (0.0) Datum: D_WGS_1984 Spheroid: WGS_1984 Semimajor Axis: 6378137.0 Semiminor Axis: 6356752.314245179 Inverse Flattening: 298.257223563 When I imported the new DTM's and DSM's, the layers were slightly off (by about 80 meters or so). I edited the spatial reference information in ArcCatalog and the layers still did not match up. I used the Project Raster tool and the layers still did not match up. I used the Define Projection tool and the layers still did not match up. Any ideas on why these two datasets are not matching up? What should I do? Thanks! David
... View more
08-07-2014
12:46 AM
|
0
|
0
|
1502
|
POST
|
Russell, Thanks! We don't have an ArcGIS server and I thought that tool was only for an Enterprise system. Thanks for the help!
... View more
07-15-2014
03:25 PM
|
1
|
0
|
527
|
POST
|
Hello all, I am writing a script to automate a GIS data editing process: I want two fields to be updated ("EDITOR" and "EDIT_DATE") every time a user edits a feature class within a geodatabase. I want the "EDITOR" field to be populated with the name of the user that is doing the editing and I want the "EDIT_DATE" field to be updated with date ("7/14/14") in which the editing was performed. Also, if the user has not created these fields ("EDITOR" and "EDIT_DATE"), I want the script to add the fields and update them accordingly. Here is what I have so far (The script creates the "EDITOR field" but does not populate it with the username; The "EDIT_DATE" does the same but the date is wrong - it populates the field with rubbish): I am not quite sure if I am on the right track here or not
# Developed by: David Bailey
# Contact: davidjonathanbailey@gmail.com
# Description: This tool updates the EDITOR and EDIT_DATE fields for all feature classes within a geodatabase
# based on the time the user makes the edits
# import arcpy site-package and os module
import arcpy, os, getpass, datetime
# Set geoprocessing environment:
# a) set the workspace environment
aWS = r"R:\Projects\1258_CLTP\Data\Aspen\Other_geodatabases\AV_Clearview.gdb"
arcpy.env.workspace = aWS
# Set geoprocessing environment:
# b) the overwriteOutput parameter controls whether tools will
# automatically overwrite any existing output
arcpy.env.overwriteOutput = True
try:
# Set Variables
fcList = arcpy.ListFeatureClasses()
Name_Expression = getpass.getuser()
Date_Expression = datetime.datetime.date()
#dropFields = ("EDIT_DATE", "EDITOR")
# Iterate through feature classes - update EDITOR field
for aFC in fcList:
fieldList = arcpy.ListFields(aFC)
for field in fieldList:
if field.name == "EDITOR":
arcpy.CalculateField_management(aFC, "EDITOR", Name_Expression, "VB", "")
else:
arcpy.AddField_management(aFC, "EDITOR", "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.CalculateField_management(aFC, "EDITOR", Name_Expression, "VB", "")
# Iterate through feature classes - update EDIT_DATE field
#for aFC in fcList:
#fieldList = arcpy.ListFields(aFC)
#for field in fieldList:
#if field.name == "EDIT_DATE":
# arcpy.CalculateField_management(aFC, "EDIT_DATE", Date_Expression, "VB", "")
# else:
# arcpy.AddField_management(aFC, "EDIT_DATE", "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
# arcpy.CalculateField_management(aFC, "EDIT_DATE", Date_Expression, "VB", "")
# Delete Fields - this is only if you are working and editing the script - optional
#for aFC in fcList:
#arcpy.DeleteField_management(aFC, dropFields)
except:
# Code to run when an error occured
print "An ERROR Occured!"
print "\n" + arcpy.GetMessages()
else:
# Message when there was no error
print "\nNo Error occurred"
# Script end message
print "\nEnd of the script!"
I'd really appreciate some help - thanks!
... View more
07-14-2014
02:31 PM
|
0
|
2
|
3311
|
POST
|
I have created a web map that I have embedded on a website. When I go to the website in Google Chrome the map displays perfectly. However when I open it in Internet Explorer 11 a large blue arrow is displayed in front of my web map (I have small blue arrows as point features on the map). It appears the scale is compromised or there is an error? Anybody have any ideas? Thanks
... View more
04-29-2014
08:56 AM
|
0
|
1
|
4641
|
POST
|
I did this and it still gives me this error: An ERROR Occured! Executing: SelectLayerByAttribute temp_layer NEW_SELECTION ""grid_code" > '3'" Start Time: Tue Apr 22 23:29:17 2014 ERROR 000358: Invalid expression An invalid SQL statement was used. An invalid SQL statement was used. [P303_LIDAR_Poly] Failed to execute (SelectLayerByAttribute). Failed at Tue Apr 22 23:29:17 2014 (Elapsed Time: 0.00 seconds) End of the script!
... View more
04-22-2014
10:29 PM
|
0
|
0
|
485
|
POST
|
Yes, with my current script I am getting three different layers with the names: P303_tree_layer, P303_shrub_layer, P303_ground_layer - however they are all the same. They should be different according to the query that was created. I tried the code you gave me and it came back with this error: Executing: SelectLayerByAttribute temp_layer NEW_SELECTION ""grid_code" > '3'" Start Time: Sat Apr 19 15:13:12 2014 ERROR 000358: Invalid expression An invalid SQL statement was used. An invalid SQL statement was used. [P303_LIDAR_Poly] Failed to execute (SelectLayerByAttribute). Failed at Sat Apr 19 15:13:12 2014 (Elapsed Time: 0.00 seconds) End of the script! It appears that my SQL statements are not written correctly? I don't see where
... View more
04-19-2014
02:27 PM
|
0
|
0
|
485
|
POST
|
This is what my code looks like now (It works - but my outputs still have the same attributes as the P303_LIDAR_Poly): Any ideas? # Developed by: David Bailey
# Description: Providence Creek Watershed: land cover processing
# import arcpy site-package and os module
import arcpy, os
# Set geoprocessing environment:
# a) set the workspace environment
aWS = r"C:\Thesis_Research\GIS\Prov_classification.gdb"
arcpy.env.workspace = aWS
# Set geoprocessing environment:
# b) the overwriteOutput parameter controls whether tools will
# automatically overwrite any existing output
arcpy.env.overwriteOutput = True
try:
# Create query statements for each land cover type
LIDAR_tree = '"grid_code" > \'3\''
LIDAR_shrub = '"grid_code" = \'2\' OR "grid_code" = \'3\''
LIDAR_ground = '"grid_code" <= \'1\''
aListLIDAR = [LIDAR_tree, LIDAR_shrub, LIDAR_ground]
layerName = ["tree","shrub","ground"]
n = 0
for query in aListLIDAR:
arcpy.MakeFeatureLayer_management("P303_LIDAR_Poly", "temp_layer", query)
arcpy.CopyFeatures_management("temp_layer", "P303_{0}_layer".format(layerName ))
arcpy.Delete_management("temp_layer")
n += 1
except:
# Code to run when an error occured
print "An ERROR Occured!"
print "\n" + arcpy.GetMessages()
else:
# Message when there was no error
print "\nNo Error occurred"
# Script end message
print "\nEnd of the script!"
... View more
04-17-2014
08:49 PM
|
0
|
0
|
485
|
POST
|
Thanks for the responses. The new script looks good and it ran without any errors - however when I opened my three new land surface types (P303_ground_layer, P303_shrub_layer, and P303_tree_layer) they had the same attributes as "P303_LIDAR_poly". It seems as if it did not process the query statements.
... View more
04-15-2014
11:21 PM
|
0
|
0
|
1146
|
POST
|
Thanks for the response. "P303_LIDAR_Poly" is a feature class directly in my geodatabase - I did not create a feature dataset. I changed the "arcpy.SelectLayerByAttribute_management" tool to (arcpy.SelectLayerByAttribute_management(P303_layerL, "NEW_SELECTION", item)" but I still had an error. I have my code written where it will tell me what the error was - but for some reason it is not giving me the messages.
... View more
04-14-2014
09:24 AM
|
0
|
0
|
1146
|
POST
|
I am assuming the "for loop" is not correctly structured?
... View more
04-13-2014
11:44 PM
|
0
|
0
|
1146
|
POST
|
I put the script in a code block - It is not telling me the error. I am new to python, and I just threw this script together by reading other python scripts. Let me know if you need more info # Developed by: David Bailey
# Description: Providence Creek Watershed: land cover processing
# import arcpy site-package and os module
import arcpy, os
# Set geoprocessing environment:
# a) set the workspace environment
aWS = r"C:\Thesis_Research\GIS\Prov_classification.gdb"
arcpy.env.workspace = aWS
# Set geoprocessing environment:
# b) the overwriteOutput parameter controls whether tools will
# automatically overwrite any existing output
arcpy.env.overwriteOutput = True
try:
# Create query statements for each land cover type
LIDAR_tree = '"grid_code" > \'3\''
LIDAR_shrub = '"grid_code" = \'2\' OR "grid_code" = \'3\''
LIDAR_ground = '"grid_code" <= \'1\''
aListLIDAR = [LIDAR_tree, LIDAR_shrub, LIDAR_ground]
for item in aListLIDAR:
arcpy.MakeFeatureLayer_management("P303_LIDAR_Poly", P303_layerL)
arcpy.SelectLayerByAttribute_management(P303_layerL, "NEW_SELECTION", aListLIDAR)
arcpy.CopyFeatures_management(P303_layerL, "P303_" + str(item))
del aListLIDAR
del item
del P303_layerL
except:
# Code to run when an error occured
print "An ERROR Occured!"
print "\n" + arcpy.GetMessages()
else:
# Message when there was no error
print "\nNo Error occurred"
# Script end message
print "\nEnd of the script!"
... View more
04-13-2014
11:43 PM
|
0
|
0
|
1146
|
POST
|
I am working with surface types that I derived from LIDAR data. These surface types are in one feature class (polygon) - associated with the feature class is a column called "grid_code"; the grid_code column has values from 0 to 145. These are elevation values and will be selected out to classify three surface types (ground surface, shrubs and trees). I want to write a script that selects each surface type and creates a feature class for each of them. My output would have three feature classes: ground, shrub and tree. Here is the code I am working with but I am getting errors: Thanks! import arcpy, os aWS = r"C:\Thesis_Research\GIS\Prov_classification.gdb" arcpy.env.workspace = aWS arcpy.env.overwriteOutput = True try: # Create query statements for each land cover type LIDAR_tree = '"grid_code" > \'3\'' LIDAR_shrub = '"grid_code" = \'2\' OR "grid_code" = \'3\'' LIDAR_ground = '"grid_code" <= \'1\'' aListLIDAR = [LIDAR_tree, LIDAR_shrub, LIDAR_ground] for item in aListLIDAR: arcpy.MakeFeatureLayer_management("P303_LIDAR_Poly", P303_layerL) arcpy.SelectLayerByAttribute_management(P303_layerL, "NEW_SELECTION", aListLIDAR) arcpy.CopyFeatures_management(P303_layerL, "P303_" + str(item)) del aListLIDAR del item del P303_layerL except: # Code to run when an error occured print "An ERROR Occured!" print "\n" + arcpy.GetMessages() else: # Message when there was no error print "\nNo Error occurred" # Script end message print "\nEnd of the script!"
... View more
04-13-2014
12:35 PM
|
0
|
14
|
4425
|
Title | Kudos | Posted |
---|---|---|
1 | 07-15-2014 03:25 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|