|
POST
|
No, since I did not export it as a feature class or shapefile, it is just an event.
... View more
03-03-2017
02:38 PM
|
0
|
0
|
1875
|
|
POST
|
Example -136.179137 25.945518 Decimal Degrees is the location of data dialog when using identify tool but the actual data coordinate is -117.10765, 33.121972
... View more
03-03-2017
02:34 PM
|
0
|
7
|
1875
|
|
POST
|
I set everything correct but my points place me in the ocean, why ? x,y in decimal degrees
... View more
03-03-2017
02:25 PM
|
0
|
9
|
2379
|
|
POST
|
I was able to write to excel. I just created a variable from the results and passed it to the writer, it gets too confusing on modifying syntax to accommodate the writer. with arcpy.da.SearchCursor(fc,['SHAPE@','FACILITYID'],spatial_reference=sr) as cursor:
for row in cursor:
wgs = '4326' # Coordinate System WGS 1984 WKID is '4326'
toolresults = row[1], ('{0}, {1}'.format(row[0].projectAs(wgs).centroid.Y, row[0].projectAs(wgs).centroid.X,row))
writer.writerow (toolresults)
... View more
02-23-2017
04:06 PM
|
0
|
0
|
2618
|
|
POST
|
Perfect for print out. Almost there, now just write to csv file FACILITYID 423 -117.079916464, 33.108904151 #Set Excel variables
headers = "FaciliyID","X","Y"
ofile = open('Coordinates.csv','w')
writer = csv.writer(ofile)
writer.writerow(["FACLITYID", "X", "Y"])
fc = "ESC_MS4structures selection"
##field = ["FACILITYID"]
with arcpy.da.SearchCursor(fc,['SHAPE@','FACILITYID'],spatial_reference=sr) as cursor:
for row in cursor:
wgs = '4326'
print "FACILITYID", row[1], ('{0}, {1}'.format(row[0].projectAs(wgs).centroid.X, row[0].projectAs(wgs).centroid.Y,row))
writer.writerow row([1],('{0}, {1}'.format(row[0].projectAs(wgs).centroid.X, row[0].projectAs(wgs).centroid.Y,row))
... View more
02-22-2017
03:13 PM
|
0
|
1
|
2618
|
|
POST
|
This works as I get the desired format -117.089329372, 33.1175902179. I am trying to include the field Facilityid as well. I know the writerow doesn't work as is. fc = "ESC_MS4structures selection"
field = ["FACILITYID"]
with arcpy.da.SearchCursor(fc,'SHAPE@',spatial_reference=sr) as cursor:
for row in cursor:
wgs = '4326'
print ('{0}, {1}'.format(row[0].projectAs(wgs).centroid.X, row[0].projectAs(wgs).centroid.Y))
## writer.writerows('{0}, {1}'.format(row(0).projectAs(wgs).centroid.X, row(0).projectAs(wgs).centroid.Y))
## writer.writerows(cursor)
#Close Excel (CSV) file
ofile.close()
... View more
02-22-2017
01:50 PM
|
0
|
3
|
2618
|
|
POST
|
Makes sense, I was so focused on the syntax that I didn't think about the obvious aspect of projected state plane coordinates are not in decimal degrees. I will go ahead and use your example to implement this how I want it. Thanks
... View more
02-22-2017
12:59 PM
|
0
|
4
|
2618
|
|
POST
|
I am trying to get XY coordinate ouput in decimal degrees (NAD_1983_StatePlane_California_VI_FIPS_0406_Feet) but I get the following (6307536.064266056, 1984263.0718122125). From the following script section pertaining to spatial reference search cursor,does anything appear to be the reason why I get my current results ? import csv,os,arcpy
os.chdir(r'S:\abc)
#Set path location of Excel (CSV) file
(r'S:\GIS\Projects\abc)
#Set Excel variables
ofile = open('Coordinates.csv','w')
writer = csv.writer(ofile)
fc = "ESC_MS4structures selection"
desc = arcpy.Describe(fc)
field = ["FACILITYID","SHAPE@XY"]
sr=desc.spatialReference
cursor = arcpy.da.SearchCursor(fc,field,None,sr)
for row in cursor:
print (u'{0}, {1}'.format(row[0], row[1]))
writer.writerows(cursor)
#Close Excel (CSV) file
ofile.close()
os.startfile (r'S:\abc\Coordinates.csv')
... View more
02-22-2017
11:40 AM
|
0
|
6
|
3646
|
|
POST
|
Interesting, I can't even edit in the attribute table.
... View more
02-17-2017
10:58 AM
|
0
|
1
|
905
|
|
POST
|
There is something missing, as it is still not working. Just not sure what.
... View more
02-17-2017
10:41 AM
|
0
|
0
|
3396
|
|
POST
|
Yes, the feature class is in the same workspace .gdb. I am creating this for basis GIS users, it would be very convenient.
... View more
02-17-2017
10:24 AM
|
0
|
4
|
3396
|
|
POST
|
Not working yet based on your suggestions. So it just starts an edit session ? How does it know to edit the selected feature, I am not seeing it in the code.
... View more
02-17-2017
10:01 AM
|
0
|
6
|
3396
|
|
POST
|
Thanks for the feedback. You are exactly correct that I want the user to use the map document default tool to stop and save edits. Most edits will be attributes but some point feature creation and lines. I will work on this.
... View more
02-17-2017
09:55 AM
|
0
|
7
|
3396
|
|
POST
|
I want a user with the option to check the Start Editing after typing in the string FacilityID. I am having trouble passing the selected feature to arcpy.GetParameterAsText() tool parameter. Also, I have used editing arcpy syntax. #Set to current mxd and dataframe
mxd = arcpy.mapping.MapDocument ("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.scale = 350
# Set Editing
workspace = r'C:\Users\abc.gdb'
edit = arcpy.da.Editor(workspace)
edit.startEditing(False, True)
edit.startOperation()
edit = arcpy.GetParameterAsText(3)
# Set the tool parameters
InputFeatureClass = arcpy.GetParameterAsText(0)
InputField = arcpy.GetParameterAsText(1)
InputValue = arcpy.GetParameterAsText(2)
# SQL expression used in selecting a feature
# The equation needs to be enclosed with double quote marks, in addition, since the input FacilityID is string, it needs to be enclosed with #single quote marks.
whereclause = """{} = '{}'""".format(arcpy.AddFieldDelimiters(InputFeatureClass,InputField),InputValue)
#Select feature by facilityid (InputValue)
arcpy.SelectLayerByAttribute_management(InputFeatureClass, "NEW_SELECTION", whereclause)
df.zoomToSelectedFeatures()
arcpy.RefreshActiveView()
... View more
02-17-2017
07:22 AM
|
0
|
9
|
3396
|
|
POST
|
I am not sure how I should have my syntax to use this with a tool ? # Set Editing workspace = r'C:\xyz' edit = arcpy.da.Editor(workspace) edit.startEditing(False, True) edit.startOperation() edit = arcpy.GetParameterAsText(3)
... View more
02-16-2017
03:29 PM
|
0
|
12
|
5843
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-03-2016 06:52 AM | |
| 1 | 05-10-2016 10:27 AM | |
| 1 | 02-06-2017 01:22 PM | |
| 1 | 05-01-2018 07:23 AM | |
| 1 | 03-03-2017 02:46 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|