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.
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.
Are you sure the definition queries are actually selecting records? It looks like you are building queries to select text, but I don't see embedded quotes around the text on the right side of the equals sign.
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.
Can you be more specific about what you expect to happen and what is happening? Your script is doing a variety of things, have you stripped it down to focus only on the parts that you believe aren't working?
The script you uploaded seems incomplete. For example, there is a call to Select Layer By Attribute to clear a selection but a selection is never made in the script. Is there a selection being made before the script executes? If so, what is it?
Where is this being executed? In a tool, in the interactive Python window, etc...?
What version of ArcMap are you using?
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.