|
POST
|
What happens when you do len(arcpy.mapping.ListLayers(mxd,"Suburb",df)) Does this list layers actually find the layer object you want to interact with? Also, lyr is a layer object which I don't think is a valid input to MakeFeatureLayer. Try lyr.name. Good luck. Micah
... View more
07-30-2017
10:09 PM
|
0
|
5
|
7099
|
|
POST
|
You could try an application extension, which as I understand it will listen for events like opening an MXD and then execute some logic, which could include what you mentioned. Creating a Python add-in application extension—Help | ArcGIS for Desktop To zoom to your feature, select it using Select By Attribute and then use the zoomToSelectedFeatures method of the data frame object. DataFrame—Help | ArcGIS for Desktop Good luck. Micah
... View more
07-30-2017
09:57 AM
|
1
|
0
|
1315
|
|
POST
|
I recommend a custom script tool, if they have ArcGIS Desktop. Otherwise a GP service. What is a script tool?—Help | ArcGIS for Desktop
... View more
07-28-2017
08:21 AM
|
1
|
0
|
5651
|
|
POST
|
Can you post a screenshot and detailed description of what is going wrong? Your statement "The feature layer gets uploaded, but there is no data attached to it. The layer doesn't upload" is a bit confusing. Is the layer empty?
... View more
07-28-2017
07:23 AM
|
0
|
5
|
2756
|
|
POST
|
Does it work ok if you run the tool stand-alone (not scripted)? I have a hard time parsing that string-based field map parameter.
... View more
07-28-2017
07:18 AM
|
0
|
1
|
4775
|
|
POST
|
Does the Select (analysis toolbox) run successfully? Can you post a screenshot of the tool parameters? Select has an output FC parameter, not output workspace.
... View more
07-08-2017
09:52 AM
|
0
|
0
|
2142
|
|
POST
|
Hi Laura, From what I can see it looks like your last declaration of the shp variable says: shp = ".tif" I think you meant to have it say: shp = ".shp" Since .tif is a raster format, and the in_features parameter of the Dissolve tool needs to be a feature layer/feature class, that is why it won't work. The output feature class for a Dissolve should be a vector dataset like a Shapefile as well. Also, when needing to combine strings to make paths in Python, I really like to use os.path.join(path, {filename.extension}) so I don't have to use a bunch of + operators in my string. It might be worth considering to minimize confusion. 10.1. os.path — Common pathname manipulations — Python 2.7.13 documentation Hope this helps! Micah
... View more
07-07-2017
03:21 PM
|
1
|
0
|
2304
|
|
POST
|
Hi Joel, I'd recommend a GLOBALID field, which is the ideal primary key for related records. If you publish this dataset as an Esri-hosted Feature Service, the GlobalID values will be generated each time you create a new feature in Collector. You can Add Global IDs in ArcCatalog or with geoprocessing. Micah
... View more
07-07-2017
11:16 AM
|
0
|
0
|
12682
|
|
POST
|
Hi Dennis, Do you mean the latest version of ArcGIS Desktop software? Or the latest version of the shapefile specification? If you just need some random example shapefiles try visiting your favorite Open Data Site. Here are two of mine: Home | HIFLD Open Data City of Portland Open Data Site Micah
... View more
07-07-2017
10:22 AM
|
2
|
1
|
21573
|
|
POST
|
Hi George, Yeah, that should be possible. Here's how I'd break it down: First, create a list of all folders which may contain PDFs. Here's what that would look like for me: # import required modules
import os, arcpy
# create a variable pointing to the root directory that contains all your various PDF folders
rootDirectory = r"W:\scratch"
# create a list of all the folders under the root directory
foldersToSearch = [x[0] for x in os.walk(rootDirectory)] Then, get a unique list of the PDF file names: # create a list of the PDF files
pdfs = []
for f in foldersToSearch:
pdfs += [x for x in os.listdir(f) if x.endswith(".pdf")]
# 'uniquify' the list
pdfs = list(set(pdfs))
print(pdfs)
>>>['def.pdf', 'abc.pdf'] Next I would create a Python dictionary containing the unique PDF names as the keys and a list of the full paths to each matching PDF as the corresponding values. # create the dictionary with each PDF file name as the keys and an empty list as the value
pdfDict = dict((pdf, []) for pdf in pdfs)
# add the full paths to the pdfs that match the key name to each value list
for f in foldersToSearch:
for item in os.listdir(f):
if item.endswith(".pdf"):
pdfDict[pdfDict[item.split("\\")[0]].append(os.path.join(f, item)) Now we have this: print(pdfDict)
>>>{'def.pdf': ['W:\\scratch\\folder2\\def.pdf', 'W:\\scratch\\folder3\\def.pdf', 'W:\\scratch\\folder1\\def.pdf'], 'abc.pdf': ['W:\\scratch\\folder2\\abc.pdf', 'W:\\scratch\\folder3\\abc.pdf', 'W:\\scratch\\folder1\\abc.pdf']}
Now we get fancy. For each key in the dictionary, we'll create an arcpy PDF object, append each of the corresponding PDFs (full paths) to that object, and save it to the root directory: # list each unique PDF name
for item in pdfDict.keys():
# create the pdf object (it will save to your root directory in this example, but could be saved anywhere)
pdfObject = arcpy.mapping.PDFDocumentCreate(os.path.join(rootDirectory, item))
# for each corresponding PDF path, add the PDF to the PDF Object
for pdfPath in pdfDict[item]:
pdfObject.append(pdfPath)
# save and close the finished PDF
pdfObject.saveAndClose() You might need to modify this if the order in which the pages are appended to the master PDF matters, but this should get you going. Hope this helps! Warm Regards, Micah
... View more
07-07-2017
09:39 AM
|
3
|
1
|
3871
|
|
POST
|
Hello Laura, When I have trouble finding the correct Python syntax for a geoprocessing tool, my first inclination is to run the tool directly from the GP dialog, right-click the result in the results Window, and choose "Copy as Python Snippet." From there, you can paste it into your Python window or script and see the correct syntax, which you can use directly or modify for your needs within your geoprocessing script. Anyways, I took a crack at it with a 2013 Columbia County, OR taxlot dataset. The correct syntax for me was: arcpy.Integrate_management("taxlot13 #", "60 Feet") As an aside: Integrate_management is a processing-intensive tool to run. I recommend first bringing your parcel FC into a scratch file geodatabase or maybe the in_memory workspace for better performance. In general I have found that Integrate can you give you some weird, undesirable results. You may encounter this with your parcels. If so, I recommend trying out the answer marked correct on this GIS Stack Exchange thread: arcgis desktop - Algorithm to fill the gaps adjacent to parcels - Geographic Information Systems Stack Exchange It's a little complicated, but unfortunately some GIS data manipulation tasks just don't come with an easy button. Good luck; hope this helps. Micah
... View more
07-07-2017
08:59 AM
|
1
|
0
|
1361
|
|
POST
|
Good idea, Shantonu. If you wanted to carry that one step further you could create a Python Addin Application Extension that buffers the points everytime you save edits: Extension class—Help | ArcGIS Desktop
... View more
06-30-2017
06:57 AM
|
2
|
0
|
1431
|
|
POST
|
Hi Shaning, This would be really easy with arcpy, but from what I can tell this article might help you out with how to use the Intersect tool with ArcObjects geoprocessing: https://www.esri.com/news/arcuser/1207/files/gp_arcobjects.pdf Or, the ITopologicalOperator.Intersect method could be used to determine if there is overlap. Good luck! Micah
... View more
06-29-2017
11:02 AM
|
0
|
6
|
2928
|
|
POST
|
Hi Tiffany, We had similar issues at my workplace yesterday. I think they were related to a service interruption hosted feature services which was reported at status.arcgis.com. It should be up and running as normal today, I hope. Good luck, Micah
... View more
06-28-2017
07:08 AM
|
1
|
0
|
3579
|
|
POST
|
Hello Farhan, I think Gurminder's advice is quite good. If you have access to the Esri Production Mapping extension, it looks like you can use the dynamic table layout element to configure and produce the table according to these guidelines. Once you get the dynamic table set up in your layout, here is some code that may help you get started with producing your maps: import arcpy
# create mxd and data frame objects
mxd = arcpy.mapping.MapDocument("CURRENT")
df = mxd.activeDataFrame
# create a counter that you can use to name your output PDFs
counter = 1
# loop through the cities layer with a search cursor
with arcpy.da.SearchCursor("cities_layer", ("OBJECTID")) as cursor:
for row in cursor:
# select the city
exp = 'OBJECTID = {}'.format(row[0])
arcpy.SelectLayerByAttribute_management("cities_layer", "NEW_SELECTION", exp)
# zoom to the city
df.zoomToSelectedFeatures()
arcpy.RefreshActiveView()
# select the population points within the current city
arcpy.SelectLayerByLocation_management("population_points", "INTERSECT", "NEW_SELECTION", "cities_layer")
# export the map to PDF and increment the counter
arcpy.mapping.ExportToPDF(mxd, "CityPDF_{}".format(str(counter)))
counter += 1 Hope that helps! Good luck. Micah
... View more
06-23-2017
02:48 PM
|
1
|
7
|
3373
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-13-2017 09:58 AM | |
| 1 | 10-27-2017 12:54 PM | |
| 1 | 10-13-2017 04:28 PM | |
| 5 | 08-14-2017 01:58 PM | |
| 1 | 10-16-2017 08:03 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-26-2021
03:16 PM
|