Converting shapefile to geojson format using QGIS 2.8

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.

 

Capture-1

 

Right Click on the file and Save as

Capture-2

 

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.

Capture-3

 

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.

Capture-4

 

Below is a web map example where the shapefile that was converted to geojson file format is loaded onto the leaflet powered map.

 

Capture-6

 

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s