Esri / data-assistant

ArcGIS Pro Add-in that assists in emergency management, local government and state government data aggregation workflows.
Apache License 2.0
23 stars 8 forks source link

Enterprise Geodatabase errors #28

Closed ChrisBuscaglia closed 8 years ago

ChrisBuscaglia commented 8 years ago

Please log results of

EGDB - Hosted Service -- preview and publish fail EGDB - EGDB Feature Service -- preview and publish fail FDGB - EGDB Feature Service -- publish fails SHP - EGDB Feature Service -- publish fails

ChrisBuscaglia commented 8 years ago

@jessnoo

jessnoo commented 8 years ago

eGDB - eGDB Feature Service Results

Environment Details:

FYI @busbus @NikkiGolding

jessnoo commented 8 years ago

FDGB - EGDB Feature Service Results

Environment Details:

FYI @busbus @NikkiGolding

jessnoo commented 8 years ago

EGDB - Hosted Service Results

Environment Details:

jessnoo commented 8 years ago

SHP - eGDB Feature Service Results

Environment Details:

SteveGrise commented 8 years ago

Can someone set me up with some services like that - egdb feature services? I can set it up on my end but it would take me some time. I had assumed those feature services would look like the others for layer properties, but it's not that simple. @ChrisBuscaglia @NikkiGolding

NikkiGolding commented 8 years ago

@jessnoo Please provide external services for @SteveGrise to test with.

jessnoo commented 8 years ago

@SteveGrise We've got a parcel service published for you here: http://50.18.115.76:6080/arcgis/rest/services/DataAgg/ParcelServiceDev/FeatureServer

SteveGrise commented 8 years ago

Updated code to handle spaces in filenames and paths... can't believe that is still a challenge in python on Windows. xmlFile = xmlFile.strip("'") xmlFile = xmlFile.replace("\","/") this seemed to solve the issue on the arcpy parameter.

pLeBlanc93 commented 8 years ago

@SteveGrise The backslash needs to be escaped for valid syntax. Alternatively: os.path.normpath(xmlFile.strip("'"))

Handy if you're using os.path.join("D:/foo/bar", "user", "file.txt") which gives D:/foo/bar\user\file.txt.

Paths in Python are not very fun...

SteveGrise commented 8 years ago

​That works in general, but I have a GP parameter that is a File / ValueTable. I am splitting the string on ';' and using the parts. If I try that general approach, basically: xmlFile = xmlFile.strip("'") xmlFile = os.path.normpath(xmlFile) or just use the string value from files.split(";") and then: xml.dom.minidom.parse(xmlFile) I get errors:

with open(file, 'rb') as fp:

OSError: [Errno 22] Invalid argument: "'C:\Users\Steve\Documents\ArcGIS\Projects\MyProject11\Address From Egdb.xml'"​

I have also done some work to remove the extra quotes and then get a file not found error. It's quite odd.

if I do the following it seems to work reliably: xmlFile = xmlFile.strip("'") xmlFile = xmlFile.replace("\","/") xmlDoc = xml.dom.minidom.parse(xmlFile) # parse from string

It seems to me like the \ with spaces does not work, but if I switch to forward slash it works.

On Tue, Feb 2, 2016 at 2:13 PM, Paul LeBlanc notifications@github.com wrote:

@SteveGrise https://github.com/SteveGrise The backslash needs to be escaped for valid syntax. Alternatively: os.path.normpath(xmlFile.strip("'")) https://docs.python.org/2/library/os.path.html#os.path.normpath

Handy if you're using os.path.join("D:/foo/bar", "user", "file.txt") which gives D:/foo/bar\user\file.txt.

— Reply to this email directly or view it on GitHub https://github.com/Esri/data-aggregation/issues/28#issuecomment-178765232 .

pLeBlanc93 commented 8 years ago

Hmm, that is really odd... I think it might be because .GetParameterAsText() does not return raw strings and when you are splitting it, you are left with non-escaped backslahes. Argh.

I've been working with ValueTable parameters and .GetParameterAsText() and am also seeing strange issues when parsing. This is the best I could come up with to handle paths both with and without spaces in addition to other parameters in a single VT. Doesn't help with the DOM error, but you might find it useful. Using # as most GP scripts accept it similar to None.

    param = arcpy.GetParameter(0)

    argv[0] = [param.getRow(i).replace("''", "'#'").strip("'").split("' '")
                for i in range(param.rowCount)]

Coming from a 2x3 VT:

"C:\_workLaptop\Pro_project\output.gdb C:\_workLaptop\Pro_project\MyProject.gdb #;'C:\_workLaptop\Pro_project\New File Geodatabase.gdb' 'C:\_workLaptop\Pro_project\New File Geodatabase2.gdb' 'sample text'"

becomes

[['C:\\_workLaptop\\Pro_project\\output.gdb', 'C:\\_workLaptop\\Pro_project\\MyProject.gdb', '#'],
 ['C:\\_workLaptop\\Pro_project\\New File Geodatabase.gdb', 'C:\\_workLaptop\\Pro_project\\New File Geodatabase2.gdb', 'sample text']]
SteveGrise commented 8 years ago

Made a number of changes to support Enterprise GDBs as layers. Current plan is to support AGO/Portal services, and ArcGIS Server Services if they are registered as AGO/Portal items. This should allow us to use Pro security and avoid some of the complexity with full ArcGIS Server support.

Testing confirmed that arcpy.GetSigninToken() will continue to return a valid token when the user is logged into ArcGIS Pro.