2

Context

I am currently working on the migration from ArcMap 10.3 to ArcGIS Pro. We have several tools that won't work anymore in ArcGIS Pro and I am checking what native solutions could be used before going to a customized development.

One of the tool we currently have generates a html page when clicking on a parcel and queries 5 different layers (all the layers have the same ID or parcel number).

I would like to migrate it in ArcGIS Pro using arcpy and reportlab if possible. I thought about reportlab as the html template is basically a table.

What has been done

I already used the SearchCursor to extract the fields I was interested in and the where_clause to select only rows I wanted. However, I managed to do it within 1 layer at a time.

I checked the forums to see if I could perform spatial queries with arcpy, and I found the MakeQueryLayer, however I do not wish to create a new layer but just extract information related to a parcel number over 5 feature layers and display it in a pdf.

I am trying with MakeQueryTable following ArcGIS Pro help/examples online :

import arcpy
tableList = ["c:\\path\\Projects\\MyProject1\\sde.sde\\A.CAD_Adresses\\A.CAD_ADRESSE", "c:\\path\\Projects\\MyProject\\sde.sde\\A.CAD_Communes\\A.CAD_COMMUNE", "c:\\path\\Projects\\MyProject\\sde.sde\\A.CAD_Immeubles\\A.CAD_BIENS_FONDS"] 
fieldList = [["A.CAD_ADRESSE", 'EGID'], ["A.CAD_COMMUNE", 'TITRE'], ["A.CAD_BIENS_FONDS", 'EGRID'], ["A.CAD_BIENS_FONDS", 'MUTNUM']]
keyField = "A.CAD_BIENS_FONDS.EGRID"
arcpy.MakeQueryTable_management(tableList, keyField, fieldList)

I keep getting a runtime error:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6316, in MakeQueryTable
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 6313, in MakeQueryTable
retval = convertArcObjectToPythonObject(gp.MakeQueryTable_management(*gp_fixargs((in_table, out_table, in_key_field_option, in_key_field, in_field, where_clause), True)))
File "c:\programfiles\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 506, in <lambda> return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Objet : erreur lors de l’exécution de l’outil

I also had to adapt the syntax as I also got errors. I followed this post

For this example I only worked with 3 layers, I have 5 to deal with. But the IDs in common will be the EGID and/or the EGRID number.

gisnside
7,9082 gold badges33 silver badges75 bronze badges
asked Oct 5, 2017 at 8:38
3
  • Ok Thank you for the clarification. I will update the post. Commented Oct 5, 2017 at 10:16
  • i edited your post to make the question easier to read. Is that normal you have a folder named MyProject1 (for adresses) and another named MyProject for similar data ? Please check the location of your data to make sure. Commented Oct 7, 2017 at 4:19
  • @gisnside: I checked and this is normal. This is how the folders have been built. I could change the name of myproject1 but it would not change the MyProject folder that has been created when we installed ArcGIS Pro on our machine. Commented Oct 10, 2017 at 12:00

1 Answer 1

1

It works. There was a syntax error. Instead of writing:

"c:\\path\\Projects\\MyProject1\\sde.sde\\layer"

I was supposed to write:

r'c:\\path\\Projects\\MyProject1\\sde.sde\\layer'

I was wondering if this is typical with ArcGIS Pro because the esri tutorials online do not have this syntax.

answered Oct 10, 2017 at 12:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.