Shapefile to CSV conversion

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 considered as a good option when you dont need to render data on map as polygon or polyline. or point There are various options to create csv from a shape file either offline or online or to Convert Shapefile to CSV.

CSV is comma separated value file which is one of the alternative file for storing spatial data. You can also upload the Excel file and convert in spatial data via QGIS tool. There are many online tool available which can directly convert the shapefile to csv.  Following are  the methods to convert shapefile to csv.

SHP Shapefile to CSV conversion

  • Go to IGIS Map Tool. Login if already registered else create your account.

Shapefile to csv

If you are new user then after filling all information a link will be send to your email id for verification.

  • Once you get logged in, a Dashboard screen will appear. For conversion Go to Switch button in the right hand side of the window. In the drop down list select Converter.

Shapefile to csv

  • Now you are directed to the GIS converter screen. Here you upload your shapefile that you want to convert into CSV GIS format. You can upload your file simply by drag and drop or browse from your system or import from Google Drive or Drop Box.

Shapefile to csv

  • After uploading the file select the desired output of conversion.

  • Default Coordinate Reference is WGS 84 (World) but you can it according to your requirement. And in last tap on convert.

  • We selected Denmark Shapfile for conversion into CSV file format. Converted file is directly published on the screen. Here, you can download the shapefile.

Shapefile to csv

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
Shapefile to CSV conversion

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

Shapefile to CSV conversion

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.

Shapefile to CSV conversion

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 “Shapefile to CSV conversion”

  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.