|
POST
|
It would be even easier if you could split the data into different fields. There are standard fields for addresses, such as prefix, direction, name, suffix, etc. Not necessarily those field names, but that's the idea. Similar to what geolocators use. Of course, that may not be an option for you.
... View more
02-08-2013
04:27 AM
|
0
|
0
|
864
|
|
POST
|
Also, please enclose your code in code tags. I'd try int([acreage]) < 153 , without the quotes around 153.
... View more
02-05-2013
12:16 PM
|
0
|
0
|
1247
|
|
POST
|
Are you sure you have time enabled, not just time fields in your data (see image below). If time slider is working, I'd think you do, but worth a check. Still pretty sure the arcpy.gp.IDW_sa call is incorrect, even if it's from help. There are typos there too. Check out the IDW samples in help, they follow Matthew's format Well, they import the whole sa module, but same idea. I'd link, but getting a proxy error at the site right now. User entered parameters are generally entered when you add a script to a toolbox. Not hard, but I don't think that's the issue here. If it won't run with stuff hard coded, it won't run with parameters either.
... View more
02-04-2013
11:39 AM
|
0
|
0
|
1611
|
|
POST
|
Well, if your data is in a personal geodatabase, that's Access right off the bat, maybe make it easier.
... View more
02-01-2013
12:57 PM
|
0
|
0
|
2051
|
|
POST
|
I don't know the specifics of what you're trying to do, don't work much with rasters, but a couple possible things to look at: 1. Do you have a Spatial Analyst license? Does it actually get checked out? Some error checking would help here. Generically: try:
<some code here>
except e as Exception:
arcpy.AddMessage('some error message ' + e.message 2. 'arcpy.gp.Idw_sa(tempFeatureLyr, "Temperature", outRaster)' doesn't look correct. gp is usually seen in versions of Arc prior to 10, when arcgisscripting was used instead of arcpy. This could be correct, but I've never seen it. 3. It would be helpful if you enclosed your script in code tags. Python is strict about indentation. If there's an error with indentation, we can't see it when the code is just pasted into the post. See the 1st post in this forum on how to paste code.
... View more
02-01-2013
09:02 AM
|
0
|
0
|
1611
|
|
POST
|
James, Duh! 😮 You are right. Fixing that gave me a 33 second run time. Much better, thank you, and everyone else as well. Very much appreciated. Nice to learn something new.
... View more
01-17-2013
10:33 AM
|
0
|
0
|
431
|
|
POST
|
Chris: A typical project where the user would run this tool is a rezoning request on one or more parcels. For their purposes (display and further analysis), they want one case feature covering all the parcels they've selected. Dissolve takes the temporary layer that consists of n number of parcels and makes them into one feature. Similar to the Merge tool in the Editor drop-down. The gp Merge tool would create a new feature class, which I don't want. The Select By Location is just an additional feature so that they don't have to manually select it once created. It's not really necessary. I can accomplish similar results manually myself much more quickly, but the end users don't really know Arc, so I'm trying to make it untrained monkey easier for them. But if there's a better method, please let me know. I'm not an ArcPy expert! Thanks. Wayne: Thanks for the info, that will come in handy, I'm sure. Matt: The data is stored on a network, but I've never noticed this amount of processing time before. It does work, so maybe they'll just have to accept it. I doubt they have a handle on how much time it should take anyway (maybe I don't either, eh?). Thanks for the tip on in-memory. I used that, not much time difference, though.
... View more
01-17-2013
08:54 AM
|
0
|
0
|
2649
|
|
POST
|
I've attached a png of the processing times in the results window. Dissolve takes the most time, averaging 50 seconds. I've also modified the script below, to use in memory workspace, although I'm not sure if this is correct; never used it before and don't find much in Help files about using it. I'm only displaying three layers on my test runs, Parcels (~28k features), Case (0 features to start) and city boundary. Not all parcels are displayed, 28K is the total number of parcels; the map is typically zoomed in to areas of less than 100 parcels. Thanks, really appreciate the help. import arcpy, sys, time #, os
from arcpy import env
env.overwriteOutput = True
env.workspace = "IN-MEMORY"
#temp_lyr_location = r"\Cases_Geodatabase.gdb\temp_parcel_lyr"
parcel = r"Parcel"
try:
#lyr = os.getcwd() + temp_lyr_location
lyr = r"temp_parcel_lyr"
mxd = arcpy.mapping.MapDocument("CURRENT")
except Exception as e:
arcpy.AddError('ERROR initializing: /n' + e.message)
#-------------------------------------------------------------------------------
def MakeCaseFeature():
''' Dissolve selected parcel features into one temporary lyr file.
Append it to the Cases feature class.
Delete the temporary lyr file. '''
clear = "CLEAR_SELECTION"
target = "Cases"
schemaType = "NO_TEST"
fld = "CENTRACT" # no data is stored in this field
selectType = "HAVE_THEIR_CENTER_IN"
try:
# make temporary parcel lyr file from selected parcels, dissolving them
# into one feature
t0 = time.clock()
arcpy.Dissolve_management(parcel, lyr, fld)
arcpy.AddMessage("Elapsed time dissolving: {0} seconds".format(int(time.clock() - t0)))
# add case feature in temporary layer to Cases
t0 = time.clock()
arcpy.Append_management(lyr, target, schemaType, "", "")
arcpy.AddMessage("Elapsed time appending: {0} seconds".format(int(time.clock() - t0)))
# select new case feature
t0 = time.clock()
arcpy.SelectLayerByLocation_management(target, selectType, lyr)
arcpy.AddMessage("Elapsed timeselecting case layer: {0} seconds".format(int(time.clock() - t0)))
# delete temporary layer
#arcpy.Delete_management(lyr)
# clear selection on parcels
t0 = time.clock()
arcpy.SelectLayerByAttribute_management(parcel, clear)
arcpy.AddMessage("Elapsed time clearing parcel selection: {0} seconds".format(int(time.clock() - t0)))
except Exception as e:
arcpy.AddError("ERROR in MakeCaseFeature: \n" + e.message)
#-------------------------------------------------------------------------------
def main():
''' Check how many parcels are selected. Count returns all parcels if none are
selected, or only selected ones if there are any.
'''
try:
t0 = time.clock()
count = int(arcpy.GetCount_management(parcel).getOutput(0))
arcpy.AddMessage(str(count) + " parcels selected")
arcpy.AddMessage("Elapsed time counting parcels: {0} seconds".format(int(time.clock() - t0)))
# make sure parcels are selected before running rest of script, otherwise exit
if count >= 0 and count <= 10:
MakeCaseFeature() # create the case feature
t0 = time.clock()
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
arcpy.AddMessage("Elapsed time refreshing view: {0} seconds".format(int(time.clock() - t0)))
else:
arcpy.AddError("No features selected! \n Please select at least one parcel feature. \n")
arcpy.AddError("Quitting the Create Case tool \n")
except Exception as e:
arcpy.AddError('ERROR in main: /n' + e.message)
... View more
01-17-2013
07:24 AM
|
0
|
0
|
2649
|
|
POST
|
The script below works in that it does what it's supposed to: creates a single Case feature from selected parcels. But it takes anywhere from 1.5 - 2 minutes to run, which seems a long time for a relatively simple operation. I could do it faster manually, although the people it's intended for probably couldn't 🙂 Any ideas on why it's so slow, an/or what could be done to speed it up? Thanks. import arcpy, sys, os from arcpy import env env.overwriteOutput = True temp_lyr_location = r"\Cases_Geodatabase.gdb\temp_parcel_lyr" parcel = r"Parcel" try: lyr = os.getcwd() + temp_lyr_location mxd = arcpy.mapping.MapDocument("CURRENT") except Exception as e: arcpy.AddError('ERROR initializing: /n' + e.message) #------------------------------------------------------------------------------- def MakeCaseFeature(): ''' Dissolve selected parcel features into one temporary lyr file. Append it to the Cases feature class. Delete the temporary lyr file. ''' clear = "CLEAR_SELECTION" target = "Cases" schemaType = "NO_TEST" fld = "CENTRACT" # no data is stored in this field selectType = "HAVE_THEIR_CENTER_IN" try: # make temporary parcel lyr file from selected parcels, dissolving them # into one feature arcpy.Dissolve_management(parcel, lyr, fld) # add case feature in temporary layer to Cases arcpy.Append_management(lyr, target, schemaType, "", "") # select new case feature arcpy.SelectLayerByLocation_management(target, selectType, lyr) # delete temporary layer arcpy.Delete_management(lyr) # clear selection on parcels arcpy.SelectLayerByAttribute_management(parcel, clear) except Exception as e: arcpy.AddError("ERROR in MakeCaseFeature: \n" + e.message) #------------------------------------------------------------------------------- def main(): ''' Check how many parcels are selected. Count returns all parcels if none are selected, or only selected ones if there are any. ''' try: count = int(arcpy.GetCount_management(parcel).getOutput(0)) arcpy.AddMessage(str(count) + " parcels selected") # make sure parcels are selected before running rest of script, otherwise exit if count >= 0 and count <= 10: MakeCaseFeature() # create the case feature arcpy.RefreshActiveView() arcpy.RefreshTOC() else: arcpy.AddError("No features selected! \n Please select at least one parcel feature. \n") arcpy.AddError("Quitting the Create Case tool \n") except Exception as e: arcpy.AddError('ERROR in main: /n' + e.message) #------------------------------------------------------------------------------- if __name__ == '__main__': main()
... View more
01-17-2013
05:02 AM
|
0
|
11
|
5774
|
|
POST
|
Looks nice, but not all the other pages seem to be working. For example, clicking the Home tab on some of the inside pages doesn't seem to do anything.
... View more
12-12-2012
10:23 AM
|
0
|
0
|
977
|
|
POST
|
why not just use the hosted CDN copy of our API? Well, this is just testing on my machine, but also not familiar with the hosted CDN. More familiar with the programming side of things than network/server setup. Apparently the city has ArcServer that services are published to, web access through IIS. I may have that wrong, it's been years since I set up anything myself. I think I need a 'services publishing web for dummies' tutorial. :confused:
... View more
12-12-2012
10:16 AM
|
0
|
0
|
1214
|
|
POST
|
Ok, thanks, then I can ignore that? Anything I should replace/do instead? I'm just using IIS to test things out. We'll be migrating from 10.0, using ADF on the actual server, to 10.1, where we need to upgrade to JS, Silverlight, etc., and we'd prefer JS.
... View more
12-12-2012
07:29 AM
|
0
|
0
|
1214
|
|
POST
|
I'm trying to install & test the Javascript API on my local machine using IIS (C:\inetpub\wwwroot) using the instructions in the install.html file shown below. I don't understand the bolded instructions. I don't have the 'ArcGIS Server REST SDK' installed locally anywhere I can find. Any help on what this means and how to proceed? Thanks, appreciate it. Actual coding is easier than the setup, I think.
Test the Install
Access the ArcGIS JavaScript library from your Web server using the following URL:http://<myserver>/arcgis_js_api/library/3.2/jsapi/init.js and http://<myserver>/arcgis_js_api/library/3.2/jsapicompact/init.js
Change the ArcGIS Services Directory "View In JavaScript" URL. Instructions are given in "Configuring the REST API" in the ArcGIS Server REST SDK. On Windows, the location is <Installation Location>\DeveloperKit\Help\REST\index.html. On UNIX and Linux, the location is http://<myserver>:8399/<instance>/sdk/rest/index.html where myserver is your server name and instance is the instance name (jsapi is the default).
Find the "JavaScript API" section for either .NET or Java for more information about parameter values.
For .NET, the parameters to change in rest.config are <ArcGIS> and <ArcGISCSS>. Replace serverapi.arcgisonline.com with your server domain name.
For Java, the parameters to change in rest-config.properties are jsapi.arcgis and jsapi.arcgis.css. Replace serverapi.arcgisonline.com with your server domain name.
Test your install. You can use the following test code to validate your JSAPI library install.
... View more
12-11-2012
07:26 AM
|
0
|
7
|
2349
|
|
POST
|
Let me know if that doesn't answer your question. That is one of the best answers I've ever seen. Exactly to the point. Thank you very much. Have a great weekend.
... View more
11-09-2012
10:25 AM
|
0
|
0
|
2405
|
| Title | Kudos | Posted |
|---|---|---|
| 6 | 08-22-2019 07:41 AM | |
| 1 | 05-05-2014 04:30 AM | |
| 1 | 08-15-2018 06:23 AM | |
| 3 | 08-06-2018 07:31 AM | |
| 1 | 03-30-2012 08:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
12-12-2021
01:00 PM
|