Geojson format is a lightweight file format that makes it easy to load geographic layers onto a web map. This format has gradually become the defacto standard when loading geographic data onto leaflet powered maps. In addition, geojson format incorporates both the spatial and attribute data of the geographic features.
This post will demonstrate how to convert shapefiles into geojson format.
First, create a working folder.
Download the JQuery script file and save it in the working folder.
Launch QGIS and load in the shapefile. For our example, we are using a polygon shapefile.
Right Click on the file and Save as
A Save As dialog box opens. a) Choose GeoJSON from the droplist, b) save the geoJson file in the working folder c) Choose the CRS option
Click oK to save.
A view of the working folder of our example. The HTML file, jquery script file and geojson file should all be in the same working folder.
Below is a web map example where the shapefile that was converted to geojson file format is loaded onto the leaflet powered map.
We will demonstrate how to use jquery to add geojson features from an external source to a leaflet powered map in latter posts.
Thank you for following the blog.