Giter Club home page Giter Club logo

csv2shp's Introduction

csv2shp

This is a utility tool for converting a CSV file into an ESRI shapefile.

The CSV file should contain geometry stored in format of XY coordinates or WKT text.

Installation

make install

Configurations

csv2shp -i INPUT_FILE  -m xy|wkt [-x x_name_or_index, -y y_name_or_index |-geom geom_name_or_index ] [-delimiter ';'] -o output_file
  • i (required): input file
  • o (required): output file
  • m (required): mode (xy input or wkt input)
  • g (optional): geometry column name or idx starting from 0 (Default:'geom') used when mode is wkt
  • x (optional): x column name or idx starting from 0 (Default:'x') used when mode is xy
  • y (optional): y column name or idx starting from 0 (Default:'y') used when mode is xy
  • d (optional): delimiter of CSV file (Default: ';')
  • H (optional): with header, t or f (Default: 't')
  • h: help information

The data type of columns will be infered as int,double,string automatically. Without header (-H f), the columns will be named as field1, field2, ...

Example usage

cd example
csv2shp -i xy.csv -o example.shp -m 'xy' -d ','
csv2shp -i xy.csv -o example.shp -m 'xy' -d ',' -x 3 -y4
csv2shp -i wkt.csv -o example.shp -m 'wkt' -d ';'
csv2shp -i wkt.csv -o example.shp -m 'wkt' -d ';' -g 2
csv2shp -i xy_noheader.csv -o example.shp -m 'xy' -d ',' -x 3 -y 4 -H 'f'
csv2shp -i wkt_noheader.csv -o example.shp -m 'wkt' -g 2 -H 'f'

Check the result using ogrinfo:

ogrinfo -al example.shp

Requirement

  • Unix OS (tested on Ubuntu 16.04)
  • gcc >= 4.4 (gnu++11 used)
  • GDAL >= 2.1.0

Author information

Can Yang, Ph.D. student at KTH, Royal Institute of Technology in Sweden

Email: cyang(at)kth.se

Homepage: https://people.kth.se/~cyang/

csv2shp's People

Contributors

cyang-kth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.