POST
|
Hello and thanks for looking at my question. I am taking historical aerials and creating a map layer. The aerials are 100 foot, 200 foot and 400 foot scale. As none of the scales cover the total area I am working on I have created a Raster dataset for each scale of the aerials. There is over lap at the edges and there are 100 foot scale aerials that may lay on top of a 400 foot scale if there is more detail in just a portion of the 400 foot scale aerial. So I have 3 raster datasets, one for each scale, now I want to mosaic them all together to have full coverage of the area I am working on. That is easily done, but... the 400 layer is always the top raster layer so it covers the more detailed layers if there is overlap. I have tried adding the rasters in different orders and I have tried setting the properties on the mosaic dataset for either ascending or descending, and/or setting the default mosaic operator to first or last to set the overlap based on the input order of the source data when adding rasters. I still get the same result. So, any ideas on what may not be set right on the mosaic dataset, or how I am constructing the rasters that could cause this. Dale, .
... View more
08-22-2019
08:10 AM
|
0
|
0
|
319
|
POST
|
Thanks for the replies, as Tkinter does not work well with ArcMap, what advice-direction can you give me as how to develop a menu in Python for use in ArcMap, basically where to start at again.
... View more
05-13-2019
09:00 AM
|
0
|
0
|
5967
|
POST
|
Continuing on in learning Python as I go I am at the next issue. I have created a Python toolbar add-in with a button for use in ArcMap. Start up ArcMap, toolbar is there, select button and a menu I created in Python is displayed. It contains radiobuttons and comboboxes. On the reset button I want to clear the radiobuttons, clear the selected item from the combobox so it is not selected-blue, and set the combobox back to the first item in the list. When I run the script from PyScripter the menu appears and I can clear and reset everything so the menu looks like it just loaded. When I start ArcMap the Python toolbar appears, select the button, menu appears, select a radiobutton, select an item from a combobox, that all works. When I select the reset button I get the following error whether it is a radiobutton or a combobox: I have the python window open in ArcMap so I can see what is happening. Exception in Tkinter callback Traceback (most recent call last): File "C:\Python27\ArcGIS10.5\Lib\lib-tk\Tkinter.py", line 1542, in __call__ return self.func(*args) File "D:\Applications\Python\Layers.py", line 63, in reset RB1.selection_clear = var.set(0) NameError: global name 'RB1' is not defined This is beyond my knowledge at this point, I did try to set a global variable with no change to the error message. These are my import statements for the script: from tkinter import * from tkinter import ttk import tkFont import arcpy from arcpy import env import sqlite3 import pythonaddins I am not putting in all the code, for now it is all radiobuttons and comboboxes, very repetitive. This is the code I have concerning 'RB1': def reset(): RB1.selection_clear = var.set(0) RB1 = Radiobutton(root, text="Single Map",padx = 5, variable=var, value=1, font="Arial 9") #, state=NORMAL).place(x=10,y=60) RB1.pack() RB1.place(x=10,y=60) RB1.config(state=NORMAL) Button(root, text='Reset',width=20,bg='brown',fg='white', font="Arial 8 bold", command=reset).place(x=39,y=237) As this is my first Python script ever, and for use within ArcMap, I am sure there are a few things I am missing. Thank you for looking at my question.
... View more
05-10-2019
01:58 PM
|
0
|
4
|
8739
|
POST
|
Well, fixed this, I put root.destroy in the command on the Button and it closes the menu box when being ran from ArcMap. Button(root, text='Close',width=20,bg='brown',fg='white', font="Arial 8 bold", command=root.destroy).place(x=39,y=272)
... View more
05-10-2019
09:49 AM
|
0
|
0
|
414
|
POST
|
Thanks for looking at my question. I have a Python toolbar with a button that runs a Python script that displays a menu box. This is being ran through ArcMap. I open my mxd, display the menu, now I want to close it when I am finished and that is the problem. I am calling: def quit(): root.destroy() to close the menu from a button command. When I run the script in pyscripter and display the menu box and hit the close button it works. When I have the menu box open in ArcMap and hit the close button I get the following error: Traceback (most recent call last): File "C:\Python27\ArcGIS10.5\Lib\lib-tk\Tkinter.py", line 1542, in __call__ return self.func(*args) File "D:\Applications\Python\Layers.py", line 49, in quit root.destroy() NameError: global name 'root' is not defined The next issue I see is how to close the Python box when I close ArcMap. Thanks for looking at my question.
... View more
05-10-2019
08:42 AM
|
0
|
1
|
489
|
POST
|
In the end: execfile("D:\Applications\Python\Open_Menu.py") is what it took to open the menu. import arcpy import pythonaddins class btnOpenMenu(object): def __init__(self): self.enabled = True self.checked = False def onClick(self): pythonaddins.MessageBox("Open Menu", "Layer Menu", 0) execfile('D:\Applications\Python\Open Menu.py')
... View more
05-09-2019
12:42 PM
|
0
|
0
|
1764
|
POST
|
And if I close the command window the menu closes......
... View more
05-09-2019
11:55 AM
|
0
|
0
|
1764
|
POST
|
Well, making progress, it now works, sorta. Changed os.system to os.startfile('D:\Applications\Python\Open_Menu.py') Now I get the cmd window (blank) with the heading: C:Python27\ArcGIS10.5\python.exe opening. The cmd window opens right up, then about 5-10 seconds later my menu is displayed. So now both are open, so now I need to get the cmd window from opening.
... View more
05-09-2019
11:30 AM
|
0
|
0
|
1764
|
POST
|
Thanks for looking at my question. I learning Python as I go and have made some headway, so here is what I have now ran into. I have a Python script that creates a menu, I can run it from PyScripter and it all works. I have created a toolbar using the Python Add-In Wizard that contains a button that will be used to load/run/execute/display the menu. What I want is to click the button, menu appears, then I work with the selections on the menu to work with the layers. When I start ArcMap the toolbar is displayed with the button. When I click the button I get a messagebox that I programmed in to make sure it works, one I clear the messagebox I get a quick flash on the screen that I cannot make out, and that is it. This is the code for the button on the toolbar. import arcpy import pythonaddins import os class btnOpenMenu(object): def __init__(self): self.enabled = True self.checked = False def onClick(self): pythonaddins.MessageBox("Open Menu", "Layer Menu", 0) os.system('D:\Applications\Python\Open Menu.py') I also tried: os.system(r'D:\Applications\Python\Open Menu.py') which did not work. Thanks for your help.
... View more
05-09-2019
10:13 AM
|
0
|
3
|
2582
|
POST
|
Well, that was a long trip from here to there.... The 'u' signifies unicode, learned that.... So in the spirit of just keep digging I came across where I need to return the ascii version of the string. Added: [0].encode("utf-8") to the append statement. Was: list1.append(row) Now: list1.append(row[0].encode("utf-8")) So: for row in cursor: list1.append(row[0].encode("utf-8")) I now have the format of 01-01-01 in my combo box instead of (u'01-01-01',). I hope this helps someone else out.
... View more
05-07-2019
01:42 PM
|
0
|
0
|
1320
|
POST
|
Okay, the problem is not a combo box problem, but how the data is retrieved. When I loop through the cursor (for row in cursor) and do print row each record is formatted the same, number is different: (u'01-01-01',) So I need to figure out how remove the: ( u ' , ) from the number. It is a text field, but I have not been able to strip it as it loops through the cursor and appends it to the list.
... View more
05-07-2019
01:19 PM
|
0
|
0
|
1320
|
POST
|
Well, I found something just by trying different things. If I do the following I get the map number in the format I want, 01-01-01, but only 1 map number, not all the map numbers. The following is my code: from tkinter import ttk cursor = arcpy.da.SearchCursor("R:\Projects\MAP_Projects.gdb\MAP_INDEX","Map_No") list1 = [] for row in cursor: comboMapBox['values'] = row comboMapBox = ttk.Combobox(root, width=15) comboMapBox.grid(column=0, row=1) comboMapBox.current(0) comboMapBox.place(x=125,y=60) I know I am only setting the value to the last read value, so????
... View more
05-07-2019
12:41 PM
|
0
|
0
|
1320
|
POST
|
Thanks for the reply, though I still got the same result. I did more searching on the internet in relation to removing the brackets and quotation marks though the results are more applicable to removing characters from a string, not from a combo box. So still searching, you think it would be a simple process.
... View more
05-07-2019
12:23 PM
|
0
|
1
|
1320
|
POST
|
Thanks for looking at my question. This is my first time working with Python so I am on the learning curve. I am creating a menu and I am populating a combo box from a field in a feature class in a file geodatabase. It works thought the data retrieved needs cleaned up, I have tried a few different way to retrieve the data and I get the same results. I want to populate the combo box with map numbers, which I do get.... I want to see the map numbers looking like 01-01-01, etc. I get [[(u'01-01-01',),. I realize the [[ brackets are because I am putting the data is a list. Not sure on the rest of it. The following is my code: from tkinter import ttk cursor = arcpy.da.SearchCursor("R:\Projects\MAP_Projects.gdb\MAP_INDEX","Map_No") list1 = [] for row in cursor: list1.append(row) list1.sort() comboMapBox = ttk.Combobox(root, width=15, values = [list1]) comboMapBox.grid(column=0, row=1) comboMapBox.current(0) comboMapBox.place(x=125,y=60) Thank you for taking a look, I am pleased I at least have it working....somewhat. I am just not sure what I am missing, or have not found yet in my searching of the internet. Dale,
... View more
05-07-2019
10:02 AM
|
0
|
5
|
1483
|
POST
|
Thank you very much John, I put the .tif files that I wanted to add in a new folder and then selected that folder as the Input Data and now I have a Mosaic Dataset. I am putting together some old aerial photos and it joined/merged/stitched them very well. Thank you for the help, it is greatly appreciated. Dale,
... View more
04-04-2019
11:18 AM
|
1
|
0
|
1760
|
Title | Kudos | Posted |
---|---|---|
1 | 05-17-2018 09:39 AM | |
1 | 04-04-2019 11:18 AM | |
1 | 04-21-2016 07:15 AM | |
4 | 04-25-2016 09:48 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|