<p>I like where you're going with this, but what you're trying to do isn't possible (yet).</p>
<p>As it currently stands, you need to use an <strong>Asset</strong> as the <code>kmlFile</code> parameter...</p>
<p><a href="https://plugins.doublesecretagency.com/smart-map/kml-files/" rel="nofollow noreferrer">https://plugins.doublesecretagency.com/smart-map/kml-files/</a></p>
<p>It's on the roadmap to allow a string URL to be passed in directly.</p>
<hr />
<p><strong>UPDATE:</strong></p>
<p>I've just added the ability to specify a KML by its absolute URL string. The new feature will be included in the next release of Smart Map. :)</p>

CC BY-SA 4.0
2020-01-13T23:03:28.843Z
For those that come after, I got this in the smartMap error log; 
smartMap.log("[smartmap-mapcanvas-1] Error: URL for KML file must be absolute.");</script></body>

I had to set my local asset url to include the base url
Charlie Triplett
CC BY-SA 4.0
2020-01-08T22:37:09.750Z
2021-01-01T07:25:58.640Z
2021-01-01T07:25:58.640Z
Lindsey D
<p>I'm using Smart Map for Craft 3 to develop this filterable map for Columbia, Missouri. Here's the staging site:</p>
<p><a href="http://visionzerodev.org/map-alpha/" rel="nofollow noreferrer">http://visionzerodev.org/map-alpha/</a>
This works brilliantly. Huzzah.</p>
<p>Now, I also need to add a couple of KML layers to it.</p>
<p>Here's where I'm developing the KML proof of concept:
<a href="http://visionzerodev.org/map-bravo/" rel="nofollow noreferrer">http://visionzerodev.org/map-bravo/</a></p>
<p>BUT — I get the this error: &quot;Invalid KML file&quot;.</p>
<p>I'm sure I'm missing something obvious.</p>
<p>The KML is importable in Google Maps:
(It was previously used as is in FusionTables)
<a href="https://drive.google.com/open?id=1J4epYVJPZXFrmQjq19PSfQuMiTGWmcbt&amp;usp=sharing" rel="nofollow noreferrer">https://drive.google.com/open?id=1J4epYVJPZXFrmQjq19PSfQuMiTGWmcbt&amp;usp=sharing</a></p>
<p>The KML file is publicly accessible here:
<a href="http://visionzerodev.org/assets/data/high-crash-network.kml" rel="nofollow noreferrer">http://visionzerodev.org/assets/data/high-crash-network.kml</a></p>
<p>Here's my Twig:</p>
<pre><code>  {% set kmlFile = '/assets/data/high-crash-network.kml' %}

  {% set options = {
    height: 600,
  } %}

  {% if kmlFile %}
    {{ craft.smartMap.kml(kmlFile, options) }}
  {% endif %}
</code></pre>

<craft3><plugin-smartmap><google-maps>
Invalid KML file using Smart Map Plugin
# Invalid KML file using Smart Map Plugin

(Asked by: username_0 on 2020-01-05)

I'm using Smart Map for Craft 3 to develop this filterable map for Columbia, Missouri. Here's the staging site:
http://visionzerodev.org/map-alpha/
This works brilliantly. Huzzah.
Now, I also need to add a couple of KML layers to it.
Here's where I'm developing the KML proof of concept:
http://visionzerodev.org/map-bravo/
BUT — I get the this error: "Invalid KML file".
I'm sure I'm missing something obvious.
The KML is importable in Google Maps:
(It was previously used as is in FusionTables)
https://drive.google.com/open?id=1J4epYVJPZXFrmQjq19PSfQuMiTGWmcbt&usp=sharing
The KML file is publicly accessible here:
http://visionzerodev.org/assets/data/high-crash-network.kml
Here's my Twig:
  {% set kmlFile = '/assets/data/high-crash-network.kml' %}

  {% set options = {
    height: 600,
  } %}

  {% if kmlFile %}
    {{ craft.smartMap.kml(kmlFile, options) }}
  {% endif %}

**Tags:** craft3, plugin-smartmap, google-maps


---

## 1 answers

### Answer by username_1 on 2020-01-08. Score: 2

I like where you're going with this, but what you're trying to do isn't possible (yet).

As it currently stands, you need to use an **Asset** as the `kmlFile` parameter...

<https://plugins.doublesecretagency.com/smart-map/kml-files/>

It's on the roadmap to allow a string URL to be passed in directly.

---

**UPDATE:**

I've just added the ability to specify a KML by its absolute URL string. The new feature will be included in the next release of Smart Map. :)

> **Comments:**
> **username_0**: For those that come after, I got this in the smartMap error log;  smartMap.log("[smartmap-mapcanvas-1] Error: URL for KML file must be absolute.");</script></body>  I had to set my local asset url to include the base url  

---

