POST
|
I finally got this to work - though I had to create a copy of my queried feature class. Here's the code in case it helps anyone. # 1. Import modules and set environment
import arcpy, os, sys, traceback
from arcpy import env
env.workspace = r"F:\Workspace\AFPE\NRS03_AFPE.gdb"
path = 'F:\\Workspace\\AFPE\\2016\\RawMaps2\\'
# stop temp layer from being added to map
arcpy.env.addOutputsToMap = False
# 2. Open a map document - F:\Workspace\AFPE\2016\RawMaps\test.mxd
mxd = arcpy.mapping.MapDocument(r"F:\Workspace\AFPE\2016\RawMaps2\14004.mxd")
df = arcpy.mapping.ListDataFrames(mxd)[0]
try:
# 3. grab USAState layer
lyr = arcpy.mapping.ListLayers(mxd,"USAState",df)
stLyr = lyr[0]
print df.scale
# 4. make duplicate layer of queried USAState and zoom to extent
arcpy.CopyFeatures_management(stLyr, r"in_memory\temp")
desc = arcpy.Describe(r"in_memory\temp")
ext = desc.extent
mxd.activeDataFrame.extent = ext
arcpy.RefreshActiveView()
print df.scale
# 5. clean up
del df, mxd, lyr, stLyr, env
arcpy.Delete_management(r"in_memory\temp")
print 'Map extent complete.'
except:
print 'Program failed.'
del df, mxd, lyr, stLyr, env
arcpy.Delete_management(r"in_memory\temp")
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n " + str(sys.exc_type) + ": " + str(sys.exc_value) + "\n"
msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n"
arcpy.AddError(msgs)
arcpy.AddError(pymsg)
print msgs
print pymsg
arcpy.AddMessage(arcpy.GetMessages(1))
print arcpy.GetMessages(1)
... View more
09-07-2016
11:11 AM
|
1
|
0
|
715
|
POST
|
the definition queries are working. It is outputting roughly 90 maps which show the different distribution for each species. So the layer's symbology changes with each new definition query. I think it might look like it's selecting text because I use a variable name in the definition query. Anyway, that part works perfectly - its the zoom to layer that I can't get to work. It seems to only zoom to the entire US, not the states that are involved in the definition query. I thought it might have something to do with the format of the loop. All the examples I have found of zooming to a layer's via the definition query seem so simple and straightforward - though it doesn't work for me - so it could very well be that the code is malfunctioning somewhere else. I also wonder if it would just be easier to create a selection set to zoom to, but I don't want the selection highlighted on the map.
... View more
09-02-2016
11:24 AM
|
0
|
1
|
715
|
POST
|
Hi Joshua, My script uses a Look up table to grab a species code - that code is used for the definition query on two shapefiles (a state layer and a county layer). This part is working perfectly. The Select Layer by Attribute is unnecessary, I don't want to have to make a selection and I think I should be able to do this without making a selection. What I wanted to do is zoom to the extent of the state layer after the definition query is performed. Right now the extent just keeps zooming out due to the line where I multiple the scale by 1.1. If I remove that line, then the scale never changes. I thought the getExtent method is what I needed to zoom to the visible extent of the layer after the definition query. does that help clarify? Oh, I am also doing this in IDLE so it runs outside of ArcMap v. 10.3.1 - a stand alone script.
... View more
09-02-2016
07:55 AM
|
0
|
3
|
715
|
POST
|
I am using a definition query to produce species distribution maps and having issues setting the extent of the map (similar to zoom to layer in arcMap's TOC). I think it has to do with the loop, but I'm not sure. Any help or tips are greatly appreciated.
... View more
09-01-2016
11:09 AM
|
0
|
5
|
1743
|
POST
|
Hey Cody, I was just playing around with the segmentation tools last night and it seemed like a step in the right direction. I do not need to map this data - I am mainly extracting data from the photos. And, I do have both the horizontal and vertical views. My main objective with this is to create a database containing the width and height of the smoke plume spread for each photo. Xander, yes I am very much interested in a python scripting approach! I'll look into the package you mention. Thanks so much to all of you for your thoughts and ideas on this. Laura
... View more
01-13-2016
09:38 AM
|
0
|
0
|
1200
|
POST
|
Thanks Dan. I'll look into the tools you mention. I have been playing around in arcmap making all kinds of rasters, though I am not getting the results I would like. I'll play around a bit more and see what I come up with. Thanks for your advice and if anyone else has ideas please let me know.
... View more
01-12-2016
12:10 PM
|
0
|
0
|
1200
|
POST
|
Thanks Dan! That makes complete sense. I guess I was just overthinking the scale issue. In terms of processing the smoke images - I am interested in finding the boundary or extent of the plume. Does anyone know of a simple way to extract that?
... View more
01-12-2016
10:40 AM
|
0
|
2
|
1200
|
POST
|
Hey Dan, yes, these are black and white images. And, the camera was mounted in a single position, so the frame of the image should be exactly the same for each image in the sequence. One more question that comes to mind, is how to apply a scale to the image? I have two photos that provide the horizontal (shown below) and vertical distance. Is there anyway to use these scale images to sort of georeference the series of smoke plumes images? In the end, I would like to gather data on the diffusion and spread of the smoke in cm for each raster. Any thoughts on this are much appreciated!
... View more
01-12-2016
10:25 AM
|
0
|
4
|
1200
|
POST
|
I have a number of jpegs (similar to that below) that show smoke moving out of a insect funnel trap over time. I am interested in measuring the horizontal and vertical spread of the smoke. I assume that I can do this using image analysis, but I have not done this type of analysis before. I am looking for any ideas or tools that can be used to "track" the smoke movement. I also noticed that I can symbolize these images in ArcMap using a vector field which is very interesting, but I do not understand how this visualization can be used. Does anyone use the vector field symbology and if so, what for? Any ideas or tips are greatly appreciated.
... View more
01-12-2016
09:08 AM
|
0
|
9
|
3745
|
POST
|
Arc did allow me to bring the CSV file in with numbers at the beginning of field names, but when that table is exported into a gdb then the field names are changed to include an "F" at the beginning of the numeric field name. Also, thanks Dan for links. I'll check into those and try not to create poorly constructed excel files.
... View more
12-04-2015
11:52 AM
|
0
|
0
|
388
|
POST
|
Thanks to all of your for all of your helpful comments. It ended up working when I changed the table to a csv file. I guess Arc 10.3.1 and Excel 2013 don't play nicely together. Thanks so much for your help - this forum is great for a speedy response to most all of the GIS problems I run into! Have a great weekend!
... View more
12-04-2015
11:03 AM
|
0
|
1
|
388
|
POST
|
Richard, I tried making all those values ones and it still didn't work. I do completely understand what you are saying, though. I guess I'll try a few more changes to the table and see what happens. Laura
... View more
12-04-2015
10:28 AM
|
0
|
2
|
388
|
POST
|
Hi Daren, Are you doing anything special to the table, like placing it in a geodatabase? When I try to run the tool (after changing the values to all positives) it tells me that the input table does not exist or is not supported. Just wondering what you did to make it work.
... View more
12-04-2015
10:25 AM
|
0
|
3
|
1773
|
POST
|
I altered my excel file (attached) so that the negative values were just zeros instead of a negative value and re-ran the bearing distance tool using the alt10yrSpread or the alt20yrSpread fields for the distance and it still didn't work. Here's the error that I get in case that helps to figure out the problem: Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 2360, in BearingDistanceToLine raise e ExecuteError: ERROR 999999: Error executing function. No current record. Failed to execute (BearingDistanceToLine). Any other ideas on how to draw these lines besides manually drawing them in an editing session is greatly appreciated.
... View more
12-04-2015
08:55 AM
|
0
|
9
|
1773
|
POST
|
I have three fixed points and a number of lines I would like to draw that radiate out from each point. I have tried to use the bearing distance to line tool but it keeps failing for some reason and I'm not exactly sure how to draw my lines otherwise. I am using the angle field for the bearing and this is in degrees (I think...the values fall between 0 and 360). And my distance field is the 20yrSpread field which is in KM. Any help is greatly appreciated...see the attached table.
... View more
12-03-2015
01:54 PM
|
0
|
14
|
6144
|
Title | Kudos | Posted |
---|---|---|
1 | 09-07-2016 11:11 AM | |
1 | 06-12-2015 11:43 AM | |
1 | 06-11-2015 12:18 PM | |
1 | 06-10-2015 06:55 AM | |
1 | 02-05-2015 11:11 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|