When adding a description to a layer's metadata and publishing as a Map Service to Portal, the rest endpoint shows the HTML tags for the Description and makes it very difficult to read. Is there a way of removing these tags or converting the description field to a simple plain text box? This isn't the case for the summary field.
Otherwise, is there a better way of viewing individual layer metadata for a multi-layer map service other than via the rest endpoint?
Solved! Go to Solution.
We have found an workaround for this issue which is unfortunately time consuming as every layer has to be updated with this method.
The workaround is to select the affected map or layer in the Catalog View and do an Export of the metadata to an xml file. We used the FGDC CSDGM format. Then do an Import for the same affected map / layer with the exported file and republish the service.
After this we could confirm that the issue with the HTML TAG disappeared from the map service.
Here you go:
import arcpy, os
from arcpy import metadata as md
dataset = arcpy.GetParameterAsText(0)
src_item_md = md.Metadata(dataset)
outXML = r'C:\\Temp\Metadata.xml'
src_item_md.exportMetadata(outXML)
# Import the standard-format metadata content to the target item
if not src_item_md.isReadOnly:
src_item_md.importMetadata(outXML)
src_item_md.save()
arcpy.management.Delete(outXML)
arcpy.AddMessage("Finished.")
Hi David,
Could I ask if the behaviour is that the published service details, when viewing the REST API of the service, shows the metadata description as having HTML tags, rather than the text that has been typed into the field in ArcGIS Pro before publishing?
If so, could I also ask if the service was published using ArcGIS Pro or ArcMap? And what version of ArcGIS Enterprise are you using?
There is a known bug for this issue that occurs when publishing service from ArcGIS Pro to ArcGIS Enterprise, and the workaround suggested is to remove the text in the description field before publishing the service, and complete the description from the item details page in ArcGIS Portal.
So the tags are a bug? Any fix in sight? It has broken our Javascript API internal mapping application which builds on the description data a HTML link - so having rogue HTML in the description has just broken things big time.
I note that layers imported from ArcGIS MXD are ok as we only noticed it when we added new ones. I'll be logging an Esri(UK) call so we have visibility of this an know when it is fixed.
I would strongly suggest that this topic isn't marked "Solved" as the work around seems to be geared up for the meta data stored with the layer, not added in the Project.
For info this is Esri BUG-000129415
I've workaround the issue in my code with a very simple js function that strips html out of a string.
@MCameron this is from the layer metadata in Pro, being viewed in the REST on the web.
So in this example, i have a layer in my service with the following metadata:
We want the metadata for our individual layers to persist through to Enterprise, but the only way to view the Description for the individual layers is in the REST (unless someone can correct me otherwise?).
Obviously it's not easy reading the text in the description when it's wrapped in HTML tags. So is there a better way of viewing the metadata on the individual layers? or a way of making the description field plain text (does that remove the html tags?)
We are also encounting this problem and haven't found a way to remove it. It's a problematic issue that is causing a mess in the GetCapabilities info of the hosted service. The Enterprise portal is not involved in this.
<Abstract>
<![CDATA[ <DIV STYLE="text-align:Left;font-size:12pt"><P><SPAN>
The service was hosted from ArcGIS Pro v. 3.0.1 to our ArcGIS Server Site through an ArcGIS Server Connection (.ags).
We have found an workaround for this issue which is unfortunately time consuming as every layer has to be updated with this method.
The workaround is to select the affected map or layer in the Catalog View and do an Export of the metadata to an xml file. We used the FGDC CSDGM format. Then do an Import for the same affected map / layer with the exported file and republish the service.
After this we could confirm that the issue with the HTML TAG disappeared from the map service.
@cbp-geus this is a great workaround, which i've just tried to good effect. Next job is to get this working pythonically to loop through all datasets prior to publishing.
Glad to hear this is also working for you. We are also investigating a way to make this 'pythonically' in some way. Let's hope Esri might have a solution to this.
Here you go:
import arcpy, os
from arcpy import metadata as md
dataset = arcpy.GetParameterAsText(0)
src_item_md = md.Metadata(dataset)
outXML = r'C:\\Temp\Metadata.xml'
src_item_md.exportMetadata(outXML)
# Import the standard-format metadata content to the target item
if not src_item_md.isReadOnly:
src_item_md.importMetadata(outXML)
src_item_md.save()
arcpy.management.Delete(outXML)
arcpy.AddMessage("Finished.")