0

I'm mapping a bunch of nursing homes where there have been incidents of abuse. I'd like to put hyperinks to the incident reports in the infowindows. Those would be PDFs hosted on Google Drive. Is this possible? And if so, how do the PDFs launch and display?

  • Did the answer below work for you? – DPSSpatial Nov 20 '17 at 16:42
  • This is precisely the help I was looking for. Thanks, @DPSSpatial! – Jack Julian Nov 21 '17 at 16:55
  • Great! Glad to help and thanks for accepting the answer! – DPSSpatial Nov 21 '17 at 17:38
3

As you add fields to your infoWindow, you can expose the HTML generated:

<div class="cartodb-popup v2">
  <a href="#close" class="cartodb-popup-close-button close">x</a>
  <div class="cartodb-popup-content-wrapper">
    <div class="cartodb-popup-content">
      <h4>city</h4>
      <p>{{city}}</p>
      <h4>date</h4>
      <p>{{date}}</p>
      <h4>flee</h4>
      <p>{{flee}}</p>
    </div>
  </div>
  <div class="cartodb-popup-tip-container"></div>
</div>

I would recommend adding a field to your dataset to store the URL's for each feature, then wrap a HREF tag around the field in the HTML:

<h4>View PDF</h4>
<p><a href="{{url}}">Click Here</a>

Or if there is a pattern to the URL and you already have an ID in your data that relates to the ID of the PDF on your server, you can build the link like this:

<h4>View PDF</h4>
<p><a href="http://www.images.com/{{featureID}}.pdf">Click Here</a>

The InfoWindow will look like this:

enter image description here

Standard HTML tags apply here, so to direct the PDF to a new window, you should add the target="window":

<h4>View PDF</h4>
<p><a href="http://www.images.com/{{featureID}}.pdf" target="window">Click Here</a>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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