|
POST
|
Do you want a listing of the unique pixel values or to actually store each pixel's value?
... View more
01-13-2014
09:39 AM
|
0
|
0
|
4398
|
|
POST
|
I think I might just go for a complete uninstall and reinstall I know it seems drastic, but just think of all the time it would have saved if you had just done this in the 1st place! ... I speak from experience :rolleyes:
... View more
01-03-2014
08:16 AM
|
0
|
0
|
2619
|
|
POST
|
Perhaps you installed another version of Python other than the one that is (by default) installed with ArcGIS? BTW: Do not do that. Although it seems drastic, my recommendation is to uninstall anything and everything ArcGIS and Python related, and reinstall ArcGIS... which as I said auto installs/configures the coorect vbersion of Python. Then if you want, install the appropriate version of PythonWin. For v10.2, I believe that would be the 'pywin32-218.win32-py2.7.exe' file available here: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/
... View more
01-02-2014
08:20 AM
|
0
|
0
|
2619
|
|
POST
|
You could do this with a select by location in a loop and a search cursor (to keep tabs on your elevation and area values). I have some scripts that do a similar thing. Some issue that will come up: 1. What parcel should you start the process with. Depending on the start point, you can potentially have different outcomes. 2. As other parcels are "globbed" on to the selection, do you want a "chaining effect" and if so, how many parcels "long" would the chain be allowed to have.
... View more
12-16-2013
12:23 PM
|
0
|
0
|
453
|
|
POST
|
So I have this image service that I want to use to batch extract some data out of. The issue I am running into is that via Python you must limit each "clip" to a predefined extent limit... in my case: 4100 rows x 15000 columns. Funny thing is that if I just "drag" the image layer from ArcMap into... say the CopyRaster tool... I can download as big of a tile as I want... but only if I connect to the image service directly through ArcMap. I've seen this post (http://forums.arcgis.com/threads/59661-Setting-the-Maximum-image-size-per-request-for-an-Image-Service) about getting the image service admins to change the default max tile size, but... Why does this work via ArcMap and not a Python script? And specifically, how can I get my Python script to perform (and download whatever size tile I want!) like ArcMap?!?! This is what some basic code looks like... but bombs if the tile polygon is "too big": import arcpy
arcpy.env.overwriteOutput = True
arcpy.SetLogHistory(False)
arcpy.env.pyramid = "None"
arcpy.env.rasterStatistics = "None"
naipImgPath = r"\\snarf\am\div_lm\ds\gis\tools\sde_connections_read\arcgis_geoservices.wa.gov\ImageServices\Statewide_2011_1m_434color_wsps_83h_img_blah_blah_so_u_dont_f_with_it.ImageServer"
clipFC = r"C:\csny490\test.shp" #this assumes to have multiple polygons and a field called TILE_ID
outDir = r"C:\csny490\temp" #Folder where the clipped outputs will go
arcpy.env.snapRaster = naipImgPath
searchRows = arcpy.da.SearchCursor(clipFC, ["SHAPE@","TILE_ID"])
for searchRow in searchRows:
shapeObj, tileId = searchRow
outRaster = outDir + "\\clip_tile_" + str(tileId) + ".img"
arcpy.env.extent = shapeObj.extent
arcpy.MakeImageServerLayer_management(naipImgPath, "image_server_layer") #bombs with "tile too big" if done before the cursor
arcpy.CopyRaster_management("image_server_layer", outRaster, pixel_type="8_BIT_UNSIGNED")
del searchRow, searchRows
... View more
12-02-2013
02:42 PM
|
0
|
1
|
2674
|
|
POST
|
How about: #prints a list of the selected layers in the TOC along with the number of selected records
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
for lyr in arcpy.mapping.ListLayers(df):
selectedCount = len([int(fid) for fid in arcpy.Describe(lyr).fidset.split(";") if fid != ''])
if selectedCount > 0:
print "The " + str(lyr) + " layer has " + str(selectedCount) + " records selected..."
... View more
11-25-2013
07:30 AM
|
0
|
0
|
844
|
|
POST
|
If you build a hillshade for the DEM in the area of the lake, does it appear to have "topographic relief"? Otherwise if it appears flat (as a lake surface would), the DEM probably represents the surface elevation. Probably unlikely that the DEM includes bathymetry... For example, if it's a USGS 10m DEM or something I guarantee it doesn't. A lake won't have a negative elevation unless it is below sea level Sort of... A lake may have a surface elevation of 314ft > MSL, but the depth of it may be 350ft deep, so that would leave the bottom of the lake at 36ft < MSL. For example: http://en.wikipedia.org/wiki/Lake_Whatcom
... View more
11-19-2013
03:08 PM
|
0
|
0
|
4333
|
|
POST
|
Don't use the dissolve option... You are running out of RAM. You might consider running the dissolve tool on the buffer output as a separate step - specifying the Distance field as the dissolve field - assuming the geometry of each distance ring is able to be dissolve separately.
... View more
11-19-2013
02:55 PM
|
0
|
0
|
828
|
|
POST
|
An invalid SQL statement was used. Probably not for the SelectByLocation, probably for the MakeFeatureLayer... Instead of: clause = "\"'NAME10' = " + cityname + '"' try: clause = "NAME10 = " + "'" + cityname + "'"
... View more
11-19-2013
02:23 PM
|
0
|
0
|
2695
|
|
POST
|
Woops - jinx - had that window open too long before I hit submit!
... View more
11-19-2013
02:08 PM
|
0
|
0
|
2512
|
|
POST
|
Not sure how to pull it off in model builder, but the Python datetime module works like this: import datetime, arcpy
time1 = arcpy.da.SearchCursor(myFC, ["MY_DATE_FIELD"], "OBJECTID = 1").next()
time2 = datetime.datetime.now()
elapsedTime = time2 - time1
print "Total elapsed seconds: " + str(elapsedTime.totalSeconds)
print "Total elapsed days: " + str(elapsedTime.days)
... View more
11-19-2013
02:07 PM
|
0
|
0
|
2512
|
|
POST
|
Might be useful to have some communication from ESRI as to why this hasn't been implemented yet. This particular idea was submitted 3.5 years ago and clearly has broad user demand, but yet it is listed as "Deferred". I get the feeling that for some of these things, we can up vote ideas till the cows come home, but... Some official explanation might be useful (32 vs. 64 bit compatibility issues or something?), since the lack of communication on some of these topics, in my opinion, often makes ESRI look unresponsive and foments user frustrations. Maybe if an idea attains a certain point level, but is impractical to implement for some technical reason, there could be an official post from ESRI staff providing a high level explanation what the holdup is.
... View more
11-19-2013
12:03 PM
|
0
|
0
|
2047
|
|
POST
|
How about something like this: import arcpy
cityFC = r"C:\temp\city_polygons.shp"
indexFC = r"C:\temp\index_polygons.shp"
arcpy.MakeFeatureLayer_management(indexFC, "index_fl")
searchRows = arcpy.da.SearchCursor(cityFC, ["SHAPE@","CITY_NAME"])
for searchRow in searchRows:
geomObj, cityName = searchRow
arcpy.SelectLayerByLocation_management("index_fl", "INTERSECT", geomObj, "", "NEW_SELECTION")
arcpy.CalculateField_management("index_fl", "CITY_GRID", "'" + cityName + "'", "PYTHON", "") Note that if you want the "first" city to trump subsequent ones (in the case of overlap), you would want to sort the cityFC search cursor by OID in decending order (by default the sort order is by OID in ascending order).
... View more
11-19-2013
09:46 AM
|
0
|
0
|
2695
|
|
POST
|
What if one of your grid cells has multiple cities within it?
... View more
11-19-2013
08:52 AM
|
0
|
0
|
2695
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-25-2014 12:57 PM | |
| 1 | 08-29-2024 08:23 AM | |
| 1 | 08-29-2024 08:21 AM | |
| 1 | 02-13-2012 09:06 AM | |
| 2 | 10-05-2010 07:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-30-2024
12:25 AM
|