Hyperlinks to local docs – ArcMap and Google Earth
As you should know google earth pro is now free. Yesterday, I set up a kml with hyperlinks to local pdf’s via a relative link.
I can’t show what I was working on but I’ve recreated it with some public data.
In arcmap, I have 4 USGS quad boundaries.
I also have the corresponding quad pdfs saved within my project folder in a folder named pdf.
My goal is to have a kml of the boundaries of these quads, each with a popup containing a hyperlink that will open the correct pdf.
In arcmap, I hide all the fields except the quad name – well, I usually keep the FID and shape field on as well because I’ve seen some strange behaviour when turning these fields off.
Now add a new string field named “Hyperlink” 250 characters long.
Right-click the hyperlink field heading and choose calculate field. Now create html hyperlinks to the pdf’s stored in my project folder. The string in the hyperlink field needs to be formatted similar to:
<a href=’pdf\quad_name.pdf’>Text shown in link</a>
The “QUAD_NAME” field can be substituted for both the href and hyperlink text portion of this string.
Change the parser to python.
Now enter the following expression:
“<a href=’pdf\\”+!QUAD_NAME!.replace(” “, “_”)+”.pdf’>”+!QUAD_NAME!+”</a>”
Note that I’ve used single quotes around the path. Also note the double backslashes and the syntax to replace spaces in the existing QUAD_NAME attribute with underscores, to match the pdf filenaming, and add the .pdf extension. Between the opening and closing <a> tag is the attribute from the QUAD_NAME field, this is what will be displayed as the text of the hyperlink.
The hyperlink field should look like this now. This is a realative link, the hyperlink will look for the pdf within the pdf folder “pdf\Clayton.pdf” in the same location as the kml file. In other words the final kml containing these hyperlinks should be in the same folder as the folder named “pdf” which contains the document that will be opend via the hyperlink.
The Hyperlink attribute now reflects a valid html hyperlink.
<a href=’pdf\Clayton.pdf’>Clayton</a>
This link can be an absolute path as well, or a url, just replace the path within the single quotes with an absolute path (pro tip – this can be a network location) or valid url.
<a href=’pdf\Clayton.pdf’>Clayton</a>
<a href=’R:\GIS\USGS\pdf\Clayton.pdf’>Clayton</a>
<a href=’http://www.bgcarto.com’>BG Carto</a>
Now use the layer to kml tool in arcmap to export the layer with hyperlinks to a kmz. The tool is called layer to kml, but it only exports kmz, go figure.
This can go in a temporary location, because with the relative link in the hyperlink the output kmz must be opened and saved as kml in the same location as the pdf folder. Even if the output kmz was saved to the same directory as the pdf folder at this point, the hyperlinks would not work. They are relative as will be looking inside the compressed .kmz (which very basically is a folder).
Now open the kmz in google earth. The license key for google earth pro is GEPFREE if you don’t already have it, go get it.
If you click one of the features to open the pop up window, note that the hyperlink does not work.
In the google earth (GE) menu bar go Tools>Options. In the general tab, check “Show web results in external browser” under display and check “Allow access to local files and personal data” in Placemark balloons. The second preference is what will allow us to open the corresponding quad pdfs. When you check the second box a warning will appear, press enable. Then hit ok.
Now right click the layer in the GE table of contents and choose Save place as.
Now navigate to the directory containing the pdf folder (with the quad pdfs inside) and change the file type to .kml (very important).
Close google earth and navigate to the kml saved in the last step. Open and test the hyperlink.
The hyperlinks in the info windows should now open the corresponding pdf for each index feature.
Keep in mind that relative links that contain spaces can be problematic and that the relative link style will not work with the raw kmz output from arcmap, at least not for this workflow. If you are creating this for internal purposes and everyone has access to a common location, it’s probably best to use absolute paths.
I needed to do this because my client is not GIS savvy and prefers to see spatial data in google earth. I have a workflow that includes many grouped layers in a master mxd. These group layers are translated to .lyr files programatically and those .lyr’s are in turn saved as kmz, then manually the kmz’s are simulateously opened and saved together as a kml. With the proper formatting in the attribute tables of the GIS data, the hyperlinks carry over into the final product and allow my client to see the boundaries of certain maps and data and open the corresponding maps very quickly.
19 Comments
Camilo
September 30, 2015Thanks for your help. There is a lot of things to improve about data transfert between ArcGIS and Google Earth. Many clients are asking for more spatial data in GE right now.
Jill
December 1, 2015This didn’t work for me. I tried using an absolute path on my C:\
Jill
December 1, 2015This is an example of one of my hyperlinks:
Brushyravine
Brian
December 1, 2015Hi Jill, If the hyperlink you’re using is ‘\FoodCrew2015\GroveForm_20151116_35.pdf’ the kml should be in the same directory that contains the FoodCrew2015 directory. It won’t work if the kml is in the FoodCrew2015 dir. I can check it out if you zip it up and send it my way.
Brian
December 1, 2015also, might want to remove the rel=”nofollow” parameter
Kat S.
June 30, 2016One step further: How can I add scripting that opens the .pdf to a specific page?
Brian
July 8, 2016Add this to the end of the hyperlink inside the href parameter, include the # then the page=X no spaces.
href=”pdf\mapname.pdf#page=4″
*didn’t test this but I’ve used this syntax in hyperlinks on a webpage.
see https://helpx.adobe.com/acrobat/kb/link-html-pdf-page-acrobat.html
Kat S.
June 30, 2016One more thing:
This:
?/A Page=5=OpenActions
does not work 🙁
Aaron
March 24, 2017Did you ever figure out how to add scripting that opens the .pdf to a specific page of a document?
Aaron
March 27, 2017The #page=x & as Kat explained ?/A Page=5=OpenActions doesn’t work either.
Brian
March 27, 2017add #page=3 to the url, see link below
http://www.bgcarto.com/download/Binder%20Spines.pdf#page=3
in my experience GE is a little finicky about syntax that is valid elsewhere
Chelsie
March 30, 2018I use the City of Portland ESRI Extension/ArcScript. It is way easier and more configurable.
https://www.arcgis.com/home/item.html?id=e8e62bf409ae4bc997632c654382de04
Carto Python | New Share
December 20, 2018[…] Hyperlinks to local docs – ArcMap and Google Earth […]
Daniel Lissick
March 26, 2019I have used this process before and it worked great Recently I was upgraded to Microsoft 10 now the link does not work. Has anyone else had this issue?
David
June 3, 2021I have been attempting to add a local link to my balloon with intermediate results.
If I add the image, it works fine :
If I used an href to create aa link
<a href=Stamp
I know I’m missing something obvious, any thoughts would be appreciated.
maxbetasia
August 17, 2021Everything is very open with a precise description of the issues.
It was really informative. Your site is very useful.
Thanks for sharing!
Edwardo
April 13, 2022Are you currently a lover of online slot wagering
games? This game has existed for hundreds of
years but remains one of the favourite games in Usernesia even in luxury gambling places like Las Vegas or Macau, slots are always neatly arranged waiting for followers to be able to levers and win jackpots that reach billions of rupiah..
But , performed you know if this game was at first considered a
flop game? Indeed, at the beginning of this game created by the creator named Charles August Fey in 1894 in the United States, this machine was intended being an programmed poker game machine that could be moved using coins.
After seeking to build his idea into actuality,
Fey finally gave up and considered his discovery a failure.
But who would have thought that all this machine turned out there to be one of the most
widely used online games in the world. Not only in slot gambling games provided by gambling houses
but also the concept employed by various games
as a “bonus game”.
This is where the game relating to the RNG or Randomly Number Generator was initiated, where the machine will
designate random values that will determine what you will get at each round of the overall game.
Not only slots but in addition online games like virtual sports or bonus games like
gacha also use this kind of concept.
Eugenia
April 23, 2022This site was… how do you say it? Relevant!! Finally I have found
something which helped me. Cheers!
userbola.com
May 6, 2022Userbola Agent Sportsbook Trusted
The football gambling game is very popular in Indonesia. Besides to be able to play sports betting, you can also play Casino, and slots.
Userbola as an official and trusted Indonesian gambling website and bookmaker provides
fast and free list services.
We all provide the best service that you can be able to play gambling easily without
having to get applications, for sbobet the
basketball can be accessed via sbobet mobile or wap, while sbobet
casino is equipped with HTML5 features.
And we also provide customer support services, if you have trouble logging
in or don’t have the latest sbobet link or alternative, you can contact us via live chat, WhatsApp, We Chat, and Range.
Game Userbola Online Gambling
The userbola site also offers ibcbet / maxbet ball gambling games, joker slots gaming gambling, live casino, s128 and sv338 cockfighting, fielding
balls (tangkasnet, tangkas88, tangkas1).
For anybody who like various online gambling games, the userbola site is he best option for you for you Indonesian online gambling players.
The maxbet program can play ball wagering, live casino at redbet allbet,
keno, and amount games. Also there are slots and seafood
capturing games that are very famous from joker video gaming.
If you love bets fighting, you can bet and watch live stream through the SV128 or
SV338 providers.
Userbola Internet gambling Site
Userbola is an online wagering site that has an official license
from PAGCOR, so you don’t have to hesitate
to create a finance transaction and use our site, and your data will be safe.
Userbola as a trusted gambling site, we pay your earn no matter how fast you play betting in just 3 minutes for the process of withdrawing money, and for
the process of depositing cash for around one minute.
Userbola provides purchase services from 9 financial institutions namely Lender
BCA, BNI, BRI, Mandiri, CIMB Niaga, Danamon, Panin, OCBC NISP.
You can also get alternative transaction services such
as OVO, Dana. Register now and get the satisfaction and convenience of playing gambling
on the Userbola site.
HOW YOU CAN DEPOSIT ONLINE BETS
You first have to register to become a member of a sports
gambling agent. After that you will be given a consumer ID to log in to enter the web gambling game.
Make a down payment of funds immediately to the bank account amount of the Trusted Soccer Agent if you need to play immediately.
The steps to create a deposit are as employs:
Submit Deposit Form
Ask for via our SMS CENTER at + 62-821-6182-5555
Demand via Whatsapp + 62-821-6182-5555
Request via Live Talk Userbola immediately
Please use the steps above to avoid irresponsible folks on behalf of Userbola.
End up being careful to avoid things we don’t want together.
Congratulations on joining the Indonesian Trusted Football Gambling Agent community.
Userbola is for those of you who are interested in actively
playing with us. Have a good bet.