Can ArcGIS Pro Layer (.lyrx) names have spaces in them?
I ask because when attempting to save 'layer file spaces.lyrx' I receive the 'Invalid Path' error. Replace this with 'layer_file_spaces.lyrx' and it saves without a problem.
Anyone else experienced this issue?
Regards,
Danny.
(ArcGIS Pro 1.4.1)
I would you say that you should not put spaces in the file names. Here is some documented error messages that support that idea:
080020: Invalid output path.—Help | ArcGIS Desktop
001255: Input file name has spaces.—Help | ArcGIS Desktop
001256: Output file name has spaces.—Help | ArcGIS Desktop
Thanks for the links George, I rarely put spaces in, but sometimes, client working practices aren't always as geared to the particular idiosyncrasies of the GIS data management world. They simply want / expect an application to be able to save a named file with a space in it. Removing white space should be a matter of choice, not one enforced by the software. The error message could at least offer a little more detail i.e. the path is fine, the filename is the problem.
I would open a case with Esri Technical Support and have them review the behavior to be certain. I can understand the matter of choice, but also agree it is not best practice.
Will the mention be enough to register that with https://community.esri.com/groups/technical-support?sr=search&searchId=ef95d1a9-3c0b-4113-b051-8be664d6e364&searchIndex=8, or do I need to post it again somewhere specific? Thanks!
My Esri UK response:
"Just wanted to let you know that your reporting of the issue about not being able to save layer files with blanks in the name, has been recognised by Esri Inc. as defect ENH-000104769, and will be evaluated further by the development team.The enhancement covers both, documenting better the limitation in the help pages, and also adding a more clear and meaningful error message, in place of the current "invalid path" message. Unfortunately, the limitation is there to stay. So to answer your query, no, blanks are not supported, currently, for layer files in ArcGIS Pro. I know this is a discrepancy with ArcMap, but that is how it has been designed in Pro."
At a Pro discussion panel at the UC with 8 of the senior product architects taking questions. They were asked when spaces would be supported in lyrx file names and it was the only question none could answer. The chief architect just said 'I'm surprised they're not already'!
Said they'd get back to me...
One of the purposes of the layer files it to make the feature class file look legible from say their geodatabase naming convention. Having to _ these does not add to the clarity i.e. 'Waste Pipe Pressure Tests' or 'Waste_Pipe_Pressure_Tests'
P.S. see my earlier point: I rarely put spaces in (prefer underscores), but sometimes, client working practices aren't always as geared to the particular idiosyncrasies of the GIS data management world. They simply want / expect an application to be able to save a named file with a space in it. Removing white space should be a matter of choice, not one enforced by the software
I have no trouble saving Pro's *.lyrx files with spaces on my local drives, and re-loading them back into Pro using the catalog window. I do this all the time. This is all on a Windows 10 system...
Are you really sure this isn't some network drive related issue, I see you are saving to some non-local network drives in the screenshot? If these are unix or linux drives, I am wondering if the problem hasn't to do with some configuration issue related to that, and if the linux drives and the software making them available in your Windows, are actually the culprit and causing the limitation of not being able to save with spaces.
E.g., a discussion thread like this one may be an interesting read:
Is space not allowed in a filename? - Unix & Linux Stack Exchange
Hi Marco, I'm not sure what to say, both Esri UK and Esri Inc have tested this and accepted it as a defect, including some of the system architects at the UC.
I have tested this again writing to the C:\ drive and avoiding network drives as you suggest. Please could you provide some screen shots or a video of the steps you take to overcome this problem please?
My steps = right click feature class > Save As Layer File > select a location (network or local) > Save the .LYRX as a filename with spaces i.e. "file name with spaces" = invalid path error, "file_name_without_spaces" = saves the .LYRX as expected.
This was the response from Esri "Unfortunately, the limitation is there to stay. So to answer your query, no, blanks are not supported, currently, for layer files in ArcGIS Pro. I know this is a discrepancy with ArcMap, but that is how it has been designed in Pro."It would be great to know how you do this.
P.S. the original test was with ArcGIS Pro 1.4.1, today's test was with ArcGIS Pro 2.0.0 and the result was the same.
Hmmm.... I have to admit something now: I can reproduce your issue! It staggeringly fails from within the Pro interface with the error message you show. ;-() This is one h*l of a bug.
What were my remarks based on, you are asking? Well, I have been debugging an arcpy based application that needs to run in both ArcMap and Pro. That application routinely saves layer files with spaces in the filename through arcpy, using the following statement:
*** This works in Pro for saving layer files with spaces! ***
inputLayer.saveACopy(newLyrFilename)
I have never seen this command fail, and have run it in batch on hundreds of layer files... I can save and load layer files with spaces fine through arcpy using this and other arcpy statements. Loading a layer file with spaces manually from the catalog window by drag-and-drop is also no problem, I have done that dozens of times in Pro.
For some reason though, I just didn't save them from within Pro manually, as my main focus for the development of the layer files has been ArcMap, and I simply upgrade them to Pro using the above shown command in an automated fashion. That is why I totally missed this issue, despite regularly having tested stuff in Pro!
Likewise you can save them as 'CamelCase' and retrospectively add the spaces back in, or with 'Under_scores' and then replace them with spaces (in ArcCatalog or Windows Explorer) - these can then be brought back into ArcGIS Pro, but that isn't really a solution to a very simple requirement which represents quite an oversight on Esri's part.
Well, certainly, even if this was "as designed", as you were told through at least one of your contacts, then the fact that I can save them with spaces through arcpy, and that we can load manually edited layer files with spaces from the catalog window, would represent a serious discrepancy as well to this "as designed" feature.
I actually think that from a programming perspective, this may be a relatively minor issue. Many parts of Pro seem to already accept the layer files with spaces, it may just be that save routine behind the Save As Layer File menu option that is in error.
This will also allow spaces to be saved (courtesy of colleague Ben Holmes):
p = arcpy.mp.ArcGISProject("CURRENT")
m = p.listMaps("Map")[0]
for lyr in m.listLayers():
if "SampleText" in lyr.name:
print(lyr)
lyr.saveACopy(r"C:\temp\Layer has Spaces.lyrx")
Change “Map” to the name of your map and “SampleText” to some text contained in the feature class name, as seen in the map.
Again, a work around to a relatively simple 'missing' function.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.