Following the example below I try to add an external GeoJSON to my Leaflet map, but its markers don't appear on the map. I use this file GeoJson. Any explanation?


  <title>A Cyprus map!</title>
  <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
  <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
    <script src="jquery-2.2.4.min.js"></script>
    #map{ height: 100% }

  <div id="map"></div>


  // initialize the map
  var map = L.map('map').setView([35.170582481889134, 33.42520000000002],9);

  // load a tile layer
      attribution: 'by <a href="http://www.acgoldman.com/">Goldman solutions & services</a>, Data by <a href="http://www.opencartography.com">Open Cartography</a>',
      maxZoom: 17,
      minZoom: 9

  // loading GeoJSON file - Here my html and PicnicSites.geojson file resides in same folder
    // L.geoJson function is used to parse geojson file and load on to map


Error from console of Chrome:

enter image description here

$ is not defined

EDIT: The problem was the link of jquery and I didn't download any locally to.

  • 1
    What does the console output tell you? Every browser ships with developer tools. In Firefox you'd press F12, I'm not sure about Chrome, possibly Ctrl + Shift + i. Dec 18, 2018 at 11:09
  • 1
    A jsfiddle would be helpful. PS.: Keep in mind that maptimeboston.github.io/leaflet-intro refers to Leaflet 1.0.3, but there is a small possibility that Leaflet 1.3.4 has a slightly different API. Always refer to the latest documentation. Dec 18, 2018 at 11:18
  • 3
    It looks like jquery isn't loading so the geojson can't be fetched. Try switching to a hosted version. Dec 18, 2018 at 15:42
  • @MarcPfister you should post this as answer ;) I'm pretty sure this will solve his issue.
    – MrXsquared
    Dec 18, 2018 at 17:30

1 Answer 1


As the console log shows, jquery is not loading. This means either your path is wrong, or you don't have it installed locally at all. Without jquery your code won't load the geojson file.

Easiest solution would be to just use a hosted version:

<script src="https://unpkg.com/[email protected]/dist/jquery.min.js"></script>

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.