POST
|
This got discussed fairly recently and I think this thread should answer your question https://community.esri.com/thread/194310-zoom-map-to-an-layer-in-arcpymp-arcgis-pro-project "I just talked to an arcpy.mp developer and he said zooming on a Map View is not supported in arcpy.mp yet and probably will not be for awhile."
... View more
06-02-2017
12:47 PM
|
1
|
0
|
493
|
POST
|
I figured it out, problem with a bad definition query.
... View more
05-31-2017
12:27 PM
|
0
|
0
|
626
|
POST
|
It is part of a larger script that will eventually export the map to a pdf. I need to get the count of the features in the current map extent for that layer then change the definition query depending on the count.
... View more
05-31-2017
11:34 AM
|
0
|
0
|
626
|
POST
|
How a script can work within a map document python interpreter but fail as a standalone script has puzzled me several times and I usually find a way to work around it. This one though I want answers to. I have simplified a part of a much larger script to indicate the issue I am having, all I want to do is select all the features within the current map extent(I need a count of them, so I use this with GetCount). Since Select By Attribute works with the Extent Environmental variable, I figured that was the easiest way to do it. When running with the python interpreter in a map document, this script works fine. import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
Layer2 = arcpy.mapping.ListLayers(mxd, "USA City Populations")[0]
df = arcpy.mapping.ListDataFrames(mxd)[0]
arcpy.env.extent = df.extent
arcpy.SelectLayerByAttribute_management(Layer2) It select all the features in my dataframe extent as I want. However, I want to run this as a standalone, only changing the mxd to the file path of the map document instead of the "CURRENT" key word it fails. ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute). Select By Attribute is supposed to be able to work with TOC Layers, so I don't see why there is an issue using a Layer Object. I've also attempted this with the Layer Name as it appears in the TOC hard-coded in as the input for SelectLayerByAttribute. Again this works fine when run within the map document with the python interpreter and using the "CURRENT" Keyword but fails as a standalone with the map document path hard coded in. I know the workaround is just to make a Feature Layer, but I want to understand why this simple code won't work standalone but will within the python interpreter.
... View more
05-31-2017
08:33 AM
|
0
|
4
|
1065
|
POST
|
The ESRI World Elevation Service is a good place to start. https://blogs.esri.com/esri/arcgis/2014/07/11/introducing-esris-world-elevation-services/ http://desktop.arcgis.com/en/arcmap/10.3/manage-data/raster-and-images/what-are-the-world-elevation-image-services.htm Determine resolution of the data in your AOI http://www.arcgis.com/home/item.html?id=3af669838f594b378f90c10f98e46a7f All data used here is "accurate" but obviously depending on your purpose and the size of your Area of Interest you may want a higher or lower resolution DEM to work with. Obviously the higher the resolution the more detailed the terrain is and more descriptive of the actual surface, but with more data takes more processing time. There are other sources of elevation data that is also free, if you would be willing to describe in more depth your area of interest and what sort of analysis you were wishing to do, it would help point you in the right direction. Edit: Also you need an ArcGIS Online Subscription to use the World Elevation Service
... View more
05-26-2017
07:12 AM
|
1
|
0
|
350
|
POST
|
Python strings are immutable, you cannot simply just change the value in your existing row using the replace method on the existing string. You would need to set row[0] to a new string that replaces the values in the old string. row[0] = row[0].replace("-", " ") https://www.tutorialspoint.com/python/string_replace.htm Also, when using a with statement, you do not need to delete your cursor it will close upon completion.
... View more
05-25-2017
12:15 PM
|
1
|
4
|
2083
|
POST
|
Apparently its too early and my reading comprehension is not what it needs to be... TFuchs-esristaff
... View more
05-25-2017
07:35 AM
|
0
|
0
|
832
|
POST
|
Have you made sure to not only set the envelope and query, but make sure it is being applied in the settings? Based on your screenshot there is a Boolean to actually use the query and envelope values you put in, which I would imagine equates to getUseSelectionQueryAndSpatialEnvelope() method mentioned in the help. You are probably writing your envelope parameters correctly, its just not being applied and you need to set that value to True. It would be nice if there was better help examples on that documention link for FGDB settings for CE import.
... View more
05-25-2017
06:30 AM
|
0
|
9
|
832
|
POST
|
Not sure about a text formatting tag for halos, but what you could do is set up two label classes, each with no definition query and have the labels based on different fields and with different label styles. Obviously you end up with no control on how the labels stack or display in relation to each other, but it is somewhat a solution.
... View more
05-24-2017
01:07 PM
|
1
|
0
|
549
|
POST
|
"@param env: The spatial envelope with syntax (xMin, xMax, yMin, yMax). (default = None). [sequence of float]" Have you tried entering the values as a tuple instead of a list in the parameters? Not sure it makes a difference, but the example does show it as a tuple not a list.
... View more
05-24-2017
09:34 AM
|
1
|
1
|
832
|
POST
|
You probably need to use a None, not a NULL. http://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field-examples.htm#ESRI_SECTION1_DFE39ACAD4144118AF066C6F2856197F See last example. (I know nothing about Attribute Assistant, but this seemed relevant) Edit: See also https://community.esri.com/docs/DOC-8284
... View more
05-23-2017
02:51 PM
|
0
|
1
|
1133
|
POST
|
A few questions: 1. You are trying to change the workspace paths(path to the dataset) for a certain workspaces(i.e some of your layers will not change paths, but you want certain workspaces changed_? 2. Is the new workspace the same for each and every layer that is one of thsoe certain workspaces? 3. Why if you are working with layer properties, are you trying to replace workspaces for the entire mxd? You should just want to change the layer path if it meets a criteria, or check a whole mxd for a certain path(s) and change them. You are currently mixing and matching If you know all the workspaces you need replaced and need them all to the new workspace, I would write them all to a list, then evaluate for that layer(la.workspace) is in that list, instead of using a bunch of conditional statements. If so then change layer workspace path to the new one, if not skip it. You can use the supports() method to check for web service layers as well and make sure their workspace path is not checked. Also layers have no workspace property, its workspacePath(la.workspacePath)
... View more
05-22-2017
01:58 PM
|
0
|
1
|
777
|
POST
|
Your questions is extremely broad and you aren't posting any code so it is difficult to respond adequately to you. As far as the ESRI basemaps, they are web services and several layer properties are not supported for web service layers. There is the support() method which can be use to test if a map layer supports a certain property and will likely be needed in order to have whatever script you are wishing to develop to ignore web service layers. http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/layer-class.htm http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/updatingandfixingdatasources.htm As far as logic to seperate out different versions of ArcMap Map Documents, you can see this thread here https://gis.stackexchange.com/questions/62090/arcpy-method-to-determine-arcmap-document-version If you give more information, especially with the types of errors you are getting it would help us help you.
... View more
05-22-2017
01:19 PM
|
1
|
4
|
777
|
POST
|
Any more information on the error you are getting? Are you sure you are creating the layer object for the correct layer in your map document? Without more information its hard to know why exactly the script is failing. Also see this thread and make sure relative paths are not on when replacing data sources https://gis.stackexchange.com/questions/40549/replacing-layer-data-sources-using-replacedatasource-of-arcpy?rq=1
... View more
05-22-2017
11:53 AM
|
0
|
0
|
1001
|
POST
|
That means when you use the placeholder variable shape in the loop, it should be the name of each of those shapefile in turn. This is what you have: lyr.replaceDataSource(r"\\path\Set1Test", "SHAPEFILE_WORKSPACE", "") This is what it should be(As Jim previously noted): lyr.replaceDataSource(r"\\path\Set1Test", "SHAPEFILE_WORKSPACE", shape) Also wouldn't hurt to refresh the active view after changing the source each time with arcpy.RefreshActiveView()
... View more
05-19-2017
07:44 AM
|
0
|
2
|
1001
|
Title | Kudos | Posted |
---|---|---|
1 | 02-22-2017 08:58 AM | |
1 | 01-19-2017 09:34 AM | |
1 | 07-26-2017 12:56 PM | |
1 | 04-11-2018 12:35 PM | |
1 | 06-16-2015 07:59 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|