|
POST
|
Try to use the code below as a guide. if sr == sr:
point = arcpy.GetParameterAsText(0)
for prow in SC:
x,y
row_value =
with arcpy.da.insertCursor:
cursor.insertRow()
delprow
... View more
07-24-2015
10:55 AM
|
0
|
1
|
2499
|
|
POST
|
You first need to nest every thing under your if statement you'll be able to tell by the indentation Then move line 19 below line 24 and nest everything 19 - 24 under the for statement. del prow should be aligned with the for statement be careful and watch your indentation it's important in python
... View more
07-24-2015
10:36 AM
|
0
|
5
|
2499
|
|
POST
|
That is the tuple for Shape@XY it should be row_value = [x,y,(x,y)] or something similar
... View more
07-24-2015
08:51 AM
|
2
|
1
|
1836
|
|
POST
|
You need to make row_value = something before you can create the row. Insert Row will accept either a list or tuple. You'll need to set row_value in the order of your field list ['POINT_X', 'POINT_Y','SHAPE@XY']
... View more
07-24-2015
08:22 AM
|
0
|
3
|
1836
|
|
POST
|
I would georeference the photos to the shapefile http://resources.arcgis.com/en/help/main/10.2/index.html#//009t000000mn000000
... View more
07-24-2015
07:15 AM
|
0
|
0
|
954
|
|
POST
|
You can set your tool box to accept multi-values and write you dependencies for the multi-values
... View more
07-24-2015
06:28 AM
|
0
|
0
|
1801
|
|
POST
|
Freddie Gibsonmakes a good point you may want to start your code with something like below just to make sure your in the same spatial reference. mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
dfsr = df.spatialReference
fcsr = arcpy.Describe(An).spatialReference
if dfsr.name == fcsr.name:
"""Now do your work"""
... View more
07-24-2015
05:58 AM
|
2
|
5
|
1836
|
|
POST
|
I'm wanting to use python to make a REST call to the GPService
... View more
07-23-2015
01:09 PM
|
0
|
2
|
1585
|
|
POST
|
I'm trying to use a web geoprocessing service in python. I'm using the example in this web site http://resources.arcgis.com/en/help/main/10.1/index.html#/Using_a_geoprocessing_service_in_Python_scripts/00570000004w000000/ I'm not getting the expected results does anyone know the proper syntax to submit a job to a geoprocessing service? Here's my code: import arcpy,urllib,json
baseURL = "my service here"
query = "?Address:=504 Walnut St & RecType: = Youth Baseball League?"
submitResponse = urllib.urlopen(baseURL+query)
submitResponse = urllib.urlopen(baseURL+query)
jobUrl = submitResponse.geturl()
status = "esriJobSubmitted"
print jobUrl
while status == "esriJobSubmitted" or status == "esriJobExecuting":
#print "checking to see if job is completed..."
time.sleep(1)
jobResponse = urllib.urlopen(jobUrl, "f=json")
jobJson = json.loads(jobResponse.read())
if 'jobStatus' in jobJson:
status = jobJson['jobStatus']
if status == "esriJobSucceeded":
if 'results' in jobJson:
resultsUrl = jobUrl + "/results/"
resultsJson = jobJson['results']
for paramName in resultsJson.keys():
resultUrl = resultsUrl + paramName
print resultUrl
resultResponse = urllib.urlopen(resultUrl, "f=json")
resultJson = json.loads(resultResponse.read())
print resultJson['value']
print resultJson
if status == "esriJobFailed":
if 'messages' in jobJson:
print jobJson['messages']
else:
print "no jobId found in the response"
print "no jobId found in the response"
Message was edited by: Wes Miller
... View more
07-23-2015
10:11 AM
|
0
|
4
|
4379
|
|
POST
|
Looks like an indentation error you would need to set your print statements to be in your if statement
... View more
07-23-2015
07:23 AM
|
1
|
7
|
2726
|
|
POST
|
point is a feature set and does not have fields "Point_X" or "Point_Y" try running Darren Wiens code on the targetpoint
... View more
07-22-2015
12:57 PM
|
0
|
3
|
4262
|
|
POST
|
I don't know if this helps or not >>> import arcpy >>> help(arcpy.RebuildIndexes_management) Help on function RebuildIndexes in module arcpy.management: RebuildIndexes(input_database=None, include_system=None, in_datasets=None, delta_only=None) RebuildIndexes_management(input_database, include_system, {in_datasets;in_datasets...}, {delta_only}) Updates indexes of datasets and system tables stored in an enterprise geodatabase. This tool is used in enterprise geodatabases to rebuild existing attribute or spatial indexes. Out-of-date indexes can lead to poor geodatabase performance. INPUTS: input_database (Workspace): The enterprise database that contains the data to be updated. include_system (Boolean): Indicates whether indexes will be rebuilt on the states and state lineages tables.You must be the geodatabase administrator for this option to be executed successfully.This option only applies to geodatabases. If the input workspace is a database this option will be ignored. * NO_SYSTEM— Indexes will not be rebuilt on the states and state lineages table. This is the default. * SYSTEM— Indexes will be rebuilt on the states and state lineages tables. in_datasets {String}: Names of the datasets that will have their indexes rebuilt. Dataset names use paths relative to the input workspace; full paths are not accepted as input. delta_only {Boolean}: Indicates how the indexes will be rebuilt on the selected datasets. This option has no effect if input_datasets is empty.This option only applies to geodatabases. If the input workspace is a database this option will be ignored. * ALL—Indexes will be rebuilt on all indexes for the selected datasets. This includes spatial indexes as well as user-created attribute indexes and any geodatabase-maintained indexes for the dataset. * ONLY_DELTAS—Indexes will only be rebuilt for the delta tables of the selected datasets. This option can be used for cases where the business tables for the selected datasets are not updated often and there are a high volume of edits in the delta tables. This is the default.
... View more
07-22-2015
11:10 AM
|
1
|
1
|
8251
|
|
POST
|
Yes i forgot to add the field back, here is the working script. #import modules
import arcpy
"""
tool box parameters
point param = feature set
targetpoint = featurelayer
parcel = featurelayer
"""
arcpy.env.qualifiedFieldNames = False
point = arcpy.GetParameterAsText(0) #point feature set
targetpoint = "PointsTest" #target point feature class
parcel = "ParcelsTest" #parcel feature class
parcel_lyr = 'parcel_lyr'
for prow in arcpy.da.SearchCursor(point,'SHAPE@XY'):
x,y = prow[0]
del prow
point1 = arcpy.Point(x, y)
ptGeometry = arcpy.PointGeometry(point1)
CC_list = []
with arcpy.da.SearchCursor(targetpoint, ["AddressID"]) as cursor:
for row in cursor:
try:
if "CC" in row[0]:
CC_list.append(int(row[0].strip("CC")))
except TypeError:
pass
del cursor
CC_list.sort()
AddressID = CC_list[-1] + 1
AddressID = 'CC' + str(AddressID)
arcpy.MakeFeatureLayer_management(parcel,parcel_lyr)
arcpy.SelectLayerByLocation_management(parcel_lyr,"INTERSECT",ptGeometry)
fldList = ['ACCOUNT','OwnerName','SiteAddres','SiteNum','siteNumSfx','Predir','SiteStreet', 'StreetType', 'Postdir', 'SiteCity', 'SiteZip']
fldDict ={}
#Check that we only have one parcel and get the attributes from it
if int(arcpy.GetCount_management(parcel_lyr).getOutput(0))==1:
for parrow in arcpy.da.SearchCursor(parcel_lyr,fldList):
for w in range(len(fldList)):
fldDict[fldList ]=parrow
del parrow
targetFields = ['ACCOUNT', 'OwnerName', 'SiteAddres', 'SiteNum', 'siteNumSfx', 'Predir', 'Postdir', 'SiteCity', 'SiteZip',
'SiteState', 'FacltyType', 'StructType', 'GIS_STEW', 'UpdateBy', 'Verified', 'Status', 'StructCat', 'APA_CODE',
'AddressID', 'POINT_X', 'POINT_Y', 'StreetName','SHAPE@XY']
tprows = arcpy.da.InsertCursor(targetpoint, targetFields)
row = []
#Attributes from parcels
row.append(fldDict['ACCOUNT'])
row.append(fldDict['OwnerName'])
row.append(fldDict['SiteAddres'])
row.append(fldDict['SiteNum'])
row.append(fldDict['siteNumSfx'])
row.append(fldDict['Predir'])
row.append(fldDict['Postdir'])
row.append(fldDict['SiteCity'])
row.append(fldDict['SiteZip'])
#Preset attributes
row.append('ID')
row.append('Single Family Home')
row.append('Primary, Private')
row.append('CanyonCo')
row.append('TA')
row.append("Yes, GRM, TA")
row.append('Active')
row.append('Residential')
row.append('1110')
row.append(AddressID)
row.append(x)
row.append(y)
row.append(fldDict['SiteStreet'] + " " + fldDict['StreetType'])
row.append(point1)
tprows.insertRow(row)
del tprows
... View more
07-22-2015
08:25 AM
|
3
|
1
|
2426
|
|
POST
|
If you have an original set (a set that generally covers the areas) you could use a spatial join then a dissolve
... View more
07-22-2015
08:09 AM
|
1
|
0
|
1081
|
|
POST
|
For me it's easier to see what's going on and looks cleaner
... View more
07-22-2015
07:51 AM
|
0
|
3
|
2426
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 09-14-2015 01:29 PM | |
| 1 | 01-26-2016 10:18 AM | |
| 1 | 08-18-2015 06:01 AM | |
| 1 | 06-20-2016 12:34 PM | |
| 1 | 01-19-2016 06:13 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|