|
POST
|
All, I am hoping that someone could assist me with getting a reproducible case of the issues described here. This will be very helpful in determining the problem and what would be necessary to resolve the defect in the software. If you have sample data and steps to recreate the issue could you please send me this information? Thank you,
... View more
09-16-2011
01:34 PM
|
0
|
0
|
7044
|
|
POST
|
So you find the following code doesn't work for you?
IEnvelope newExtent = new EnvelopeClass();
newExtent.XMin = xmin;
newExtent.XMax = xmax;
newExtent.YMin = ymin;
newExtent.YMax = ymax;
mapDoc.ActiveView.Extent.Envelope = newExtent The reason I ask is because I still see potential problems in your code in the scenario where the value you have in xmin or ymin is greater than the xmax or ymax of the current ActiveView Envelope.
... View more
08-29-2011
08:18 AM
|
0
|
0
|
1561
|
|
POST
|
Hi Dan, No not quite, unfortunately there is no supported python module at this time for building GUIs with python add-ins. So if you need to build a button that displays a form to accept user input and execute some code you will still need to use .Net or Java add-ins for Desktop. However, there are many powerful things you can do with python add-ins. For example if you want to listen and respond to certain application events, like onDeleteFeature or onCreateFeature you can do that with a python add-in application extension. Or if you want to create a tool that allows the user to draw a rectangle on the map to return an extent object and execute some python code based on the user input you can do that with a python add-in tool More than just the functionality is the fact that python add-ins take advantage of the same framework for .Net and Java add-ins which makes it very easy to share and install these customizations.
... View more
08-16-2011
10:41 AM
|
0
|
0
|
1060
|
|
POST
|
Hi Kim, Here is the correct link to get the python add-in wizard. However, python add-ins are different then python toolboxes. Python add-ins allow you to build custom ui elements like buttons and toolbars with arcpy. For more information on Python Toolboxes I would encourage you to check out the following help topic, What is a Python Toolbox. For the request to create a blank python script as part of the script tool wizard I would recommend you post the idea on ideas.arcgis.com as there may be more people who would be interested in that functionality as well. -Chris
... View more
08-16-2011
08:11 AM
|
0
|
0
|
1060
|
|
POST
|
Hi Kim, How about the opposite, work entirely outside of ArcMap to create your toolbox and script tools. This is the idea behind Python Toolboxes at 10.1. everything you need to define the Toolbox, the script tools, their paramaters, validation and execution code all in one python script. I would encourage you to check it out because although you know longer have the wizard to step you through the creation of the script tool, it is really more convienent to manage everything in the one python script.
... View more
08-15-2011
03:37 PM
|
0
|
0
|
1060
|
|
POST
|
Yes, this is expected because you are launching the Feature Class to Geodatabase (multiple) from the context menu for the Geodatabase. If you want to launch the tool without any paramaters populated you can do this by accesing the tool from ArcToolbox or the Search Results.
... View more
08-09-2011
11:58 AM
|
0
|
0
|
311
|
|
POST
|
Hi Samuel, Sorry about that but forgot one additional step. It is not possible to just pass in a layer object as an input to the geoprocessing tool, first you need to convert it toa layer file and then pass in the layer file path. Below is a sample:
# Import arcpy module
import arcpy
# Set the workspace
arcpy.env.workspace = "c:/LPK"
# Overwrite pre-existing files
arcpy.env.overwriteOutput = True
# Local variables:
mxd = arcpy.mapping.MapDocument(r"C:\LPK\Paquetage_de_Couche.mxd")
lyr = arcpy.mapping.ListLayers(mxd, "Test")[0]
lyrFilePath = r"C:\LPK\myLayerFile.lyr"
lyr.saveACopy(r"C:\LPK\myLayerFile.lyr")
Package = r"C:\LPK\Packaged_Layer.lpk"
# Process: Package Layer
arcpy.PackageLayer_management(lyrFilePath, Package, "PRESERVE", "CONVERT_ARCSDE", "DEFAULT", "ALL", "ALL", "CUR
#Optionally delete layer file when done
arcpy.Delete_management(lyrFilePath)
... View more
08-02-2011
02:12 PM
|
0
|
0
|
842
|
|
POST
|
You could either not create the feature class to begin with and create the output with the geometry of the polygon using copy features at the end of the script or use an insert cursor to add a new row to the feature class and assign the geometry of the polygon to the shape field in the row.
... View more
07-26-2011
01:14 PM
|
0
|
0
|
415
|
|
POST
|
Samuel, You would want to something like the following to get a reference to the layer in the map document.
mxd = arcpy.mapping.MapDocument(r"C:\Data\MyMapDoc.mxd")
lyr = arcpy.mapping.ListLayers(mxd, "LayerName")[0]
... View more
07-26-2011
01:11 PM
|
0
|
0
|
842
|
|
POST
|
Kim is correct, it is not possible to enable Data Driven Pages through arcpy. In addition, it is not possible author or enable Data Driven Pages through the ArcObjects API either. This can only be done in ArcMap via the Data Driven Pages toolbar.
... View more
07-26-2011
01:03 PM
|
0
|
0
|
990
|
|
POST
|
I believe this is what is causing the issue. First the extent of the data frame is defined as: XMIN: 2055276.37123 YMIN:-4018755.96024 XMAX: 2055518.36111 YMax: -4018583.26583 The first thing the code tries to do is set the XMIN of the extent to 3448672.2243 which would give you the following extent: XMIN: 3448672.2243 YMIN:-4018755.96024 XMAX: 2055518.36111 YMax: -4018583.26583 The problem is that now you have an extent where the XMIN is greater than the XMAX and this is not a valid extent so the software automatically changes XMIN to the closest valid value for the extent, 2055518.36111. When you try to set XMAX to 3450982 it works fine because it is larger then XMIN. This code will work sometimes, but only in the events when you attempt to set a new XMIN or YMIN that is less than the XMAX or YMAX. The better way to approach this would be like the option discussed by Chris Mathers to create a new extent object from your extent values and assign it to the extent of the dataframe. myExtent=arcpy.Extent(3449977,-3492834,3450982,-3492116) dataFrame.extent = myExtent
... View more
07-25-2011
12:59 PM
|
0
|
0
|
1561
|
|
POST
|
What happens if you start a new map document, create a new group layer and add the parks feature class to it? Avoid just copying and pasting the layer, but rather recreate the layer. Either way would it be possible for you to send your map document and the parks feature class to me? I have tested with the same exact scenario at 9.3 with a group layer called county features and a sub layer called parks and it worked as expected, so I am interested in what might be different in your test scenario.
... View more
07-07-2011
11:31 AM
|
0
|
0
|
1403
|
|
POST
|
Thanks for passing along the code. Initially, I don't see any logic errors that would cause this problem other than "//" a single slash forward or backward should work, but you indicated this was a problem as well. A couple of things to try, can you run the select by location tool in arcmap when selecting the layer within the group as the input? Write a simplified script with everything hardcoded that only does a select by location on the group layer. Then create a script tool with no paramaters and run it, does it work?
import arcgisscripting
gp = arcgisscripting.create(9.3)
gp.SelectLayerByLocation_management("county features/parks", "WITHIN", "AnotherLayer", "", "NEW_SELECTION") #Change "AnotherLayer" to a layer in the Map Document to use in the selection In your original code you can also add gp.AddMessage statements to print variables that are being passed into the Select Layer by Location function call. Specifically it would be good to see what is actually being stored in the variable 'imp' when it is passed to Select Layer by Location.
... View more
07-06-2011
08:58 AM
|
0
|
0
|
1403
|
|
POST
|
Hello, I reviewed the other thread and Dale provided the proper method to pass a layer inside a Group Layer to a geoprocessing tool through python. Could you share more of your code? Do you pass the layer in as a parameter to the Script Tool or is hardcoded in the script? In regards to your other point, unfortunately at 9.3 there is not an effective way to determine if a layer is a group layer or not. At ArcGIS 10 with the addition of the mapping module this functionality was added with the Layer Class and the isGroupLayer property. You can learn more about this here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Layer/00s300000008000000/
... View more
07-05-2011
01:17 PM
|
0
|
0
|
1403
|
|
POST
|
Hi Josh, I think your code looks fine. Is there anything else in the Cemetary Feature Dataset other than the Cemetary Feature Class? Same with Churches? I think the issue is specific to your geodatabase. Would you be able to send me the GDB or if it is too large try pulling out some of the good and offending feature datasets into a new GDB to send?
... View more
06-14-2011
07:54 AM
|
0
|
0
|
2040
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-02-2011 03:59 PM | |
| 1 | 06-10-2011 08:37 AM | |
| 1 | 06-08-2011 04:27 PM | |
| 1 | 06-07-2011 03:11 PM | |
| 1 | 01-31-2013 02:36 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|