Issues adding KML file to Map Viewer

3738
18
Jump to solution
03-16-2022 10:14 AM
JD1016
by
Occasional Contributor III

Hello,

I've seen one other posting that was made some time ago regarding this issue but there was no resolution.

I am attempting to add a KML file to a Map Viewer web map and received the following somewhat "cryptic" message "Error...there was an error".  Unfortunately, not particularly helpful on the elaboration front.

However, I was able to successfully load the KML file using Map Viewer Classic but I need Map Viewer's Group Layers functionality.  Of course, I could back track, load everything in Classic, open it again using Map Viewer, and then re-do my groups but I would prefer not to employ that as a consistent work around.

Has anyone experienced this issue and, if so, is there a solution for this problem?

Thank you.

Jeff

0 Kudos
1 Solution

Accepted Solutions
RussRoberts
Esri Notable Contributor

Yup so in the URL is the item id for the KML that you would use in this URL would look like this.

https://jsapi.maps.arcgis.com/sharing/rest/content/items/3e1d02d34bfc440f9a83587ac2a529df/data?f=jso...

View solution in original post

0 Kudos
18 Replies
RussRoberts
Esri Notable Contributor

Can you share the map and KML layer being used? You can pop it into a group and invite russell_jsapi into it and I can check it out.

0 Kudos
JD1016
by
Occasional Contributor III

Unfortunately, I am not able to share this particular information outside our organization.  Apologies. I was hoping someone had experienced something similar and could offer guidance without interacting with our data.

0 Kudos
RussRoberts
Esri Notable Contributor

Are you adding the KML by through an item or through a URL? 

0 Kudos
JD1016
by
Occasional Contributor III

The KML resides in AGO as a hosted layer using "+ New Item".  The layer is located using Search in Map Viewer and when I attempt to add the error is broadcast.

0 Kudos
RussRoberts
Esri Notable Contributor

There is a known limitation in the API when adding through item. You can workaround this by using https://orgid.maps.arcgis.com/sharing/rest/content/items/ITEMID/data?f=json and going through Map Viewer Add > KML and using the above url.

0 Kudos
JD1016
by
Occasional Contributor III

This KML is not "on the web" so it has no URL.  It was a deliverable from a consultant.

0 Kudos
RussRoberts
Esri Notable Contributor

You should have an item id for the KML available bc of the above "The KML resides in AGO as a hosted layer using "+ New Item"."

0 Kudos
JD1016
by
Occasional Contributor III

Where do I obtain this URL?  I have a URL corresponding to the Overview page associated with the KML but it does not contain all the same elements you indicated prior.  It hints at an "item.html?id=" but nothing before that is the same as the file path you mentioned.  Or are you saying use the URL you provided explicitly...substituting our "orgid" and "ITEMID" indicated in the Overview?

0 Kudos
JD1016
by
Occasional Contributor III

Okay...so my nomenclature is a bit off.  It's NOT a hosted layer...per say...it was brought in as a KML.  It's description is KML...not Feature Layer(hosted).  Sorry for the confusion.

0 Kudos