Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sample Leaflet with GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<title>A Leaflet map!</title>
<link rel="stylesheet" href="" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="" />
<script src="" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
#map{ height: 100% }
<div id="map"></div>
// initialize the map
var map ='map').setView([42.35, -71.08], 3);
// load a tile layer
attribution: 'Tiles by <a href="">MAPC</a>, Data by <a href="">MassGIS</a>',
maxZoom: 17,
minZoom: 9
// load GeoJSON from an external file
fetch("countries.geojson").then(res => res.json()).then(data => {
// add GeoJSON layer to the map once the file is loaded
Copy link

loorlab commented Apr 14, 2021


Copy link

jivthesh commented Aug 15, 2021

from where do u get these geojson data any link you could share

Copy link

ThomasG77 commented Aug 15, 2021

Copy link

jivthesh commented Aug 17, 2021

Copy link

hugonbgg commented Nov 17, 2021


Copy link

amauryBM commented Jan 8, 2022


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment