0

I'm uploading a map from Pro to Online in which most popups have a URL link. All the links are external to our organization, but some of the PDFs have spaces in the URL (bad practice) so while the link works in Pro, it doesn't work in AGOL. This post ArcGIS Online attribute hyperlink is not reading the space in URL, how to fix? asks the same question for internal PDFs, but the two answers don't apply. Answer 1 is a tool for batch fixing URL's, but since the PDFs in my map are not internal files this doesn't work. Answer 2 instructs the user to go to Map Viewer Classic -> Popup -> Popup Media -> Add -> select "link". This option no longer exists in Map Viewer Classicenter image description here

The other option I've found is to create a new field using Arcade How To: Add PDF files as hyperlinks in ArcGIS Online Map Viewer pop-ups but I don't know Arcade and I'm having trouble understanding the instructions. I don't know if it matters, but not all the links are broken and not all of them are PDFs.

URL works PDF URL with spaces

Is there a way to fix this in Map Viewer? Why do the links work in Pro but not AGOL? Do I have to go into my data and get new links?

1 Answer 1

2

Note that there is nothing wrong with having spaces in the names of the files being linked to.

However, the URLs cannot include spaces. If they do, then they are not actually URLs (according to the official definition of a URL/URI). If you need to link to a file with a space (or other prohibited URL character) in its name (or elsewhere in the URL), then each illegal character(s) must be replaced with it's URL-encoding. For a space character, the URL encoding is "%20".

So just replace all occurrences of space characters in all the URLs with: %20

Just to be clear... you do NOT need to change the names of the files. You only need to change the URLs from badly formed URLs with unencoded spaces, into correct URLs with URL-encoded spaces (ie, "%20").

You will find that some browsers, and some applications, will work with the unencoded spaces, because those apps have been explicitly built to internally replace spaces with "%20" encodings as a convenience to the user. It is not technically correct, but it is usually practically correct and very convenient, so it makes it effectively "work" in practice in those apps/broswers.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.