Convert Shapefile to CSV

Shapefile to csv

Sometimes shapefile becomes bulky to carry from one place to another. As it contains various files as .shp, .prj, .shx, .dbf etc. On the other side CSV contains every detail in one file. So CSV can be considered as a good option when you don’t need to render data on map as polygon or polyline or point. There are various options to create CSV from a shapefile either offline or online.

CSV is comma separated value file which is one of the alternative method for storing spatial data in spreadsheet format. You can also upload the Excel file and convert it into spatial data via QGIS tool. There are also other online tools available which can directly convert the Shapefile to CSV. We will show you how easy and useful is IGISMAP for the conversion process. Following are the methods to convert Shapefile to CSV using IGISMAP Converter tool.

IGISMAP (now MAPOG) to Convert Shapefile to CSV

Go to MapOG Converter Tool Shapefile to CSV, after logging in with your registered email and password. If you are a new user, click the Sign Up button in the Login popup and register to IGISMAP by filling the details.

There are three main steps for using GIS Converter:

  • Upload the data
  • Choose the format to which it should be converted
  • Download the converted file.

Step one is to upload your Shapefile which you want to convert. You can upload the file from your system or select from the Recent Files.

Upload Shapefile

Here we using the KML file of California state boundary.

Step two is to select choose the output format of the converted file, in this case its CSV. You can also set the Coordinate Reference System of your preference. As a default CRS will set to WGS 84 (World) [EPSG:4326]. Click on the Convert File button.

Select CSV as Output Format

Your Shapefile will then get converted to CSV file after a few seconds and will be published in the map canvas. You can download the CSV file of California state boundary by clicking the Download Converted File button.

Download and Publish CSV File

The output CSV file is generated with location information represented in WKT format under the field named ‘WKT’.

You can also choose to style the layer or continue with further conversion process by clicking the Convert Another File button.

Shapefile to CSV conversion – OFF-Line (command line) Tool

For using off-line command in your system you need to install ogr2ogr. There is very simple command to convert shapefile to csv file if you dont want to install a bulky GIS tool like QGIS or ArcGIS.

I am giving a way to install GDAL on ubuntu, while the process is almost similar to install the GDAL tool in Windows, Mac or other Linux system.

For installing GDAL for Ubuntu please follow the given commands.

Shapefile to CSV conversion

After installing you can check the availability of ogr2ogr by typing ogr2ogr on terminal.

After that you can follow the command to convert the shapefile to csv (comma separated value format file)

–> ogr2ogr -f CSV output_file_name.csv input_shp_name.shp -lco GEOMETRY=AS_WKT

The same work can be done in code-igniter or using PHP. For that you need to execute this command in shell_exec() method, which takes the command in string format and returns the output in string.

–>  $shpToCSV=”ogr2ogr -f CSV $out.csv $shp.shp -lco GEOMETRY=AS_WKT”;
–>  shell_exec($shpToCSV);

These statements are written in PHP. $ signifies the variable. Here input and output is taken from user and command is written in double quotes to convert in string. Then it is given to shell_exec() method.

Shapefile to CSV conversion – With QGIS Open source Software

If you don’t need to install any library or run online tools as you already have installed GIS software. You can convert shapefile in CSV using GIS software also. You just need to open the shapefile as vector layer and save it as CSV. For adding the vector layer tyou need to go to Layer->add vector layer and browse the shapefile. After the right click on shapefile title and save it as csv. you can also save some selected part.

You may also look on other Conversion of Files like Shapefile to KML or Shapefile to GeoJSON or GeoJSON to TopoJSON etc.

In this way you can convert shapefile in CSV format. Hope you find tutorial of shapefile to CSV conversion is helpful for you. If you find any problem in converting GIS data in CSV format, do comment below with the problem statement. Also if you know any other tool for converting shapefile, do provide your suggestion in the provided box below.

Author: Akshay Upadhyay

Owner and Director of a Private Limited company which serves individual to large scale industries in the field of Maps and GIS. He is a Gold Medalist in M.Tech(Spatial Information Technology) and owns some famous Technology blogs and website... Know more

One thought on “Convert Shapefile to CSV”

  1. The steps to convert are very clear and easy to follow. However, after the conversion it is not clear where the CSV file is saved. Hence, I could not retrieve the CSV file at the end.

    Kindly clarify.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.