|
POST
|
Ok, To break it down: fclist( PntA, pntB, pntC, pntD) <<< an example list of point features demlist (dema, demb, demc, demd) <<example list of dems… count = 1 for i in fclist #PntA first shape in list for rak in demlist #dema first dem in list if i == Pnta and rak == dema outViewshed =Viewshed(rak, i) outViewshed.save(mypath "view" str(count)) #view1 count = count + 1 point = Pnta + 1 # Pnta1 #last indented code, last line of if statement dem = dema+1 #dema1 NOTE: in green Pnta1, if not found your code will bomb here, after first view is run. Did you want to run everything in the fclist against your first dem? Then run it all over again against your second dem? For i in fclist For x in demlist Outview =viewshed(I,x) Save it here running again will use the first i and the second x and so on next i will run through (second i) and first x in xlist, then second x in xlist, etc.. Until you finish the I list.. .
... View more
11-23-2015
10:09 AM
|
0
|
0
|
1717
|
|
POST
|
Ok, My thoughts were if either your FC or ras list were empty it would fail, so I check those first.. I’d put a print with a count first. This confirms the data is there.. If you put a print after for shp in fc: print shp you could watch for errors as you would know the file being processes. A for raster in ras: print ras would tell you which raster is being processed. Both of these help rule out data issues, as everyone always looks at the code when it might be a simple data issue. No use troubleshooting code if this is the case. For grins, comment out lines 6 + 7, just write the variables in as text until you get it and running This takes out dumb input errors, like did they use the backslash or forwardslash, python is funny about that.. My next though is why are you checking : if (shp == point and raster == dem): You already defined them in the above code. Your loops would stop if you ran out of shapes or rasters.. On line 22, dem = ____ should line up under point = ____ Ok, now for the logic error.. Why do you need lines 21 and 22? They are not part of your naming of the output and it will step though all the rasters and shapes in the list.. Bill
... View more
11-23-2015
08:44 AM
|
1
|
17
|
2315
|
|
POST
|
Dan is right, when I run lists I always check counts to make sure it has data and matches what I think it should be.. Basic run. put in print statements for debugging, you can watch the progress and later comment or remove them when it works. Add text to help follow it, use the AddMessage option if you want to see the message in the results window. import arcpy arcpy.env.workspace = r"\\gis01\GISTemp\temp.gdb" fcList = arcpy.ListFeatureClasses() theCount = len(fcList) print theCount for fc in fcList: print fc ordinary least squares USE arcpy.AddMessage(" Features in my list "+ theCount)
... View more
11-23-2015
06:38 AM
|
2
|
20
|
2315
|
|
POST
|
Idea.. If you can do this as a model or python script, create a GP Service in ArcServer, I just did something similar but the final result is JSON, I didn't want to save files, as multiple users at the same time could be overwriting. Once done it's just a rest service endpoint. Another option, like javaScript, use Leaflet, it can read the Esri services and there are options to post a shapefile on-line as it converts it to geoJson, and the process is just JavaScript.
... View more
11-09-2015
01:21 PM
|
0
|
0
|
679
|
|
POST
|
One issue is DMS is a string and you need to convert it to a number (Double) so you can plot them The basic conversion is dd = d + m/60 + s/3600 you could field calculate it in ArcMap two fields DMS has the dms values, and DD a double field where you want to field calc it .DD= left( [DMS],2) + (mid( [DMS],4,2)/60) + (Mid( [DMS], 7,4)/3600) The left and mid functions are a way to pull apart the string, in your example 30°11'4.46"N you want the left 2 (maybe 3 if in western hemisphere ie. -30) Mid 4,2 gets the 11 and mid 7,4 gets the 4.46 The °'."N symbols are not math symbols..
... View more
11-05-2015
07:23 AM
|
1
|
0
|
1551
|
|
POST
|
Got it, As a model it ran without defining the output, however as a python script you had to work it in the parameter GUI, I wish they had documented it somewhere Google would have found it. I took the selected features in Python to CopyRows(Creates Table) and then when making the parameters called it Output, said it was a Table, and selected direction Output in the parameter GUI (input was the default value), then in the python script make sure it said arcpy.GetParameter(5) not GetParameterAsTest(5) then I ran it and it worked. I ran it in Sync mode and it returned JSON. Before I was writing back to my fileGDB now just using in_memory to avoid disk ops and it's faster and avoids multiple user conflicts. Gotcha was "final output as an output parameter" miss this and it will want an existing table as input, throwing you a curve. Also setting it as Table not string, you want the object not name. Now our programmers hit our GIS tables and have some of the GIS functionality available through REST. Bill
... View more
11-03-2015
11:02 AM
|
0
|
0
|
969
|
|
POST
|
I've creates several GPS services some select features as a task but how can I get a GPS service to select features and return them as JSON, like you can with a featureService or by querying a MapService. I know there is a arcpy command to convert a fc to JSON but that just makes a file. When I run my GP services they say executed and successful but don't return data. Am I missing something? The end result would be to hit the rest endpoint with a few parameters and get JSON back on the url page.
... View more
11-02-2015
08:38 AM
|
0
|
2
|
3054
|
|
POST
|
After a week of troubleshooting, one fc didn't have a defined projection, although it was in the right location arcServer had a problem with it. ArcMap was more forgiving in this, once I defined a projection it worked as a service.
... View more
10-29-2015
12:37 PM
|
2
|
0
|
3493
|
|
POST
|
If you using ArcGIS.com have you considered bookmarks? You described what they do. Bookmark places—ArcGIS Online Help | ArcGIS If you were into JavaScript, you could replace the hyperlink with a button, and when it's clicked run a function, The function would change the map extents. aka bookmark.
... View more
10-26-2015
05:15 AM
|
0
|
0
|
714
|
|
POST
|
OK, this has been helpful, I checked permissions on my file GDB, checked c::\arcgisserver\directories\arcgisjobs\ and it's creating some of the folders it needs but not all. Permissions have to be right to create the folders. I've checked the arcServer logs (verbose) and check the server properties so my arcpy.addMessages appear, showing it's working with record counts showing selections. even says successful but no data. Esri connected today and watched it happen, also checked permissions and logs, end result is a "We'll get back to you." 4 days of frustration will probably end up with a DUH moment and that's the part that's frustrating. I'll post the fix when it's fixed.. Thx, Bill
... View more
10-22-2015
12:47 PM
|
1
|
0
|
764
|
|
POST
|
I verified the folder has correct permissions, For grins, I copied the input FC to the file.gdb and write the output to the same file.gdb. As a model or script it runs. As a service it says it works but does nothing. I delete the output fc before I try to run it. I also close arcmap and arcCat. After running nothing is in the folder. I've also reinstalled ArcServer, and by putting the input and output in the same file.gdb I removed any issues that could have been in SDE.
... View more
10-16-2015
11:40 AM
|
0
|
1
|
2729
|
|
POST
|
Alright after 3 days of screwing around with this I'm stumped. Setup, ArcSDE 10.2 on Oracle 11g... Using ArcGIS desktop 10.3.1, ArcServer 10.3. on iiS. I've registered the SDE database and a folder \\gis01\gistemp (the folder has temp.gdb and both are open to "everyone" for read/write/modify) In Arcmap I can make a model or python script, run it and it will work locally. However when I publish it, it says successful but doesn't write data to either of the registered databases. If I run the service from the REST endpoint, it returns no records. If I use the service as a tool , no records. As for code: I just created a model, dropped the buffer tool on it, had it use a FC from SDE and the output to the registered FGDB. For grins, I played with the exported Python code below, changed the connection string. The Model, both versions of the connection string work well in ArcMap. and create temp fc, however as a service they run successfully but don't create anything. I closed ArcMap, to avoid schema locks but hitting the rest service endpoint returns nothing, I've even deleted the temp fc to avoid any conflict in using the service, I've also tried this using ArcMap on the server, without luck. Any ideas? # -*- coding: utf-8 -*- # --------------------------------------------------------------------------- # dumbtest.py # Created on: 2015-10-15 15:09:58.00000 # (generated by ArcGIS/ModelBuilder) # Description: # None # --------------------------------------------------------------------------- # Import arcpy module import arcpy # Local variables: DOHGIS_ESRI_COUNTY_SIMPLE = r"\\GIS01\GISTemp\dohgis@racdev (DEV).sde\DOHGIS.ESRI_COUNTY_SIMPLE" #DOHGIS_ESRI_COUNTY_SIMPLE = "Database Connections\\dohgis@racdev (DEV).sde\\DOHGIS.ESRI_COUNTY_SIMPLE" test = "\\\\gis01\\GISTemp\\temp.gdb\\test" # Process: Buffer arcpy.Buffer_analysis(DOHGIS_ESRI_COUNTY_SIMPLE, test, "300 Meters", "FULL", "ROUND", "NONE", "", "PLANAR") .
... View more
10-15-2015
12:47 PM
|
0
|
11
|
6288
|
|
POST
|
I am writing to the SDE database, overwriting the existing FC, after the points have been collected, I go from a feature layer to a featureclass. Maybe my code will help, it's fairly simple. import arcpy, os, string from arcpy import env theworkspace = r"Connection to racdev1.sde" arcpy.env.workspace = theworkspace arcpy.env.overwriteOutput = True #facilityID = '1249' facilityID = arcpy.GetParameterAsText(0) #facilityIDType= 'PFI' facilityIDType = arcpy.GetParameterAsText(1) thedistance = arcpy.GetParameterAsText(2) #thedistance = '3 miles' #withindistance = "3 Miles" withindistance = thedistance + ' Miles' sql_query = "\"%s\" = '%s'" % ("ID", facilityID) sql_query2 = "\"%s\" = '%s'" % ("IDTYPE", facilityIDType) # Local variables: Facilities = "DOHGIS.NYSDOH_CI_DATA" featLayer = "thePts" arcpy.MakeFeatureLayer_management(Facilities, featLayer) # Process: Select Layer By Attribute arcpy.SelectLayerByAttribute_management(featLayer, "NEW_SELECTION", sql_query) # Process: Select Layer By Location 311 arcpy.SelectLayerByLocation_management(featLayer, "WITHIN_A_DISTANCE",featLayer, withindistance, "NEW_SELECTION") #print " now for the subset" arcpy.SelectLayerByAttribute_management("thePts", "SUBSET_SELECTION", sql_query2 ) # creaate the new featureclss.. arcpy.CopyFeatures_management("thePts",'DOHGIS.NYSDOH_FacilitiesQuery') #print "Done"
... View more
10-08-2015
11:27 AM
|
0
|
0
|
708
|
|
POST
|
Hi, I have this python script that basically selects a point by it's ID, then selects all points within a distance and returns only a subset of those that match the type field. i.e. find all hospitals within 3 miles of this location.. My python script works, does what it's supposed to. So I create a GP service from it. Add the service back into the map and run it. Now I notice no matter what distance I use, the data doesn't change. If I delete the created Featureclass to see if it's really working. It does not create a new featureclass but it says it completed successfully. Now the weird part, if I hit the GP service at the rest endpoint with the parameters it says it works but returns no records. I've been careful to avoid schema locks when using the Rest endpoint ArcMap and ArcCatalog are closed. It's like the GP service doesn't have permission to write to the sde database, However my sde connection works fine on my PC. Any ideas?
... View more
10-08-2015
08:31 AM
|
0
|
2
|
2908
|
|
POST
|
I created a local Geocoding service for a 911 project. I can add the service in ArcMap and the Address Inspector shows it works great. However I am trying to use it in Leaflet and it doesn't return anything. (code 400 no results)http://www.snydercountygis.org:6080/arcgis/rest/services/Roads_AddressLocator/GeocodeServer So I tried the Rest Service directly an passed it a coordinate or address, same result code 400, //http://www.snydercountygis.org:6080/arcgis/sdk/rest/index.html#/Reverse_Geocode/02ss00000030000000/ //help file // http://www.snydercountygis.org:6080/arcgis/rest/services/Roads_AddressLocator/GeocodeServer/reverseGeocode?location=-75.579659,41.045444&distance=0 Sample address and it's coordinate //41.045444,-75.579659 for '10 LAKE HARMONY RD' Any ideas, I'm stumped as it looks like the service is not right but when ArcMap uses it it's ok. My leaflet file is attached if it helps.. Message was edited by: Bill Chappell 6/18
The attached script is now working after code changes to convert lat/long to meters in Leaflet.
... View more
06-16-2015
07:37 PM
|
0
|
1
|
4141
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-05-2016 09:27 AM | |
| 1 | 06-12-2020 07:41 AM | |
| 1 | 12-23-2016 05:32 AM | |
| 1 | 11-23-2015 08:44 AM | |
| 1 | 11-25-2015 01:59 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-22-2021
12:31 PM
|