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 %}

1 Answer 1


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...


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


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. :)

  • 1
    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 Commented Jan 13, 2020 at 23:03

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.