POST
|
Thanks Robert ! I guess I will have to dive in the javascript learning
... View more
09-18-2019
10:56 AM
|
0
|
0
|
455
|
POST
|
Hi, I would like to modify the Identify widget result popup windows from Robert Scheitlin. I don't have experience with javascript but have some in python and html/css, would it be very complicated to get to this example and sort the result with descending date ? In brief : Remove the layer name Place first and second attribute on the same line Sort the result order with date Thanks a lot for you help
... View more
09-18-2019
08:05 AM
|
0
|
2
|
560
|
POST
|
I'm not using any ArcGIS Server for the moment so I guess, the only option is to disable it for now. Thanks for your answer
... View more
12-08-2015
07:34 AM
|
0
|
2
|
725
|
POST
|
This tool is good too but you need to have ArcGIS Advanced to use this tool.
... View more
12-08-2015
07:23 AM
|
1
|
0
|
2590
|
POST
|
You can also create a new string column (Concat) and concatenate all the attributes that you want to identify as duplicate. You have to be sure that your data are standardize. After that, order you new column (Concat) by ascending order. Create a new integer column (Duplicates) and use this script as field calculator Be sure that the parser is Python and the "Show codeblock" is checked uniqueList = [] def isDuplicate(inValue): if inValue in uniqueList: return 1 else: uniqueList.append(inValue) return 0 Under "Duplicates =" isDuplicate(!Concat!) the (!Concat!) is representing the field you want to identify the duplicates 38700 - Identify duplicate field values After that with editor you gonna be able to delete all the duplicates values. It's always a good thing to create a copy of the shapefile, feature class, etc... before doind this.
... View more
12-08-2015
07:14 AM
|
2
|
0
|
2590
|
POST
|
Hi, I'm trying to clear the text background color of the splash windows and even if I put white, I still have problem with it. Does anyone else have this problem and solved it ? Thanks you
... View more
12-08-2015
06:52 AM
|
0
|
5
|
3750
|
POST
|
It's work perfectly with the replace Thanks you for all you answer
... View more
06-02-2015
10:03 AM
|
0
|
0
|
1921
|
POST
|
Thanks for you answer Dan, I found the reason why my script doesn't work, it's because Arcgis double my apostrophe in the attribute. So i'm parsing this string to definition query in my script. "Arrondisse"='Baie-d'Urfé' and when I open the attributes tables my table is empty. When i'm doing an selection by attribute and I double the apostrophe, it's works. "Arrondisse" = 'Baie-d''Urfé' but I can't figured out how to write it and make it works in my script. if lyr.name == "Ecoles":
lyr.definitionQuery = '"Arrondisse"' + "=" + "'" + arrondissement + "'"
if lyr.definitionQuery == """"Arrondisse"=u'Baie-d'Urfé'""":
lyr.defintionQuery = """"Arrondisse"=u'Baie-d''Urfé'""" UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal if lyr.definitionQuery == """"Arrondisse"=u'Baie-d'Urfé'""": Thanks
... View more
06-02-2015
08:31 AM
|
0
|
3
|
1921
|
POST
|
Hi, I'm trying to create an sql expression with a variable "arrondissement" but there's a problem with some attributes that contain apostrophe (quote) in their names like : Baie d'Urfé or L'île-Bizard-Sainte-Geneviève. I've try a few things but i'm always getting an error due to the apostrophe. It's work fine with other names that doesn't have quote. lyr.definitionQuery = '"Arrondisse"' + "=" + "'" + arrondissement + "'"
or
lyr.definitionQuery = '"Arrondisse"' + "=" + "'\"%s\"'" %(arrondissement) Thanks you for your help
... View more
05-29-2015
11:59 AM
|
0
|
6
|
5681
|
POST
|
Hi, I created an add in with 2 combo boxes and I would like to add a reset button to my toolbar. So the toolbar will be the same as when I open Arc Map. I found this code on stackexchange and i'm trying to adapt it but i'm still got errors. class ButtonReset(object):
"""Implementation for TestAddin_addin.reset (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
#Déclaration du mxd
self.mxd = arcpy.mapping.MapDocument('current')
layer = arcpy.mapping.ListLayers(self.mxd, "",df)[0]
#Reinitialiser tous les couches de leur sélection
arcpy.SelectLayerByAttribute_management(layer,"CLEAR_SELECTION")
self.resetTool(combobox1, "")
combobox1.enabled = False
self.resetTool(combobox2, "")
combobox2.enabled = False
arcpy.RefreshActiveView()
def refresh(self):
pass
Also I put the function below as proposed under the module declaration but not sure if it's the right place to put it. import arcpy
from arcpy import env
import pythonaddins
def resetTool(toolID, defaultValue):
toolID.value = defaultValue
Here the error I get when trying to run my reset button : \TestAddin_addin.py", line 438, in onClick
self.resetTool(combobox1, "")
AttributeError: 'ButtonReset' object has no attribute 'resetTool' Thanks for your help
... View more
05-12-2015
08:01 AM
|
0
|
0
|
2749
|
POST
|
Hi Ben !! I'm always having this error displaying in the python windows on the first line when I loaded my toolbar but I'm able to execute my function anyways. Good luck
... View more
03-09-2015
07:06 AM
|
0
|
1
|
862
|
POST
|
Hi Jake, That was a good point for the feature layer but I still have the same error even after the modification. Thanks you
... View more
02-12-2015
08:10 AM
|
0
|
0
|
862
|
POST
|
Hi, When I try to install the toolbar with the Combo box, I have this error : File "<string>", line 1 SyntaxError: can't assign to operator Usually i'm able to resolve the syntax error but I have no clue for this one. Here my code : import arcpy
import pythonaddins
class LayersComboBoxClass(object):
"""Implementation for Python_Add-In_addin.combo_box (ComboBox)"""
def __init__(self):
self.items = []
self.editable = False
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWWWWWWWWWWWWWWWW'
def onSelChange(self, selection):
layer = r"S:\Geomatique\Pierre-Luc\SPVM\Corridors_Scolaire\Carto.gdb\Ecoles"
arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", "DESC_LIEU = '" + selection + "'")
arcpy.RefreshActiveView()
def onEditChange(self, text):
pass
def onFocus(self, focused):
self.mxd = arcpy.mapping.MapDocument('current')
layer = arcpy.mapping.ListLayers(self.mxd, "Ecoles")[0]
#self.items = []
values = [row[0] for row in arcpy.da.SearchCursor(layer, ["DESC_LIEU"])]
for uniqueVal in sorted(set(values)):
self.items.append(uniqueVal)
def onEnter(self):
pass
def refresh(self):
pass Thanks for your help
... View more
02-12-2015
06:32 AM
|
0
|
6
|
4851
|
POST
|
Hi thank for all your answers !! It was kind of my first python script so i'm open to fix it to optimize my code. James is right i'm using cx_Oracle for my connection. Here what my sql query look likes
SELECT * FROM INTERVENTIONS_GEO_UNITES WHERE TYPE_INT <> '1ERREP' and DATE_INTER BETWEEN TO_DATE('01/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS') AND TO_DATE('12/31/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS') and ARRONDISSEMENT_VILLE in ('Côte-des-Neiges--Notre-Dame-de-Grâce','Plateau-Mont-Royal','Outremont')
or if it with rdc here my query pratically the same except they add a suffix RDC at the view name.
SELECT * FROM INTERVENTIONS_GEO_UNITES_RDC WHERE TYPE_INT <> '1ERREP' and DATE_INTER BETWEEN TO_DATE('01/01/2011 00:00:00', 'MM/DD/YYYY HH24:MI:SS') AND TO_DATE('12/31/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS') and ARRONDISSEMENT_VILLE in ('Côte-des-Neiges--Notre-Dame-de-Grâce','Plateau-Mont-Royal','Outremont')
What I don't understand is that i can execute the script without any problems when I don't have the condition True or False with this code
sql = "SELECT * FROM INTERVENTIONS_GEO_UNITES WHERE " + arg1
cursor.execute(sql)
rows = cursor.fetchall()
I'll try the differents options that you guys gave me and come back for the feedback of my tests Thanks you
... View more
11-20-2014
06:23 AM
|
0
|
1
|
700
|
POST
|
Hi, I have to execute a sql query from an oracle table but the problem is that according to a new argument that is true, I have to make a connection to another table. My original script that i've been using for 2 years works like a charm so I just add an if statement in the connection variable but when comes the time to populate my temp table I got this error : I tried to put rows = cursor.fetchall() in my if statement and it doesn't work either. The line 75 refer to the line in red
if rdc == True:
sql = "SELECT * FROM INTERVENTIONS_GEO_UNITES_RDC" + arg1
cursor.execute(sql)
else:
sql = "SELECT * FROM INTERVENTIONS_GEO_UNITES WHERE " + arg1
cursor.execute(sql)
rows = cursor.fetchall()
avec_rdc = (row for row in rows if rdc == True)
sans_rdc = (row for row in rows if rdc == False)
for row in avec_rdc:
trow = iCur.newRow()
trow.INCIDENT_N = row[0]
trow.DATE_INTER = row[2]
trow.ADRESSE_IN = row[3]
trow.TYPE_INT = row[4]
trow.CAS_NO = row[5]
trow.REGION = row[6]
trow.CATEGORIE = row[7]
trow.SITE_KEY = row[8]
trow.ARRONDISSE = row[9]
trow.LISTE_UNIT = row[11]
trow.LONGITUDE = row[12]
trow.LATITUDE = row[13]
for row in sans_rdc:
trow = iCur.newRow()
trow.INCIDENT_N = row[0]
trow.DATE_INTER = row[1]
trow.ADRESSE_IN = row[2]
trow.TYPE_INT = row[3]
trow.CAS_NO = row[4]
trow.REGION = row[5]
trow.CATEGORIE = row[6]
trow.SITE_KEY = row[7]
trow.ARRONDISSE = row[8]
trow.LISTE_UNIT = row[9]
trow.LONGITUDE = row[10]
trow.LATITUDE = row[11]
iCur.insertRow(trow)
thanks for your help
... View more
11-19-2014
08:05 AM
|
0
|
7
|
2543
|
Title | Kudos | Posted |
---|---|---|
1 | 12-08-2015 07:23 AM | |
2 | 12-08-2015 07:14 AM |
Online Status |
Offline
|
Date Last Visited |
05-27-2021
09:20 AM
|