Convert a shapefile into a interactive online map
Arun Gopinath / 2021-05-07
Introduction
Imagine you have a shapefile (.shp) with you. Now you want to show the interactive map to your colleague. There are two options:
- Share your shapefile via e-mail
OR
- Share as a link (more user friendly). Not everytime you are equipped with ArcGIS or QGIS. Its difficult to open those files in your mobile devices. So a easy link which opens an interactive map will be cool idea to checkout.
Let’s begin
From this point, I assume you have a shapefile with you. Incase you don’t have use this file from previous post.
Download shapefile
Now this is our plan.
- Convert shapefile into Geojson format (Using QGIS or ArcGIS or any other platform)
- Start a github account ( Learn more )
- Learn how to create a gist ( A code snippet sharing platform)
- Sharing the created gist as an interactive map
Steps
- Open the shapefile in QGIS.
- Right click the shapefile in the layers tab. Then, Export –> Save Features as.
- Select format as GeoJSON, Choose file destination and select Reference system(CRS). Then click Ok.
- Enable Add saved file to map to view the successfully converted file. Now we have a file ready to upload.
- Go to github.com and create an account.
- After successfully creating an account in Github, go to gist.github.com.
- Easiest way to add the file is drag and drop method. That means open the folder containing the .geojson file. Drag the file and drop in the blank space (check figure).
If the blank space is filled with text data, then proceed to next step.
- Most important part - make sure that you name the file you just copied with .geojson extension.
- Select Create public gist ( Secret gist cannot be used because our aim is to share the map with public ) . Next page will load our interactive map.
- Select Share option and copy the link.
- Instead of sharing as link you can embed the map in your website (if you have one ).
- What are you waiting for ? Happy sharing.
Output of this tutorial can be view here.
© Arun Gopinathan 2019-2024